story-kit: accept 94_bug_stale_agent_state_persists_after_server_restart

This commit is contained in:
Dave
2026-02-23 20:38:37 +00:00
parent cd902ff219
commit 64e76f4bb9

View File

@@ -0,0 +1,27 @@
---
name: "Stale agent state persists after server restart"
---
# Bug 94: Stale agent state persists after server restart
## Description
The agent pool is in-memory. When the server restarts, agent processes are gone but their records linger as pending entries that never get cleaned up. The frontend shows stale agent assignments (e.g. coder-1 still assigned to a story that finished long ago). Pipeline advancement also fails because the server was not running when the agent exited, so stories get stuck in 2_current instead of advancing to 3_qa.
## How to Reproduce
1. Start the server and launch a coder on a story\n2. Let the coder complete its work and commit\n3. Restart the server\n4. Observe the web UI — the story still shows the coder assigned, pipeline stage did not advance
## Actual Result
Stale agent assignments persist in the UI. Stories get stuck in their current pipeline stage because the server missed the agent process exit event.
## Expected Result
On startup, the server should either (a) clear all agent records since the processes are gone, or (b) reconcile state by checking which worktrees have committed work and running gates/advancing the pipeline accordingly.
## Acceptance Criteria
- [ ] On server startup, stale agent records from a previous session are cleared
- [ ] Stories with completed work in their worktree are detected and advanced through the pipeline on startup
- [ ] No phantom agent lozenges appear in the UI after a server restart