huskies: merge 1016
This commit is contained in:
@@ -199,8 +199,16 @@ pub(crate) fn spawn_gateway_relay(startup_root: &Option<PathBuf>, status: Arc<St
|
||||
}
|
||||
}
|
||||
|
||||
/// Spawn the startup reconciliation task: reconcile any stories whose agent
|
||||
/// work was committed while the server was offline, then auto-assign free agents.
|
||||
/// Spawn the startup reconstruction task: replay the current pipeline state
|
||||
/// through the [`TransitionFired`][crate::pipeline_state::TransitionFired]
|
||||
/// broadcast channel so that all existing subscribers (worktree lifecycle,
|
||||
/// merge-failure auto-spawn, auto-assign) react identically to a live
|
||||
/// transition, then trigger a full auto-assign pass.
|
||||
///
|
||||
/// Replaces the legacy scan-based `reconcile_on_startup` approach. The CRDT
|
||||
/// is the durable source of truth; replaying it as synthetic self-transitions
|
||||
/// is cheaper, simpler, and idempotent: a second replay produces another burst
|
||||
/// of events that subscribers safely ignore for already-assigned stories.
|
||||
pub(crate) fn spawn_startup_reconciliation(
|
||||
startup_root: Option<PathBuf>,
|
||||
startup_agents: Arc<AgentPool>,
|
||||
@@ -211,12 +219,17 @@ pub(crate) fn spawn_startup_reconciliation(
|
||||
// Purge content-store entries for stories that reached terminal
|
||||
// stages in a previous session (before the GC subscriber was active).
|
||||
crate::db::gc::sweep_zombie_content_on_startup();
|
||||
crate::slog!("[startup] Reconciling completed worktrees from previous session.");
|
||||
startup_agents
|
||||
.reconcile_on_startup(&root, &startup_reconciliation_tx)
|
||||
.await;
|
||||
crate::slog!(
|
||||
"[startup] Replaying current pipeline state through TransitionFired channel."
|
||||
);
|
||||
crate::pipeline_state::replay_current_pipeline_state();
|
||||
crate::slog!("[auto-assign] Scanning pipeline stages for unassigned work.");
|
||||
startup_agents.auto_assign_available_work(&root).await;
|
||||
let _ = startup_reconciliation_tx.send(ReconciliationEvent {
|
||||
story_id: String::new(),
|
||||
status: "done".to_string(),
|
||||
message: "Startup event replay complete.".to_string(),
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user