LearnNewsExamplesServices
Frontmatter
id10662
titleAdd Codex focus seed default to bridge-daemon (mirrors #10661)
stateClosed
labels
bugairegressionarchitecture
assigneesneo-opus-4-7
createdAtMay 3, 2026, 9:50 PM
updatedAtMay 3, 2026, 10:08 PM
githubUrlhttps://github.com/neomjs/neo/issues/10662
authorneo-opus-4-7
commentsCount1
parentIssue10647
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMay 3, 2026, 10:00 PM

Add Codex focus seed default to bridge-daemon (mirrors #10661)

Closedbugairegressionarchitecture
neo-opus-4-7
neo-opus-4-7 commented on May 3, 2026, 9:50 PM

Context

Empirical anchor from the cross-harness prompt-landing matrix execution (#10649) on 2026-05-03 ~19:43Z, captured publicly at #10649 comment 4367004889 and broadcast at A2A MESSAGE:d2f8dc1c-b329-4463-a896-8aad71c2ac5a:

@tobiu collapsed the Codex code sidebar and reproduced the Codex equivalent of the Claude pre-#10661 failure. Bridge wake delivery reached the Codex app window; osascript exited 0; but the composer did NOT have focus. The first Cmd+A in the bridge's destructive-clear sequence selected thread history instead of composer content. Codex row of the #10649 matrix is RED under collapsed-sidebar state.

The Claude row of the same matrix went green after PR #10661 introduced the per-harness focusSeedKey primitive defaulting to 'space' for appName === 'Claude', emitting key code 49 after Cmd+3 and before the destructive Cmd+A / Cmd+X clear sequence. The substrate primitive is in dev; only the per-harness default needs extension to Codex.

Per the cross-family coordination thread on this issue:

  • @neo-gpt (Codex identity holder, reactivation-gate owner) confirmed the lane split: short-term Codex Space-seed extension lands on me; medium-term Codex app-server adapter (anchored on existing #10517) lands on him
  • @neo-gemini-3-1-pro endorsed via broadcast MESSAGE:ceeb3d6f-965d-4c33-9823-9aae7239d17d
  • @tobiu confirmed: "we should try the SPACE key trick for codex too"

Operator-side interim mitigation: keep Codex sidebar open until the seed lands.

The Problem

bridge-daemon.mjs:588 defaults focusSeedKey to 'space' only when appName === 'Claude'. Codex matches the same focus-uncertainty failure mode under collapsed-sidebar state (Cmd+3 / cmd-tab / app-activation does not always land focus in the composer), but the bridge does not seed focus before the destructive clear. The result: Cmd+A operates on whatever IS focused (thread history list), Cmd+X cuts that, paste lands wake payload into the wrong target. Substrate-architecturally identical to the Claude case #10660 / #10661 closed.

The focusSeedKey primitive already supports per-harness defaults via the else if (appName === 'Antigravity') ... extension pattern (Antigravity stays unset / no seed because Cmd+Shift+I is already idempotent). Codex needs the same 'space' default Claude uses.

The Architectural Reality

  • ai/scripts/bridge-daemon.mjs:583-588 — per-harness focusSeedKey resolution. Currently:
        let focusSeedKey = meta.focusSeedKey;
      if (focusSeedKey === undefined && appName === 'Claude') focusSeedKey = 'space';
    Needs:
        let focusSeedKey = meta.focusSeedKey;
      if (focusSeedKey === undefined && (appName === 'Claude' || appName === 'Codex')) focusSeedKey = 'space';
  • ai/scripts/bridge-daemon.mjs:625-633 — Space-seed osascript injection. Already handles 'space' / ' ' via key code 49; no changes required to the keystroke-emission path.
  • ai/mcp/server/memory-core/openapi.yamlfocusSeedKey schema field already exposed (added in PR #10661); no schema change required.
  • ai/mcp/server/memory-core/services/WakeSubscriptionService.mjs — already documents focusSeedKey in the harnessTargetMetadata JSDoc (added in PR #10661); no service-layer change required beyond a round-trip test.

The Fix

Single conditional extension in bridge-daemon.mjs:

if (focusSeedKey === undefined && (appName === 'Claude' || appName === 'Codex')) focusSeedKey = 'space';

Plus the matching Anchor & Echo update on the comment block above the conditional, citing the empirical anchor (#10649 collapsed-sidebar reproduction).

Test coverage (mirrors PR #10661's bridge-daemon.spec.mjs additions):

  1. WakeSubscriptionService round-trip test — assert that subscribing with harnessTargetMetadata.focusSeedKey: 'space' for Codex round-trips correctly through the schema validation. Mirror of the existing Claude test.
  2. Bridge-daemon ordering test for Codex — mock osascript pattern, verify the keystroke sequence is activate < tab < space < clear for Codex (same shape as the existing Claude ordering test). The collapsed-sidebar reproduction is operator-side; the unit test verifies the bridge emits the right keystroke order, which matches the matrix-validated test path the operator runs against the live IDE.

Acceptance Criteria

  • bridge-daemon.mjs per-harness focusSeedKey default fires for both appName === 'Claude' AND appName === 'Codex'
  • Anchor & Echo comment block on the conditional explains the empirical Codex collapsed-sidebar regression + cross-references #10649 + #10661
  • WakeSubscriptionService.spec.mjs adds a round-trip test for harnessTargetMetadata.focusSeedKey: 'space' under Codex appName
  • bridge-daemon.spec.mjs adds an ordering test (activate < tab < space < clear) for Codex matching the existing Claude test
  • Existing tests continue to pass — no regression in Claude / Antigravity rows
  • After merge: a controlled bridge test against @neo-gpt Codex Desktop with sidebar collapsed shows wake-digest landing in composer (not thread history), matrix Codex row flips to green
  • After matrix Codex row green: per #10650 protocol, reactivation-gate becomes eligible (gate flip + heartbeat reactivation remains @tobiu's call)

Out of Scope

  • Codex app-server adapter (turn/start / turn/steer / thread/inject_items via codex debug app-server send-message-v2) — anchored on existing #10517, owned by @neo-gpt, supersedes UI-keystroke delivery once shipped
  • Disable-Codex-subscription operational mitigation — covered by operator-side discipline (sidebar-open) and the medium-term app-server adapter; only relevant if the Space seed empirically fails
  • Antigravity / Claude focus-seed changes — both already validated green on the matrix; no change
  • Bridge backlog fence handling — already documented in the #10650 protocol; not part of this fix
  • Cross-process cache-invalidation under live updates — separate substrate concern (#10186)

Avoided Traps

  • Trap: introduce a new primitive instead of extending focusSeedKey. Rejected. PR #10661 just shipped the per-harness focus-seed primitive precisely so future harnesses adopt by extending the default map. Re-architecting would discard the substrate work just merged.
  • Trap: hardcode Codex as a third branch in the keystroke-emission logic. Rejected. The 'space' / ' 'key code 49 and else → keystroke "${focusSeedKey}" paths already handle the Codex case identically to Claude; only the per-harness default needs extension.
  • Trap: assume the Codex regression is identical to Claude's pre-#10661 state. Need to verify empirically: Codex collapsed-sidebar may have additional UI quirks (e.g., the composer might be in a separate window pane that Cmd+3 doesn't touch). The empirical bridge test against collapsed-sidebar Codex is the load-bearing verification; if the Space seed alone doesn't fix it, escalate to disable-subscription or accelerate the medium-term app-server adapter.
  • Trap: change appName === 'Claude' to appName === 'Codex' instead of OR-ing. Rejected — would regress Claude back to red.

Related

  • Parent: #10647 (Wake Incident Safety Tree epic)
  • Mirror: #10661 / closed by PR #10661 (Claude focus seed; this ticket extends the same primitive to Codex)
  • Matrix sibling: #10649 (cross-harness prompt-landing matrix; this ticket flips the Codex row from red to green)
  • Composer-focus epic context: #10658
  • Medium-term superseder: #10517 (HarnessPresence + Codex app-server adapter — non-UI delivery path that bypasses focus seeding entirely)
  • Operator protocol: #10650 (Wake Substrate Incident Protocol — reactivation-gate evidence requirements depend on this fix)

Origin Session ID

Origin Session ID: 9766f91c-51f8-44fe-ac34-d79f61a0e1bf

Retrieval Hint

query_raw_memories("Codex collapsed-sidebar focusSeedKey space seed bridge-daemon") or query_summaries("Codex focus seed extension #10661 mirror"). Empirical anchor: #10649 comment 4367004889 + A2A MESSAGE:d2f8dc1c-b329-4463-a896-8aad71c2ac5a from @neo-gpt (2026-05-03 19:43Z) + cross-family coordination thread MESSAGE:a6197e52-a95a-440c-b82b-a8f6cc050ea4 (mine) + MESSAGE:93a1d01f-ce14-4def-bd0a-3a9b3c91dff6 (GPT confirmation).

tobiu referenced in commit 73dfaf6 - "fix(ai): extend focus seed default to Codex (#10662) (#10663) on May 3, 2026, 10:00 PM
tobiu closed this issue on May 3, 2026, 10:00 PM