Spec-driven development with approval loops

Failure modes

Symptom Cause Fix Severity
ValueError: plan_path must be a non-empty string Empty string or None passed to read_spec / PipelineOrchestrator Resolve the path before passing it high
FileNotFoundError: Plan file not found The plan file does not exist at the given path Verify the path; use os.path.abspath to be sure high
PipelineResult.success is False One or more tasks failed to execute or failed a gate Iterate result.tasks; check each TaskResult.error, quality_gate_passed, tests_passed high
A task never appears in output The XML task block is malformed or absent Call read_spec directly and inspect the returned list medium
Execution resumes from the wrong task SpecState.completed / current is stale load_state to inspect, then clear_state to reset medium
get_pending_tasks returns [] unexpectedly SpecState.completed already holds all task IDs State is stale or the plan finished; clear_state to start fresh medium
Quality gate always passes skip_gates=True left in from development Remove the flag to re-enable gates medium
State comment vanished after editing the plan An editor/formatter/VCS step stripped HTML comments Ensure tooling preserves HTML comments in .md; confirm the comment is present after save_state medium

Risk areas

Diagnosis order

  1. Reproduce with a minimal read_spec(plan_path) call — if it raises, the problem is the path or the plan file.
  2. Inspect persisted state: load_state(plan_path); check completed, current, schema_version.
  3. Clear stale state and retry: clear_state(plan_path).
  4. Re-run with skip_gates=True to isolate gate failures from task logic. If success flips to True, the gate thresholds or scores are the cause — inspect gate_details.
  5. Iterate result.tasks and print each failing TaskResult (error, gate_score, gate_details, tests_passed).
  6. Run the related tests: pytest -k "spec" -v.