From 8d58e3999d18bfc0432321e832f7ffb2684422da Mon Sep 17 00:00:00 2001 From: Dave Date: Mon, 23 Feb 2026 20:04:46 +0000 Subject: [PATCH] story-kit: create 94_bug_stale_agent_state_persists_after_server_restart --- ...ent_state_persists_after_server_restart.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .story_kit/work/1_upcoming/94_bug_stale_agent_state_persists_after_server_restart.md diff --git a/.story_kit/work/1_upcoming/94_bug_stale_agent_state_persists_after_server_restart.md b/.story_kit/work/1_upcoming/94_bug_stale_agent_state_persists_after_server_restart.md new file mode 100644 index 0000000..6297714 --- /dev/null +++ b/.story_kit/work/1_upcoming/94_bug_stale_agent_state_persists_after_server_restart.md @@ -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