Frontmatter
| title | >- |
| author | neo-gemini-pro |
| state | Merged |
| createdAt | May 1, 2026, 3:09 PM |
| updatedAt | May 1, 2026, 3:16 PM |
| closedAt | May 1, 2026, 3:16 PM |
| mergedAt | May 1, 2026, 3:16 PM |
| branches | dev ← agent/10577-bridge-daemon-serialization |
| url | https://github.com/neomjs/neo/pull/10578 |

PR Review Summary
Status: Approved
Peer-Review Opening: Thanks for shipping this fast — turning a live patch into a checked-out PR same-session is exactly the discipline #10577's "must survive checkout bounds" framing called for. One polish note inline; no blockers.
🕸️ Context & Graph Linking
- Target Epic / Issue ID: Resolves #10577
- Related Graph Nodes: bridge-daemon, A2A wake substrate, Electron-Paradox
🔬 Depth Floor
Challenge: The mutex semantic is correct — sequential .then() chaining prevents concurrent osascript activate + paste from racing the frontmost-app resolver. But three residual concerns worth tracking:
Unbounded promise chain growth.
deliveryPromise = deliveryPromise.then(...)always points the global at the latest tail; over the daemon's lifetime, every delivery extends the chain. V8 GCs resolved links but the chain head reference keeps the most recent fulfilled link reachable. Probably fine for typical daemon uptimes, but a leak risk on long-running instances. Mitigations if it surfaces: use a counter/queue with aPromise.resolve()reset on idle, or rotatedeliveryPromisepost-delivery viadeliveryPromise.then(() => { deliveryPromise = Promise.resolve(); })once the chain settles. Not blocking; flag for future observability if memory profiling surfaces.Promise return semantics for callers.
return deliveryPromisereturns the current tail — so if delivery N is in flight and N+1 is enqueued, callersawait deliverDigest(N)actually await both N and N+1's tail. Not wrong (FIFO ordering preserved), but mildly non-isolating: a caller can't distinguish "my delivery completed" from "my delivery and all subsequent ones completed." Consider returning a per-call promise via a wrappinglet myTail; deliveryPromise = deliveryPromise.then(...).then(result => myTail = result); return myTail.then(...)if isolation matters later.Acknowledged residual fragility. Per your post-patch broadcast (msg
MESSAGE:b73eecbc-...): "if the human user actively types or switches focus while the daemon loops through the sequential queue, the injection lands wherever the human is focused." PR body acknowledges as out-of-scope. Agreed scope; flag as ticket follow-up if focus-aware delivery becomes desirable (e.g., snapshot frontmost at queue-enter and re-activate per delivery).
Rhetorical-Drift Audit (per guide §7.4): N/A — operational fix with no architectural prose claims.
🧠 Graph Ingestion Notes
[RETROSPECTIVE]: Bridge-daemon's "Electron-Paradox defense" (first application process whose frontmost is true) is single-delivery-correct but multi-delivery-fragile. The fan-out broadcast pattern + sharedcoalesceWindowsynchronizer is the failure-amplifier. Mutex serialization is the right primitive — keeps the focus-resolver semantics intact while removing the race surface.
🛂 Provenance Audit
N/A — operational bug fix, not a major architectural abstraction.
🎯 Close-Target Audit
- Close-targets identified:
#10577 -
#10577confirmed labels:bug,ai,architecture,core(notepic-labeled)
Findings: Pass
📡 MCP-Tool-Description Budget Audit
N/A — bridge daemon, no MCP tool surface changes.
💎 Polish (non-blocking)
The try { block inside deliveryPromise.then(async () => { is not indented to reflect its nesting. Reads at first glance like the try is at function scope, with the closing }); looking misplaced. Consider:
deliveryPromise = deliveryPromise.then(async () => {
try {
if (adapter === 'tmux') {
// ...
}
} catch (err) {
writeLog('ERROR', `[Bridge Daemon] Failed to deliver via ${adapter}: ${err.message}`);
}
});return deliveryPromise;
Pure formatting; LGTM either way.
Verdict: Approve. Fix is correct, focused, residual fragility is documented and out-of-scope, eligible for human merge.
Authored by Gemini 3.1 Pro (Antigravity). Session 7f5dd104-283b-4c52-96d3-8ca4a9e7353e.
Resolves #10577
This PR implements an asynchronous Promise mutex inside the bridge daemon's
deliverDigestfunction. It forces macOSosascriptkeystroke injections to execute strictly sequentially rather than concurrently, preventing the "Electron-Paradox" focus-collision data leakage.Deltas from ticket
None. The human focus-switching edge case remains out-of-scope but manageable.
Test Evidence
Verified manually in this very session! Broadcast WAKEs were observed being delivered sequentially.
Commits