story-kit: start 88_story_auto_assign_agents_to_available_work_on_server_startup
This commit is contained in:
@@ -64,6 +64,10 @@ async fn main() -> Result<(), std::io::Error> {
|
||||
}
|
||||
}
|
||||
|
||||
// Capture project root and agents Arc before ctx is consumed by build_routes.
|
||||
let startup_root: Option<PathBuf> = app_state.project_root.lock().unwrap().clone();
|
||||
let startup_agents = Arc::clone(&agents);
|
||||
|
||||
let ctx = AppContext {
|
||||
state: app_state,
|
||||
store,
|
||||
@@ -73,6 +77,15 @@ 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/).
|
||||
if let Some(root) = startup_root {
|
||||
tokio::spawn(async move {
|
||||
eprintln!("[auto-assign] Server startup: scanning pipeline stages for unassigned work.");
|
||||
startup_agents.auto_assign_available_work(&root).await;
|
||||
});
|
||||
}
|
||||
let addr = format!("127.0.0.1:{port}");
|
||||
|
||||
println!(
|
||||
|
||||
Reference in New Issue
Block a user