---
number: 12466
title: >-
  fix(bridge-daemon): frontmost guard bundle-fallback for same-bundle instances
  (#12465)
author: neo-claude-opus
state: MERGED
createdAt: '2026-06-04T01:18:15Z'
updatedAt: '2026-06-04T01:21:57Z'
closedAt: '2026-06-04T01:21:54Z'
mergedAt: '2026-06-04T01:21:54Z'
head: agent/12464-wake-guard-bundle-fallback
base: dev
url: 'https://github.com/neomjs/neo/pull/12466'
---
Authored by Claude Opus 4.8 (Claude Code). Session 3ecb40bf-bfef-40b1-8693-a8aae5afa1b7.

Resolves #12465
Refs #12424
Refs #12440

The wake **already reaches the right window** (operator-observed: Codex focus → Neo prompt field focus), but the `#12424` `assertTargetFrontmost` guard then aborts with `pid 91267 != 92897`. System Events can't distinguish two same-bundle Claude instances — it reports the sibling's pid even when the correct window is focused — so the strict pid check dropped a delivery that had landed. This relaxes the guard to a bundle-identity fallback.

FAIR-band: under-target (@neo-claude-opus; bug fix unblocking my own wake delivery for nightshift).

Evidence: L1 (static — guard logic relax; the activation is already confirmed-working by the operator's observation that the prompt field receives focus) → L4 (live wake landing) on the operator's next daemon restart. No blocking residual.

## What shipped (`ai/daemons/bridge/daemon.mjs`)
`assertTargetFrontmost`: when `currentPid != targetProcessId`, fall back to comparing bundle identifiers; abort only on a genuinely different bundle. Same-bundle sibling → accept (the `set frontmost of <pid>` already targeted the right window); different app → still abort (mis-delivery protection kept).

## Deltas from ticket
None — implements the ticket's fix exactly.

## Test Evidence
`node --check` passes; +7/−1, the guard's pid branch only. The activation reaching the right window is operator-confirmed; the daemon-context delivery is observable in `bridge.log` post-restart (`WAKE_SUB:84dfc4da` `Delivered`, no `91267 != 92897` abort).

## Post-Merge Validation
- [ ] Neo instance wakes deliver while the default Claude sibling is reported frontmost.
- [ ] A non-Claude frontmost app still aborts (no mis-delivery).

## Deploy
`git checkout agent/12464-wake-guard-bundle-fallback -- ai/daemons/bridge/daemon.mjs` in the deployment clone + restart, or merge + pull + restart.

🖖
