Skip to content

feat(sidecar)!: idle hibernate is the run's own decision; drop agent-lifecycle (CL-8187) - #777

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-8187-drop-agent-lifecycle
Sep 17, 2026
Merged

TheGreatAxios merged 2 commits into
mainfrom
cl-8187-drop-agent-lifecycle

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

  • Stock Interchange has no undeploy route, so a reaper workflow can't exist yet (upstream ask tracked separately). Idle hibernation is now the sidecar's own decision: apps/sidecar/src/workflow-host-wiring/index.ts stamps a per-run last-activity clock on every inbound mail frame it dispatches, and its own sweep tears an idle run down with the same state-preserving IDLE_HIBERNATE_UNDEPLOY_REASON flavor the hub used to drive, once the run has been idle past the new CHAT_IDLE_HIBERNATE_MS sidecar env threshold (arktype-parsed alongside the other sidecar timing knobs).
  • packages/agent-lifecycle is deleted. Chat's wake-on-mail path (wakeByAddressBounded in packages/chat/src/platform-adapter.ts) keeps its own small pendingWakes coalescing map inline, so the CL-7214 concurrent-wake protection is unchanged; the idle-sleep tracking half of the old package (track/untrack/recordActivity, the hub's chatIdleReapMs/HUB_CHAT_IDLE_REAP_MS knob, chatPlatform.recordActivity) is gone since nothing drives it from the hub anymore. Wake-on-mail relaunch behavior is otherwise unchanged.
  • Cut every caller: packages/chat, packages/agent-directory's one-shot prompt runner (its lifecycle hook was unused by any caller), apps/hub (config knob, wiring, comments), package.json deps, tsconfig references (regenerated via bun scripts/generate-tsconfig-references.ts), and the report-error baseline entry the deleted package owned.

Deleted tests

Per this hard-cutover ruling, the following were deleted rather than adapted, since they encoded the old hub-driven idle-sweep behavior that no longer exists in chat:

  • packages/chat/test/platform-adapter.test.ts: the describe("lifecycle wiring", ...) idle-sweep tests (busy-guard, idle-reap, idle-reap-then-relaunch regression pin, and the two "installs a sweep interval" tests), and the duplicate "...when lifecycle is configured" variant of the relaunch test (the "...is not configured" variant was kept and renamed, since that's the only remaining code path).
  • packages/agent-directory/src/one-shot-prompt.test.ts: the createFakeLifecycle fixture and its track/recordActivity/untrack assertions (the lifecycle hook was dead code — nothing ever passed it in production).

Test plan

  • bun run typecheck
  • bun run lint
  • bun run check:structural
  • bun --cwd apps/sidecar test
  • bun --cwd packages/agent-directory test
  • bun --cwd packages/chat test
  • bun --cwd apps/hub test

@linear-code

linear-code Bot commented Sep 17, 2026

Copy link
Copy Markdown

CL-8187

Idle hibernation is moving from a hub-driven `chatIdleReapMs` sweep to
the sidecar's own decision, and `@corbits/agent-lifecycle` is going
away. Strip the now-obsolete `chatIdleReapMs`/`HUB_CHAT_IDLE_REAP_MS`
fixtures and assertions, point the sidecar teardown-flavor suite at
the router's own `IDLE_HIBERNATE_UNDEPLOY_REASON` export, and add
`idleHibernateMs` to the sidecar config fixture.
…gent-lifecycle (CL-8187)

Stock Interchange has no undeploy route, so a reaper workflow can't
exist yet (tracked upstream separately). Idle hibernation moves into
the sidecar's own workflow-host wiring instead: it already sees every
inbound mail frame, so it now stamps a per-run last-activity clock
there and, past the threshold `CHAT_IDLE_HIBERNATE_MS` carries, tears
the run down itself with the same state-preserving
`IDLE_HIBERNATE_UNDEPLOY_REASON` flavor the hub used to drive.

`packages/agent-lifecycle` is deleted along with it: chat's wake-on-mail
path (`wakeByAddressBounded`) keeps its own small `pendingWakes`
coalescing map instead of borrowing the package's, so the CL-7214
concurrent-wake protection is unchanged; the idle-sleep tracking
(`track`/`untrack`/`recordActivity`, the hub's `chatIdleReapMs` knob,
and `chatPlatform.recordActivity`) is gone because nothing drives it
from the hub anymore.

Cuts every caller: `packages/chat`, `packages/agent-directory`'s
one-shot prompt runner (its unused `lifecycle` hook), `apps/hub`
(config knob, wiring, comments), package.json deps, tsconfig
references, and the report-error baseline entry the deleted package
owned.
@TheGreatAxios
TheGreatAxios force-pushed the cl-8187-drop-agent-lifecycle branch from 06a474f to eb2beb4 Compare September 17, 2026 18:43
@TheGreatAxios
TheGreatAxios merged commit de02a11 into main Sep 17, 2026
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