🎯 Goal
Allow interrupted runs to resume safely from their last valid state without restarting from scratch.
📍 Context
- Repo: autonomous-dev-loop
- Domain: Execution continuity
- Component:
scripts/auto_fix_pr.mjs, .github/workflows/code-generation.yml
🚀 Description
Run state is currently tracked implicitly via PR labels (auto-fix-attempt-N). This is a good foundation but has two gaps:
- If the label API call fails after the AI work is done, the checkpoint is not saved — the attempt counter is wrong on the next run and the work may be repeated.
code-generation.yml has no checkpoint mechanism at all — a runner cancellation restarts the full LLM generation from scratch.
The fix is a minimal explicit checkpoint written atomically before declaring each step complete.
🧩 Scope
In:
- Checkpoint format (JSON, written to
GITHUB_STEP_SUMMARY or a temp artifact):
{
"runId": "<github.run_id>",
"step": "ai-complete | label-applied | comment-posted",
"attempt": 2,
"inputHash": "<sha256 of issue number + commit SHA>",
"timestamp": "<ISO 8601>"
}
- Write checkpoint immediately after each irreversible step (AI call done, label applied, comment posted).
- On startup, load checkpoint if present; resume from
step only if inputHash matches current inputs.
- Invalidate (delete) checkpoint when
inputHash changes (new commit pushed, different issue).
- Apply to
auto_fix_pr.mjs first (highest risk of partial failure); code-generation.yml as Phase 2.
Out:
- Long-term persistence beyond the current run context (no external DB or cache).
- Cross-run shared state.
🧪 Acceptance criteria
⚙️ Constraints
- No additional infrastructure or runtime dependencies.
- Checkpoint file must be written atomically (write to
.tmp, then rename).
- Keep MVP-simple: 3 steps max (
ai-complete, label-applied, done).
🎯 Goal
Allow interrupted runs to resume safely from their last valid state without restarting from scratch.
📍 Context
scripts/auto_fix_pr.mjs,.github/workflows/code-generation.yml🚀 Description
Run state is currently tracked implicitly via PR labels (
auto-fix-attempt-N). This is a good foundation but has two gaps:code-generation.ymlhas no checkpoint mechanism at all — a runner cancellation restarts the full LLM generation from scratch.The fix is a minimal explicit checkpoint written atomically before declaring each step complete.
🧩 Scope
In:
GITHUB_STEP_SUMMARYor a temp artifact):{ "runId": "<github.run_id>", "step": "ai-complete | label-applied | comment-posted", "attempt": 2, "inputHash": "<sha256 of issue number + commit SHA>", "timestamp": "<ISO 8601>" }steponly ifinputHashmatches current inputs.inputHashchanges (new commit pushed, different issue).auto_fix_pr.mjsfirst (highest risk of partial failure);code-generation.ymlas Phase 2.Out:
🧪 Acceptance criteria
Functional
Edge cases
inputHashin checkpoint does not match current inputs, the checkpoint is ignored and the run starts fresh.stepvalue is treated as invalid and discarded (no crash).Tests
inputHashreturns the correctstep.inputHashreturnsnull(start fresh).null.⚙️ Constraints
.tmp, then rename).ai-complete,label-applied,done).