pub fn clean(project_root: &Path) -> Result<Vec<String>, RecoverError>Expand description
Clean up stale or abandoned workflow state.
14-CR-01: only STALE phases are swept — a phase whose agent is still
running, or whose state is simply fresh, is kept (with a warning naming
the explicit --phase escape hatch), so cleaning one dead phase under
devflow parallel can never orphan a healthy sibling. Also removes an
unparsable legacy state.json (14-CR-04 — this reset is the one
sanctioned place), lock files whose holder is dead (the sweep lives in
crate::lock::remove_stale_locks, which refuses to delete a live
holder’s lock), and cron-instruction records for phases that no longer
have state — self-describing “auto-re-run this phase” records that must
not survive an operator-driven reset. Returns warnings for anything kept
or that could not be removed.