You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{ label: "Resume", description: "Resume from checkpoint — skip completed steps (${COMPLETED_STEPS}), jump to ${RESUME_STAGE}" },
121
+
{ label: "Fresh", description: "Discard checkpoint and re-run pipeline from scratch" },
122
+
{ label: "Skip", description: "Skip this issue entirely" }
123
+
]
124
+
)
125
+
```
126
+
127
+
Handle user choice:
128
+
129
+
| Choice | Action |
130
+
|--------|--------|
131
+
|**Resume**| Load checkpoint context. Set `pipeline_stage` in state to `${RESUME_STAGE}`. Log: "MGW: Resuming #${ISSUE_NUMBER} from checkpoint (step: ${CHECKPOINT_STEP}, action: ${RESUME_ACTION})." Skip triage/worktree stages that already completed and jump directly to the resume stage in the pipeline. The `resume.context` object carries step-specific data (e.g., `quick_dir`, `plan_num`, `phase_number`) needed by the target stage. |
132
+
|**Fresh**| Clear checkpoint via `clearCheckpoint()`. Reset `pipeline_stage` to `"triaged"`. Log: "MGW: Checkpoint cleared for #${ISSUE_NUMBER}. Starting fresh." Continue with normal pipeline flow. |
133
+
|**Skip**| Log: "MGW: Skipping #${ISSUE_NUMBER} per user request." STOP pipeline. |
134
+
135
+
```bash
136
+
case"$USER_CHOICE"in
137
+
Resume)
138
+
# Load resume context and jump to the appropriate stage
Copy file name to clipboardExpand all lines: commands/workflows/state.md
+86Lines changed: 86 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -647,6 +647,91 @@ GSD phase directory (`.planning/phases/{NN}-{slug}/`) to operate in.
647
647
Issues created outside of `/mgw:project` (e.g., manually filed bugs) will not have
648
648
a `phase_number`. In this case, `/mgw:run` falls back to the quick pipeline.
649
649
650
+
## Checkpoint Resume Detection
651
+
652
+
When `mgw:run` starts for an issue, the validate_and_load step checks whether a prior
653
+
pipeline run left a checkpoint with progress beyond the initial triage step. This enables
654
+
resuming interrupted sessions without re-doing completed work.
655
+
656
+
### Resume Detection Functions (lib/state.cjs)
657
+
658
+
| Function | Signature | Returns | Description |
659
+
|----------|-----------|---------|-------------|
660
+
|`detectCheckpoint`|`(issueNumber)`|`object\|null`| Checks if active state file has a non-null checkpoint with `pipeline_step` beyond `"triage"`. Returns the checkpoint data if resumable, `null` otherwise. |
661
+
|`resumeFromCheckpoint`|`(issueNumber)`|`object\|null`| Returns checkpoint data plus computed `resumeStage`, `resumeAction`, and `completedSteps`. Maps `resume.action` to the pipeline stage to jump to. |
662
+
|`clearCheckpoint`|`(issueNumber)`|`{ cleared: boolean }`| Resets the checkpoint field to `null` in the active state file. Used for "Fresh start" option. |
663
+
664
+
### Resume Action to Stage Mapping
665
+
666
+
The `resume.action` field in the checkpoint tells `resumeFromCheckpoint()` which pipeline
667
+
stage to jump to:
668
+
669
+
| resume.action | resumeStage | Meaning |
670
+
|---------------|-------------|---------|
671
+
|`run-plan-checker`|`planning`| Plan exists, needs quality check |
672
+
|`spawn-executor`|`executing`| Plan complete, execute next |
0 commit comments