Repository navigation
fix(taskrunner): resume a run only from its own spec's progress - #19002
iamwhatever merged 1 commit into
Conversation
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that [DESIGN-REVIEWED] a2d337d Description read[DESCRIPTION-READ] fc2b226d3f15d54cb70a78b0d63e13bf259ef5dab0fc3424084816eb2d034704 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The cause is still there: What this change shipsInventory (2 items) — 2 justifiedIntent: when two specs share a folder, a task run should never skip a step because another spec finished it. FIX.
[FIRST-PRINCIPLES-REVIEWED] a2d337d Description read[DESCRIPTION-READ] 21365c2d13238765af50535a887930a63f2905365beea52519d846ad37bdf807 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings that block the merge. FINDING — docs/system-specs/modules/taskrunner.md:1166 — the spec says [OPUS-REVIEWED] a2d337d |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
save_progress writes TASK_PROGRESS.md beside the spec, so every spec in one directory shares one progress file. load_checkpoint read it without the **Spec:** line that save_progress records, and the runner marks each task whose title matches the checkpoint as PASSED, so a second spec in the same folder skipped a step it never ran. load_checkpoint now returns no checkpoint for a progress file whose **Spec:** line names a different spec. A file with no **Spec:** line is read as before, and the old "Step N:" format still parses.
19c92de to
a2d337d
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
This PR makes load_checkpoint return no checkpoint when the shared TASK_PROGRESS.md names a different spec on its **Spec:** line. A second spec in the same folder then no longer skips steps as already done, which fixes the reader at the root. I checked the regex against save_progress on main: it writes exactly **Spec:** `<name>` using Path(run.spec_path).name, which is what the reader compares. I also tried to break it. Error lines are indented, so they cannot match the anchored pattern. A file with no Spec line keeps the old behaviour. A spurious mismatch can only return None, which means a step re-runs and is never skipped: the safe direction. The new test drives the real TaskRunner.run with two specs and would fail on base. The control tests keep same-spec resume and --fresh working. All AI lanes pass and checks are green. Advisory nit from the Opus lane: docs/system-specs/modules/taskrunner.md should say the checkpoint is keyed to the spec named on its **Spec:** line. — crew-pr-reviewer (deep re-check)
Problem / Motivation
Goal: A task run resumes only from progress its own spec wrote, so a second spec in the same folder never skips a step as done.
A task run resumes from
TASK_PROGRESS.md, whichsave_progress(src/kiro_crew/task_reporter.py) writes beside the spec file, so every spec in one directory shares one progress file.save_progressrecords which spec wrote the file on its**Spec:**line, butload_checkpointread the file without checking that line. The root cause: the runner (TaskRunner.run,taskrunner.py, right afterload_checkpoint(spec_path)) marks every task whose title matches a checkpoint entry as PASSED, so a second spec in the same folder inherited the first spec's completed steps. Its run then skipped a step it never ran, typically a shared first step such as "Explore the codebase".Why it matters
A skipped step is silent: the run reports it as passed, and every later step builds on work that was never done for this spec. Two specs side by side in a
specs/folder is the normal layout.Not a goal
TASK_PROGRESS.mdis still one file per folder, so a second spec's run still overwrites the first spec's progress, and the first spec then starts from the top instead of resuming. That is the safe direction: a step may run twice, but it is never skipped. Keying the file by spec name would remove the overwrite, but it changes the file users see, so it stays out of this PR.save_progresswrites.What changed (motivation → approach → change)
load_checkpointreads the**Spec:** \`line. When it names a different spec than the one being run, the function returnsNone` (no checkpoint), exactly as it does for a missing file. When it names this spec, parsing continues as before.A progress file with no
**Spec:**line is read as before. Every writer in this repository's history, from its first commit, writes the**Spec:**line. Butload_checkpointalso accepts an olderStep N:line format, which exists for files from an earlier writer that did not record the spec. Treating a file without the line as "no checkpoint" would make those older runs start over, so it keeps today's behaviour. That case cannot arise from a second spec written by this code, which always writes the line.The hot path is unchanged: a single regex test per line of a small file that is already being read.
Every reader of the progress file (reviewer check d)
load_checkpoint, called fromTaskRunner.run(taskrunner.py, before the checkpoint loop) and through the_load_checkpointwrapper. Both pass the spec being run, so both now get only that spec's progress, and a same-spec resume is unchanged.taskrunner.pyalso builds a path reference to the file for display; it does not parse it.Backwards compatibility
No file format change;
save_progressis untouched. A progress file written for this spec, a file with no**Spec:**line, and the oldStep N:format all behave as before. The only change: a file written for another spec no longer resumes this one.Tests
test/test_taskrunner_checkpoint_names_its_spec.py(new) drives the realTaskRunner.runtwice on a tmp_path home with the model calls faked (_decomposereturns a fixed plan,_execute_tasksrecords which tasks it was asked to run) andgit_coordfaked, so no git command runs. Its autouse_homefixture pinsKIROCREW_HOMEandKIROCREW_WORKSPACEthrough the isolation floor's own_floor_monkeypatch, so a test'smonkeypatch.undo()cannot lift the pins.Red on origin/main 843abe3 (the test file copied onto it, 3 of 3 serial runs): 2 failed, 3 passed each.
Green: 5 passed, 3 of 3 serial runs. Controls:
fresh=Truestill ignores the checkpoint and runs every step;**Spec:**line in the oldStep N:format still parses.Neighbours: the 30 test files that import
task_reporter, callload_checkpointor build aTaskRunner, the new file first, run serially: 1,384 passed.test/test_taskrunner.pyandtest/test_pod_self_contained.pywere left out because they resolve paths under the real home directory.mypy, flake8, isort, black,
scripts/check_black_formatting.py,scripts/check_comment_history.py(baseorigin/main) andscripts/docs-lint.shall pass.Manual verification
Not run against a live gateway.
Related Issues
None found for this behaviour. Two open PRs touch
task_reporter.py, neither near the checkpoint code: #11794 edits the notification helpers and merges cleanly with this change; #5274 editsbuild_status, and its one conflict exists againstorigin/mainalready, so this change adds none.Pattern harvest
Rule candidate: review-prompt
Pattern: a shared file whose writer records its owner (here the
**Spec:**line) but whose reader trusts the content without checking that field, so one owner's state is handed to another.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)