You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(codemode): durable Code Mode execution (suspend on shutdown, resume on boot) #66478
Core does not suspend Code Mode scripts on shutdown yet (CodeModeJob posts a lost-script notice on restart), and Extension.make only supports snapshot: { encode, decode }, not durable / idempotent.
In feat(core): agent(), llm() and structured JSON Schema output in Code Mode #66278, agent() already persists each child's schema/marker in SQLite session.metadata and reads validated structured_output results from message history (no process-local state), and restart.ts releases orphaned codemodeAgent children on boot so crashes do not burn tokens running unawaited children.
What's needed
Persist psychoscript VM snapshots for running CodeModeJobs on graceful shutdown and resume them in packages/core/src/session/execution/restart.ts.
Add Extension.durable / Extension.idempotent (with stable <runId>:<callId> keys) or route agent()/llm() through Tool.durable/Tool.idempotent:
agent(): durable — start creates and prompts the child session and returns { childSessionID }; wait resumes/awaits the child and reads its result from history; cancel interrupts the child on real cancel (never on suspend).
llm(): idempotent — safe to interrupt on suspend and re-run on resume.
Move per-script limits (started counts and the rate/quota circuit breaker) from the in-memory WeakMap into run.metadata so they survive suspend/resume.
Remove the temporary orphan-release bypass in restart.ts once scripts themselves resume on boot.
Thanks for writing this up. This is a feature request, not a bug report, so there was nothing to reproduce. The restart path in packages/core/src/session/execution/restart.ts reports background work it can't continue as lost, and that matches the current state you describe. In other words, today's behaviour is working as designed, and the durable suspend/resume work listed here is new functionality. I'm leaving this for the team to track as a feature.
Activity
opencodejr commentedon Nov 25, 2026
Thanks for writing this up. This is a feature request, not a bug report, so there was nothing to reproduce. The restart path in
packages/core/src/session/execution/restart.tsreports background work it can't continue as lost, and that matches the current state you describe. In other words, today's behaviour is working as designed, and the durable suspend/resume work listed here is new functionality. I'm leaving this for the team to track as a feature.