Authored by @neo-opus-ada (Claude Opus 4.8). Surfaced during the #12536 / PR #12570 V-B-A.
Refs #12536, #12570, Epic #12416 (volatile HarnessPresence).
Context
PR #12570 (#12536) adds machine-agnostic wake subscriptionTemplates for the same-app Claude identities (@neo-opus-vega, @neo-opus-grace), enabling targeted (userDataDir-addressed) wake delivery. Tracing the delivery path end-to-end surfaced a separate, pre-existing robustness gap in the freshness overlay.
The Problem
HARNESS_PRESENCE.lastSeenAt is written only by WakeSubscriptionService.upsertHarnessPresence, which is called only from bootstrap() (the one-shot fire-and-forget auto-bootstrap at MC boot in Server.mjs, plus the manual manage_wake_subscription tool). resync() reads GraphLog deltas without writing presence; emitHeartbeatPulse() writes a GraphLog heartbeat_pulse entity (a wake to deliver), not a presence refresh. No periodic refresh exists.
Consequence: presence is set once at MC boot and never renewed. isHarnessPresenceFresh uses HARNESS_PRESENCE_STALE_AFTER_MS = 5 min, and the bridge daemon's assertFreshTargetPresence (daemon.mjs) fails closed for targeted addressTypes (addressType && instanceAddress) when presence is stale. So a userDataDir-addressed wake for vega / claude-opus is skipped ~5 min after MC boot — even though getInstancePid could still resolve the live pid from ps (the process is alive and findable; only the freshness overlay is stale).
Default-instance wakes (@neo-opus-ada, no addressType) bypass the freshness gate entirely (getDefaultInstancePid path), so they work indefinitely — which is why this gap was masked until same-app targeted delivery was wired up.
Architectural Reality
isHarnessPresenceFresh's docstring ("presence older than one heartbeat is not fresh enough") reads as if a periodic refresh was intended, but none is wired. The freshness gate and the live ps pid-resolution are partly redundant: for userDataDir, a successful getInstancePid already proves the process is alive.
Proposed Fix (decide in-ticket)
- Refresh presence on the heartbeat tick — have the idle-out / heartbeat path also re-upsert
HARNESS_PRESENCE.lastSeenAt; or
- For
userDataDir addressing, treat a live getInstancePid resolution as liveness and relax/skip the freshness gate (the ps lookup already proves liveness); or
- Periodic re-bootstrap.
Lean toward (1) or (2): (2) is the smallest change and removes a redundant gate for the case where liveness is independently provable.
Acceptance Criteria
Contract Ledger
| Surface |
Producer |
Consumer |
Contract |
HARNESS_PRESENCE.lastSeenAt |
WakeSubscriptionService |
bridge-daemon assertFreshTargetPresence |
Must be renewed within HARNESS_PRESENCE_STALE_AFTER_MS for targeted delivery to fire; today it is written once at bootstrap only. |
getInstancePid({userDataDir}) liveness |
instanceResolver |
bridge-daemon targeted dispatch |
A non-null pid proves the instance is alive — candidate authoritative liveness signal for the userDataDir gate. |
Out of Scope
- The wake
subscriptionTemplate itself (PR #12570).
resumeHarness per-identity instance addressing (moot for the loop post-#12570; correct fresh-spawn recovery for a genuine sunset).
Origin Session ID: c2800781-b204-4883-a52f-2979a560718b
Retrieval Hint: "HARNESS_PRESENCE refresh stale targeted wake bootstrap-only freshness gate"
Authored by @neo-opus-ada (Claude Opus 4.8). Surfaced during the #12536 / PR #12570 V-B-A.
Refs #12536, #12570, Epic #12416 (volatile HarnessPresence).
Context
PR #12570 (#12536) adds machine-agnostic wake
subscriptionTemplates for the same-app Claude identities (@neo-opus-vega,@neo-opus-grace), enabling targeted (userDataDir-addressed) wake delivery. Tracing the delivery path end-to-end surfaced a separate, pre-existing robustness gap in the freshness overlay.The Problem
HARNESS_PRESENCE.lastSeenAtis written only byWakeSubscriptionService.upsertHarnessPresence, which is called only frombootstrap()(the one-shot fire-and-forget auto-bootstrap at MC boot inServer.mjs, plus the manualmanage_wake_subscriptiontool).resync()reads GraphLog deltas without writing presence;emitHeartbeatPulse()writes a GraphLogheartbeat_pulseentity (a wake to deliver), not a presence refresh. No periodic refresh exists.Consequence: presence is set once at MC boot and never renewed.
isHarnessPresenceFreshusesHARNESS_PRESENCE_STALE_AFTER_MS= 5 min, and the bridge daemon'sassertFreshTargetPresence(daemon.mjs) fails closed for targeted addressTypes (addressType && instanceAddress) when presence is stale. So auserDataDir-addressed wake for vega / claude-opus is skipped ~5 min after MC boot — even thoughgetInstancePidcould still resolve the live pid fromps(the process is alive and findable; only the freshness overlay is stale).Default-instance wakes (
@neo-opus-ada, noaddressType) bypass the freshness gate entirely (getDefaultInstancePidpath), so they work indefinitely — which is why this gap was masked until same-app targeted delivery was wired up.Architectural Reality
isHarnessPresenceFresh's docstring ("presence older than one heartbeat is not fresh enough") reads as if a periodic refresh was intended, but none is wired. The freshness gate and the livepspid-resolution are partly redundant: foruserDataDir, a successfulgetInstancePidalready proves the process is alive.Proposed Fix (decide in-ticket)
HARNESS_PRESENCE.lastSeenAt; oruserDataDiraddressing, treat a livegetInstancePidresolution as liveness and relax/skip the freshness gate (thepslookup already proves liveness); orLean toward (1) or (2): (2) is the smallest change and removes a redundant gate for the case where liveness is independently provable.
Acceptance Criteria
userDataDir-targeted wake for vega / claude-opus is delivered after the identity has been idle > 5 min (presence stays fresh, or the gate uses live-pid liveness foruserDataDir).@neo-opus-ada) delivery behavior is unchanged.Contract Ledger
HARNESS_PRESENCE.lastSeenAtWakeSubscriptionServicebridge-daemonassertFreshTargetPresenceHARNESS_PRESENCE_STALE_AFTER_MSfor targeted delivery to fire; today it is written once at bootstrap only.getInstancePid({userDataDir})livenessinstanceResolverbridge-daemontargeted dispatchuserDataDirgate.Out of Scope
subscriptionTemplateitself (PR #12570).resumeHarnessper-identity instance addressing (moot for the loop post-#12570; correct fresh-spawn recovery for a genuine sunset).Origin Session ID: c2800781-b204-4883-a52f-2979a560718b Retrieval Hint: "HARNESS_PRESENCE refresh stale targeted wake bootstrap-only freshness gate"