feat: add --clean flag to simulate for resetting output directories - #39
Conversation
Implementation PlanProblem AnalysisWhen a simulation is killed mid-flight (e.g. SLURM cancellation), stale checkpoints without matching trajectory files cause GROMACS to refuse
Deliverables
Acceptance Criteria
Files to Create or Modify
Implementation Details
Bug fix in # Current (line ~498):
if cpt_file.exists() and tpr_file.exists():
return {"status": "partial", "cpt_file": cpt_file, "restart": True}
# Fixed: trajectory stages without trajectory can't use -append
if cpt_file.exists() and tpr_file.exists():
if spec.traj_files:
# Stale checkpoint without trajectory — can't -append, start fresh
return {"status": "not_started", "cpt_file": None, "restart": False}
return {"status": "partial", "cpt_file": cpt_file, "restart": True}
Testing Approach
Risks and Open Questions
Plan created by mach6 |
Add clean_simulation_outputs() that removes stage outputs (tpr, cpt, log, edr, gro, xtc/trr, rescue MDPs, GROMACS backups, mdout.mdp) while preserving build inputs. Respects --stages filter and integrates with --dry-run for preview. Fix _detect_stage_state: trajectory stages (Production) with cpt+tpr but no trajectory file now return not_started instead of partial, preventing the stale-cpt-append crash where GROMACS refuses -append without a trajectory to append to.
Implementation CompleteAll deliverables from the plan are implemented in commit Changes
Tests (all passing)
162 orchestration tests pass. Lint clean. Progress update by mach6 |
6e0f932 to
63d88b1
Compare
Code ReviewImportantFinding 1 — When File: Finding 2 — Stale-cpt fix not applied to The fix in File: Finding 3 — A File: Finding 4 — Integration test for
File: SuggestionsFinding 5 — Dead The File: Finding 6 — TOCTOU in trajectory-output existence check (confidence: 82)
File: Finding 7 — Stale-cpt bugfix not regression-tested through The leaf function is tested, but no test exercises the full chain: Finding 8 — Verbose deduplication loop could be a comprehension (confidence: 90) The 6-line Finding 9 —
Finding 10 — Empty stages list edge case (confidence: 80)
Strengths
Agents run: code-reviewer, error-auditor, test-reviewer, completeness-checker, simplifier Reviewed by mach6 |
Review AssessmentClassifications
Action Plan
Assessment by mach6 |
Progress UpdateAddressed finding 4 from review: added integration tests for New tests:
164 orchestration tests pass. Lint clean. Commit: Progress tracked by mach6 |
Closes #38
Add
--cleanflag tomdfactory simulatethat removes simulation outputs before running, and fix stale-checkpoint detection for trajectory stages.Implementation plan posted as a comment below.