LearnNewsExamplesServices
Frontmatter
id12462
titleBridge daemon: instance-addressed wakes lose focus to same-bundle sibling
stateClosed
labels
bugaiarchitecture
assignees[]
createdAtJun 4, 2026, 2:49 AM
updatedAtJun 4, 2026, 3:04 AM
githubUrlhttps://github.com/neomjs/neo/issues/12462
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 4, 2026, 3:04 AM

Bridge daemon: instance-addressed wakes lose focus to same-bundle sibling

Closed v13.0.0/archive-v13-0-0-chunk-16 bugaiarchitecture
neo-opus-grace
neo-opus-grace commented on Jun 4, 2026, 2:49 AM

Context

#11822/#12399 (instance-addressable wake routing) replaced the robust tell application "<App>" to activate foregrounding with set frontmost of (first process whose unix id is <pid>) to true for any --user-data-dir harness instance. #12424 then added a strict assertTargetFrontmost guard that aborts delivery on any focus mismatch. Combined, instance-addressed wakes (e.g. @neo-opus-grace's Neo Claude instance) fail whenever a same-bundle sibling holds the foreground: set frontmost of unix id alone cannot switch between two same-bundle Electron instances from the headless daemon, so the guard hard-drops the wake.

Evidence: the Neo instance (pid 92897) failed delivery 16× on 06-03 + 21× on 06-04 (Target app lost frontmost status after activation (pid 91267 != 92897)), interleaved with successes only when the sibling (91267, default Claude) was already frontmost. Empirically (osascript probes on the host): activate + set frontmost raises the target reliably; set frontmost alone loses to a frontmost sibling; AXRaise de-raises the target (rejected).

The Architectural Reality

  • ai/daemons/bridge/daemon.mjs deliverDigest — the activateLine (instance path) + the assertTargetFrontmost guard (#12424) + the poll-re-activate loop (#12460).
  • instanceResolver.mjs — resolves the correct pid (works; the resolution is NOT the bug — the raise is).

The Fix

Restore activate as the foregrounding primitive, then set frontmost of unix id for instance precision. Each poll iteration: tell application "<App>" to activate (reclaims the bundle to front — works from the headless daemon) → set frontmost of (process whose unix id is <pid>) (disambiguate to the right instance). Single-instance/no-userDataDir path keeps activate only (unchanged). Keeps #11822's instance precision + #12424's safety guard; restores #11822-pre robustness.

Acceptance Criteria

  • Instance-addressed (--user-data-dir) wakes foreground via activate + set frontmost; single-instance path unchanged.
  • AXRaise is NOT used (empirically de-raises).
  • (post-deploy, the real test) the Neo instance's wakes (WAKE_SUB:84dfc4da) deliver while the default Claude sibling is frontmost — verified in bridge.log (no 91267 != 92897 drops).
  • No regression for non-Claude harnesses (Codex/Antigravity — different bundles, already work).

Out of Scope

  • The non-focus delivery channel (the durable fix; → #12440).

Decision Record impact

none — restores a pre-#11822 mechanism; tactical wake-substrate fix.

Related

  • Regression source: #11822/#12399 (set frontmost swap), #12424 (strict guard). Prior mitigation: #12459/#12460 (retry — insufficient alone). Durable fix: #12440.

Origin Session ID

3ecb40bf-bfef-40b1-8693-a8aae5afa1b7

Handoff Retrieval Hints

  • query_raw_memories: "bridge daemon instance wake activate foregrounding same-bundle sibling".
tobiu referenced in commit c5e0c44 - "fix(bridge-daemon): activate-foreground before instance set-frontmost for same-bundle wakes (#12462) (#12463) on Jun 4, 2026, 3:04 AM
tobiu closed this issue on Jun 4, 2026, 3:04 AM