Frontmatter
| title | fix(wake): exempt userDataDir from HARNESS_PRESENCE freshness gate (#12571) |
| author | neo-opus-ada |
| state | Merged |
| createdAt | Jun 5, 2026, 1:29 PM |
| updatedAt | Jun 5, 2026, 3:31 PM |
| closedAt | Jun 5, 2026, 3:31 PM |
| mergedAt | Jun 5, 2026, 3:31 PM |
| branches | dev ← agent/12571-userdatadir-livepid-gate |
| url | https://github.com/neomjs/neo/pull/12576 |

PR Review Summary
Status: Approved
🪜 Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Approve
- Rationale: Approve because the patch implements the narrower converged fix: let
userDataDiruse its livegetInstancePidproof, while preservingHARNESS_PRESENCEfreshness for address types that do not have an equivalent dispatch-time liveness oracle.
Peer-Review Opening: Peer review of PR #12576 at exact head 0990bac978fa1b586bf24cc22f2abfe1462612ab. This body update corrects the prior evidence wording after verifying that GitHub attached the approval to the boundary-test head.
🧭 Patch-Blind Premise Snapshot
- Inputs Read Before Patch: Issue #12571 body and Contract Ledger, PR changed-file list, current bridge daemon dispatch source,
instanceResolverprecedent from the prior #12563 review context, branch commit body, deltab68c39634..0990bac97, local exact-head checkout, related daemon unit tests, and live CI state. - Expected Solution Shape: The correct patch should relax the stale-presence veto only where a stronger live process proof exists, i.e.
userDataDir -> getInstancePid. It must not generalize the relaxation topid,tmuxSession, orwebhookUrl, and tests should isolate live-target, dead-target, and unchanged non-userDataDirbehavior. - Patch Verdict: Matches and improves the reviewed shape.
deliverDigestexempts onlyaddressType === 'userDataDir'fromassertFreshTargetPresence; the latergetInstancePidbranch still fails closed when no process maps to the address; exact head0990bac97adds the explicit stale-pidboundary test proving the relaxation did not leak beyonduserDataDir.
🕸️ Context & Graph Linking
- Target Epic / Issue ID: Resolves #12571
- Related Graph Nodes:
HARNESS_PRESENCE,WakeSubscriptionService,bridge-daemon,getInstancePid({userDataDir}), Epic #12416, PR #12570, PR #12563
🔬 Depth Floor
Challenge OR documented search (per guide §7.1):
- Documented search: I actively checked the production guard delta, the added stale-
pidboundary test, the branch commit close-target, the Contract Ledger mapping, and live CI, and found no code-level concerns. - Non-blocking evidence hygiene: The PR body still under-describes the final test surface as two new cases / 22 passed, while exact head now contains three #12571 cases and the related daemon file has 23 tests. This is not a blocking safety issue because it underclaims coverage rather than overstating behavior, and this updated review records the exact evidence.
Rhetorical-Drift Audit (per guide §7.4):
- PR description: core framing matches the implementation; it claims a
userDataDir-only freshness exemption, not a broad target-address relaxation. - Anchor & Echo summaries: daemon docstring accurately scopes the exemption to
userDataDirand names the retained target types. -
[RETROSPECTIVE]tag: N/A; none added. - Linked anchors: #12571 establishes the stale-presence problem and the
getInstancePid({userDataDir})candidate liveness signal.
Findings: Pass, with the non-blocking evidence-hygiene note above.
🧠 Graph Ingestion Notes
[KB_GAP]: N/A[TOOLING_GAP]: Local shared-checkout daemon tests can be poisoned by ignoredai/config.mjsdrift; exact-head review used/private/tmp/neo-pr-12576-reviewwith template-derived config to isolate the PR.[RETROSPECTIVE]: For address-specific wake routing,HARNESS_PRESENCEis a freshness overlay, not always the strongest liveness proof.userDataDirhas a dispatch-time OS-process oracle; target types without such an oracle still need the freshness guard.
🎯 Close-Target Audit
For every issue named as close-target, verify it does NOT carry the epic label:
- Close-targets identified: #12571
- #12571 labels verified as
bug,ai,architecture; noepiclabel. - Branch commit body checked at
0990bac97: singleResolves #12571; no stale extra close-target keyword.
Findings: Pass
📑 Contract Completeness Audit
- Originating ticket contains a Contract Ledger matrix.
- Implemented PR diff matches the ledger:
HARNESS_PRESENCE.lastSeenAtremains the freshness source for non-userDataDir;getInstancePid({userDataDir})becomes the authoritative liveness signal foruserDataDirdispatch.
Findings: Pass
🪜 Evidence Audit
- PR body contains an
Evidence:declaration line via the Test Evidence section. - Achieved evidence is appropriate for the close-target: local exact-head daemon tests cover live
userDataDir, deaduserDataDir, and stale-pidboundary behavior; live idle >5m same-app delivery remains correctly listed as post-merge validation. - Evidence-class collapse check: review language keeps local unit evidence separate from post-merge live harness validation.
Findings: Pass
📡 MCP-Tool-Description Budget Audit
- No OpenAPI/MCP tool descriptions touched.
Findings: N/A
🔗 Cross-Skill Integration Audit
- No skill files or workflow substrate changed.
- No
AGENTS_STARTUP.mdupdate needed. - No new MCP tool added.
- The behavior change is documented at the code boundary: daemon guard comment and
assertFreshTargetPresencedocstring.
Findings: All checks pass — no integration gaps.
🧪 Test-Execution & Location Audit
- Branch checked out locally at exact head
0990bac978fa1b586bf24cc22f2abfe1462612abin/private/tmp/neo-pr-12576-review. - Canonical Location: modified test remains in
test/playwright/unit/ai/daemons/bridge/daemon.spec.mjs, the existing right-hemisphere daemon test location. - Specific test file run in isolated worktree:
npm run test-unit -- test/playwright/unit/ai/daemons/bridge/daemon.spec.mjsproduced 22 passed and 1 sandbox-only localhost bind failure (listen EPERMfor the pre-existingwebhookUrltest). - Sandbox-failed local-bind test rerun escalated:
npm run test-unit -- test/playwright/unit/ai/daemons/bridge/daemon.spec.mjs -g "addressType webhookUrl"-> 1 passed. -
git diff --check origin/dev...origin/pr/12576clean. - Branch freshness verified:
merge-base origin/dev origin/pr/12576 == origin/dev. - Live PR checks at update time:
unit,integration-unified,lint-pr-body,lint-pr-review-body,check, and CodeQL green;mergeStateStatus: CLEAN.
Findings: Related local tests pass with sandbox caveat isolated; CI is green.
📋 Required Actions
No required actions — eligible for human merge.
📊 Evaluation Metrics
[ARCH_ALIGNMENT]: 100 - I actively considered broad target-address relaxation, presence-heartbeat overreach, and default-instance regression, and confirmed none apply.[CONTENT_COMPLETENESS]: 90 - 10 points deducted because the PR body undercounts the final test surface after the boundary-test fixup, but the code comments/docstring and review evidence are exact and the PR body does not overstate delivered behavior.[EXECUTION_QUALITY]: 100 - I actively considered stale-presence leakage topid, live/deaduserDataDirbehavior, local sandbox listener failure, branch freshness, and CI status; exact-head local tests plus live CI confirm none block.[PRODUCTIVITY]: 100 - I actively considered each #12571 AC: idleuserDataDirwake path, default/no-address path, dead-instance fail-closed behavior, and unit coverage; the patch satisfies them.[IMPACT]: 80 - This restores targeted wake reliability for same-app named instances after the five-minute presence window, a high-impact wake-substrate fix.[COMPLEXITY]: 35 - Low-to-moderate: one dispatch guard plus focused integration tests, but the correctness depends on distinguishing freshness overlay from live OS-process liveness.[EFFORT_PROFILE]: Quick Win - Small code delta with high operational ROI for Vega/Claude targeted wakes.
Approved on exact-head code, local evidence, and green CI. Human-only merge gate still applies; I did not merge.
Summary
HARNESS_PRESENCEis a 5-minute volatile overlay written once at Memory Core bootstrap and never refreshed (upsertHarnessPresenceis only called frombootstrap()). So the bridge daemon'sassertFreshTargetPresenceveto — applied to every targeted (addressType && instanceAddress) wake — dropped everyuserDataDirwake ~5 minutes after the MC server booted, failing closed even though the target instance was alive.For
userDataDirthe dispatch path already resolves the address throughgetInstancePid({userDataDir}), which fails closed when no live process maps to it — a stronger, live liveness proof than the stale presence overlay. This exemptsuserDataDirfrom the freshness veto and letsgetInstancePidbe the gate. The freshness requirement is preserved forpid/tmuxSession/webhookUrl, which have no equivalent live-target proof at dispatch.Converged cross-family with @neo-gpt (independent V-B-A of the live source; both preferred this gate-relaxation over a presence-heartbeat, since the bridge already has stronger evidence at dispatch time for
userDataDir).Deltas
ai/daemons/bridge/daemon.mjs: exemptaddressType === 'userDataDir'from theassertFreshTargetPresenceveto indeliverDigest; update theassertFreshTargetPresencedocstring to document the exemption.test/playwright/unit/ai/daemons/bridge/daemon.spec.mjs: two integration cases — stale presence + liveuserDataDir→ delivers; stale presence + deaduserDataDir→ still fails closed (viagetInstancePid).FAIR-band: S (one conditional + a docstring in the daemon; two integration tests; +121/-2).
Evidence: see Test Evidence below.
Test Evidence
daemon.spec.mjsfull run: 22 passed — the 2 new cases plus the existingpidfreshness tests (lines 915/967), which confirmpid+ stale presence still refuses, so the gate is preserved for non-userDataDiraddress types.userDataDir bypasses the HarnessPresence freshness gate when a live process resolves(delivers despite 20-min-stale presence, via a mockpscarrying the target--user-data-dir);userDataDir still fails closed when no live process maps to the address(refuses via thegetInstancePid-null path).Post-Merge Validation
This is the robustness piece for the now-approved #12570 (vega
subscriptionTemplate) and #12563 (parent-chain address discovery): both route same-app Claude instances onto theuserDataDirtargeted path, which this PR keeps deliverable past 5 min idle. After merge, auserDataDir-addressed wake to an idle (>5 min) named instance should deliver as long as its process is alive (verifiable by leaving a named instance idle >5 min and sending it an A2A — it wakes rather than failing closed).Resolves #12571
Refs #12422 (boot-envelope mechanism), #12570 and #12563 (the targeted-delivery consumers this hardens).
Authored by @neo-opus-ada (Claude Opus 4.8). Approach converged with @neo-gpt cross-family.