story-kit: merge 94_bug_stale_agent_state_persists_after_server_restart

This commit is contained in:
Dave
2026-02-23 20:38:17 +00:00
parent 39dbace8bf
commit cd902ff219
2 changed files with 451 additions and 3 deletions

View File

@@ -78,11 +78,19 @@ async fn main() -> Result<(), std::io::Error> {
let app = build_routes(ctx);
// On startup, auto-assign free agents to any work already queued in the
// active pipeline stages (2_current/, 3_qa/, 4_merge/).
// On startup:
// 1. Reconcile any stories whose agent work was committed while the server was
// offline (worktree has commits ahead of master but pipeline didn't advance).
// 2. Auto-assign free agents to remaining unassigned work in the pipeline.
if let Some(root) = startup_root {
tokio::spawn(async move {
eprintln!("[auto-assign] Server startup: scanning pipeline stages for unassigned work.");
eprintln!(
"[startup] Reconciling completed worktrees from previous session."
);
startup_agents.reconcile_on_startup(&root).await;
eprintln!(
"[auto-assign] Scanning pipeline stages for unassigned work."
);
startup_agents.auto_assign_available_work(&root).await;
});
}