Skip to content

chat: bound the wake bypass, and prove a parked deployment redeploys clean (CL-6644, part B) - #314

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-6644-wake-b
Aug 22, 2026
Merged

chat: bound the wake bypass, and prove a parked deployment redeploys clean (CL-6644, part B)#314
TheGreatAxios merged 2 commits into
mainfrom
cl-6644-wake-b

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

CL-6644 part B: the wake itself. Part A (#313) fixed diagnosability. This
picks up its own note: I traced the wake hop
(ensureAwake/wakeByAddress/wakeFoldedRun/deployAdoptedWorkflowFromSource/
sendAgentDeploy) all the way to the vendored @intx/hub-sessions WS layer.

What I ruled out. @corbits/agent-lifecycle's ensureAwake (CL-6643,
already on main) bounds a wake to 30s. The sidecar's own deploy path
(apps/sidecar/src/workflow-host-wiring/index.ts) does not gate a fresh
deploy() on a parked record's residue: activeSupervisors is cleared on
hibernate teardown, transport is unregistered unconditionally, and a
same-address slug re-claim is a defensive no-op. A new sidecar test
(apps/sidecar/test/workflow-teardown-flavor.test.ts) proves a deploy()
call for an address right after its hibernate teardown completes cleanly
against the kept parked record and step-state dir. So a parked record left
"asleep" by #288's boot scan is genuinely resumable through the ordinary
wake path -- I'm not quarantining it at boot; that would throw away state a
wake can still use.

What was actually broken. Three call sites invoke wakeByAddress
directly, bypassing ensureAwake's 30s bound entirely:

  • sendMail's no-lifecycle-configured fallback
  • the exported ensureAwake hook's no-lifecycle fallback
  • sendFoldedMailWithReclaimRetry's reclaim-retry wake (packages/chat/src/platform-adapter.ts:659) -- this one bypasses the bound regardless of whether lifecycle is configured, since it always calls wakeByAddress raw.

Each is a full deploy round-trip to the sidecar with no timeout. A deploy
the sidecar never acks (dropped frame, socket hiccup, whatever) wedges the
caller -- and, for the reclaim-retry loop, every later send behind it --
forever instead of failing loud. That is the multi-minute silent hang CL-6644
describes.

Fix

Test plan

  • WORKBENCH_CHECK_SINCE=origin/main bun run typecheck -- pass
  • WORKBENCH_CHECK_SINCE=origin/main bun run lint -- pass
  • WORKBENCH_CHECK_SINCE=origin/main bun run test -- pass, including
    the new sidecar parked-redeploy test
  • Live repro (send -> typing -> real Ollama reply) -- not run against
    the shared stack in this timeboxed session; the fix removes the one
    remaining unbounded hop in the wake path, but a live send against a
    genuinely dropped agent.deploy.ack would be the strongest proof.
    Flagging for a follow-up verification pass rather than guessing.

…esidue

CL-6644 part B: nothing sidecar-side ever resumes a parked deployment on
its own since 0fd3fbc deleted the in-place park/wake handler, and the
CL-6282 boot scan skips a parked record entirely rather than restoring
it -- so a hub-driven wake is always a fresh agent.deploy for the address,
against whatever residue a hibernate teardown left: the deployment record
(kept, marked parked, not deleted) and the step-state dir (kept for a
resume). This proves that redeploy completes cleanly against that residue.
…eout

CL-6644 part B. `@corbits/agent-lifecycle`'s ensureAwake already bounds a
wake to DEFAULT_WAKE_TIMEOUT_MS (CL-6643) -- but only when it is the one
calling wakeByAddress. Three call sites bypassed that bound entirely by
calling wakeByAddress directly: sendMail's no-lifecycle fallback, the
exported ensureAwake hook's no-lifecycle fallback, and (regardless of
whether lifecycle is configured) sendFoldedMailWithReclaimRetry's reclaim
retry. A deploy round-trip the sidecar never acked wedged any of these
forever instead of failing loud -- the confirmed second half of the
"cold wake never completes" symptom.

Also corrects wakeByAddress's stale CL-6267 comment, which still
described the sidecar-side park/wake handler 0fd3fbc deleted days
before CL-6282 shipped. The parked-record redeploy this comment worried
about already works today (see the new sidecar test) -- the comment was
just describing a mechanism that no longer exists.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant