fix(runtime-host): allow archiving stopped agent graphs - #4996
Conversation
Classify durable Agent Graph state specifically for Session retirement so stopped and failed open graphs can be archived without changing their broader recovery semantics. Keep active, waiting, closing, and supervisor-wake activity fenced as busy. Generated-by: Codex
me2seeks
left a comment
There was a problem hiding this comment.
Automated review by OpenAI Codex, operated by me2seeks, at 25cf93ed4b1b11397cd18af5d1a6824589364485. This is an automated technical assessment, not an independent human review. Approval is submitted at the operator's explicit direction.
No blocking correctness findings. Traced the fresh durable graph read, complete-model status computation before visible-list truncation, and Session retirement family expansion to every graph operator across epochs. Retirement still holds family admission and checks each root/child Turn, Messages, Interactions, Goals, resources, effects and supervisor wakes. Stopped/failed graphs may retire without changing the broader open-graph recovery semantics. All 41 exact-source coordinator and retirement tests passed locally.
- Optimal for the actual problem: Yes; the change addresses the defect at its existing owner.
- Production code that can be deleted: Nonblocking P3: clear and quiescent_open are currently consumed identically by the only production retirement caller; the distinction adds no separate action today. The broad live-state API must remain because recovery and epoch selection have different obligations.
- Low-quality tests that can be deleted or replaced: None identified.
- Deeper refactor: No deeper refactor is needed.
- Ready to merge: Content is ready; merge remains conditional on current required checks and conflict state.
- Residual risks / verification: 41 tests passed against exact-source bundles after generating model metadata from the pinned repository inputs. No full Host protocol/GUI archive journey was run locally. Changes Session archive/removal eligibility; material lifecycle and user-visible changes require independent human review under CONTRIBUTING.md.
Summary
Allow Session retirement when its durable Agent Graph remains open but is quiescent in
stoppedorfailedstate.The Graph's general live-state semantics remain unchanged so stopped graphs can still be recovered or resumed. Retirement now uses a dedicated disposition:
An active Agent Graph supervisor wake continues to block retirement.
Fixes #4995
Verification
npm run buildnpm run lintnpm run format:checknpm run typechecknpx knip --workspace apps/desktopnpx knip --workspace packages/uinode --test packages/runtime/dist/__tests__/stream-graph-coordinator.test.js(14 passed)node --test packages/runtime-host/dist/__tests__/session-retirement-coordinator.test.js(27 passed)AI use
Select exactly one:
Tool(s) and scope: Codex diagnosed the failure, implemented the retirement-state classification and regression tests, and assisted with verification and PR preparation. The commit includes a
Generated-by: Codextrailer.Checklist
Does this PR entail a change in behavior?