Skip to content

feat(run): add resume detection and auto-resume to mgw:run startup#246

Merged
snipcodeit merged 4 commits intomainfrom
issue/237-add-resume-detection-and-auto-resume-to
Mar 6, 2026
Merged

feat(run): add resume detection and auto-resume to mgw:run startup#246
snipcodeit merged 4 commits intomainfrom
issue/237-add-resume-detection-and-auto-resume-to

Conversation

@snipcodeit
Copy link
Owner

Summary

  • Add checkpoint detection (detectCheckpoint, resumeFromCheckpoint, clearCheckpoint) to lib/state.cjs for pipeline resume at startup
  • Integrate checkpoint detection into commands/run/triage.md validate_and_load step with Resume/Fresh/Skip user prompts
  • Document the resume detection flow, action-to-stage mapping, and context shapes in commands/workflows/state.md

Closes #237

Milestone Context

  • Milestone: v8 — Agent Reliability & Failure Recovery
  • Phase: 46 — Checkpoint & Resume for Long-Running Pipelines
  • Issue: 9 of 9 in milestone (final!)

Changes

lib/state.cjs

  • CHECKPOINT_STEP_ORDER constant — ordered pipeline step progression
  • detectCheckpoint(issueNumber) — checks if checkpoint has progressed beyond triage
  • resumeFromCheckpoint(issueNumber) — returns checkpoint data with computed resume stage/action mapping
  • clearCheckpoint(issueNumber) — resets checkpoint to null for fresh-start

commands/run/triage.md

  • Checkpoint detection block after migrateProjectState() call
  • Displays checkpoint state table (step, artifacts, timestamps) to user
  • AskUserQuestion with Resume/Fresh/Skip options
  • Resume: sets RESUME_MODE flag and loads checkpoint context
  • Fresh: clears checkpoint, resets to triaged
  • Skip: exits pipeline

commands/workflows/state.md

  • Resume detection functions reference table
  • Resume action to pipeline stage mapping
  • Flow diagram for checkpoint detection
  • Context shapes per resume action type
  • Updated consumers table

Test Plan

Dependencies

Stephen Miller and others added 3 commits March 6, 2026 02:00
Add detectCheckpoint(), resumeFromCheckpoint(), and clearCheckpoint()
to lib/state.cjs for pipeline resume detection at mgw:run startup.

- detectCheckpoint(issueNumber): checks if active state file has a
  checkpoint with pipeline_step beyond "triage", returns checkpoint
  data if resumable
- resumeFromCheckpoint(issueNumber): returns checkpoint data plus
  computed resumeStage based on resume.action mapping
- clearCheckpoint(issueNumber): resets checkpoint to null for
  fresh-start scenarios

Closes #237 (partial)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add checkpoint detection logic to the validate_and_load step in
commands/run/triage.md. When a prior pipeline run left a checkpoint
with progress beyond triage, the pipeline now:

1. Detects the checkpoint via detectCheckpoint()
2. Displays checkpoint state (step, completed work, artifacts)
3. Offers Resume/Fresh/Skip options via AskUserQuestion
4. Resume: loads checkpoint context and jumps to appropriate stage
5. Fresh: clears checkpoint via clearCheckpoint() and starts over
6. Skip: exits pipeline for this issue

This enables recovery from interrupted sessions, context switches,
and multi-session pipeline execution without losing prior work.

Closes #237 (partial)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive documentation for the checkpoint resume system:
- Resume detection functions (detectCheckpoint, resumeFromCheckpoint,
  clearCheckpoint) with signatures and return types
- Resume action to pipeline stage mapping table
- Resume detection flow diagram
- Pipeline step order constant documentation
- Resume context shapes per action type
- Updated consumers table with checkpoint resume entry

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added slash-commands Changes to slash command files core Changes to core library labels Mar 6, 2026
…me-to

Combine checkpoint writes (initCheckpoint, atomicWriteJson, updateCheckpoint)
with checkpoint detection/resume (detectCheckpoint, resumeFromCheckpoint,
clearCheckpoint). Both sides are complementary Phase 46 features.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@snipcodeit snipcodeit merged commit 57f13af into main Mar 6, 2026
@snipcodeit snipcodeit deleted the issue/237-add-resume-detection-and-auto-resume-to branch March 6, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Changes to core library slash-commands Changes to slash command files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add resume detection and auto-resume to mgw:run startup

1 participant