diff --git a/server/src/agents/pool/auto_assign/scan.rs b/server/src/agents/pool/auto_assign/scan.rs index 6f9be845..8390ed15 100644 --- a/server/src/agents/pool/auto_assign/scan.rs +++ b/server/src/agents/pool/auto_assign/scan.rs @@ -18,43 +18,17 @@ pub(in crate::agents::pool) fn is_agent_free( }) } -pub(super) fn scan_stage_items(project_root: &Path, stage_dir: &str) -> Vec { +pub(super) fn scan_stage_items(_project_root: &Path, stage_dir: &str) -> Vec { use std::collections::BTreeSet; let mut items = BTreeSet::new(); - // Include CRDT items via the typed projection — the primary source of truth. + // CRDT is the only source of truth — no filesystem fallback. for item in crate::pipeline_state::read_all_typed() { if item.stage.dir_name() == stage_dir { items.insert(item.story_id.0.clone()); } } - // Also include filesystem items (backwards compat / migration fallback). - // Skip any story the CRDT already tracks — its authoritative stage wins. - // Stale .md files in pipeline dirs (e.g. 1_backlog/) must not shadow an - // archived or otherwise-moved story in the CRDT. - let dir = project_root.join(".huskies").join("work").join(stage_dir); - if dir.is_dir() - && let Ok(entries) = std::fs::read_dir(&dir) - { - for entry in entries.flatten() { - let path = entry.path(); - if path.extension().and_then(|e| e.to_str()) == Some("md") - && let Some(stem) = path.file_stem().and_then(|s| s.to_str()) - { - // If the CRDT knows about this story (any stage), trust the CRDT. - if crate::pipeline_state::read_typed(stem) - .ok() - .flatten() - .is_some() - { - continue; - } - items.insert(stem.to_string()); - } - } - } - items.into_iter().collect() }