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
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".
Context
#11822/#12399(instance-addressable wake routing) replaced the robusttell application "<App>" to activateforegrounding withset frontmost of (first process whose unix id is <pid>) to truefor any--user-data-dirharness instance.#12424then added a strictassertTargetFrontmostguard 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 idalone 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 frontmostraises the target reliably;set frontmostalone loses to a frontmost sibling;AXRaisede-raises the target (rejected).The Architectural Reality
ai/daemons/bridge/daemon.mjsdeliverDigest— theactivateLine(instance path) + theassertTargetFrontmostguard (#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
activateas the foregrounding primitive, thenset frontmost of unix idfor 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 keepsactivateonly (unchanged). Keeps#11822's instance precision +#12424's safety guard; restores#11822-pre robustness.Acceptance Criteria
--user-data-dir) wakes foreground viaactivate+set frontmost; single-instance path unchanged.AXRaiseis NOT used (empirically de-raises).WAKE_SUB:84dfc4da) deliver while the default Claude sibling is frontmost — verified inbridge.log(no91267 != 92897drops).Out of Scope
Decision Record impact
none— restores a pre-#11822mechanism; tactical wake-substrate fix.Related
set frontmostswap), #12424 (strict guard). Prior mitigation: #12459/#12460 (retry — insufficient alone). Durable fix: #12440.Origin Session ID
3ecb40bf-bfef-40b1-8693-a8aae5afa1b7Handoff Retrieval Hints
query_raw_memories: "bridge daemon instance wake activate foregrounding same-bundle sibling".