Skip to content

fix(taskrunner): resume a run only from its own spec's progress - #19002

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
javenciu:fix/taskrun-checkpoint-ignores-another-specs-progress
Oct 11, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
javenciu:fix/taskrun-checkpoint-ignores-another-specs-progress

Conversation

@javenciu

@javenciu javenciu commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

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, which save_progress (src/kiro_crew/task_reporter.py) writes beside the spec file, so every spec in one directory shares one progress file. save_progress records which spec wrote the file on its **Spec:** line, but load_checkpoint read the file without checking that line. The root cause: the runner (TaskRunner.run, taskrunner.py, right after load_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

  • One progress file per spec. TASK_PROGRESS.md is 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.
  • Changing what save_progress writes.

What changed (motivation → approach → change)

  • Motivation: a run must only ever resume from its own spec's progress.
  • Approach: fix the reader only, using the line the writer already records.
  • Change: load_checkpoint reads 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. But load_checkpoint also accepts an older Step 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 from TaskRunner.run (taskrunner.py, before the checkpoint loop) and through the _load_checkpoint wrapper. Both pass the spec being run, so both now get only that spec's progress, and a same-spec resume is unchanged.
  • taskrunner.py also builds a path reference to the file for display; it does not parse it.
  • No other module reads the file (repository-wide search).

Backwards compatibility

No file format change; save_progress is untouched. A progress file written for this spec, a file with no **Spec:** line, and the old Step 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 real TaskRunner.run twice on a tmp_path home with the model calls faked (_decompose returns a fixed plan, _execute_tasks records which tasks it was asked to run) and git_coord faked, so no git command runs. Its autouse _home fixture pins KIROCREW_HOME and KIROCREW_WORKSPACE through the isolation floor's own _floor_monkeypatch, so a test's monkeypatch.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.

    E       AssertionError: feature-b's first step was skipped as done from feature-a's progress file: ran ['Add the billing migration']
    FAILED test/test_taskrunner_checkpoint_names_its_spec.py::test_a_second_spec_in_the_same_folder_runs_every_step
    E       AssertionError: assert {'explore'} is None
    FAILED test/test_taskrunner_checkpoint_names_its_spec.py::test_a_progress_file_naming_another_spec_is_no_checkpoint
    
  • Green: 5 passed, 3 of 3 serial runs. Controls:

    • the same spec still resumes from its own progress (the second run executes nothing);
    • fresh=True still ignores the checkpoint and runs every step;
    • a file with no **Spec:** line in the old Step N: format still parses.
  • Neighbours: the 30 test files that import task_reporter, call load_checkpoint or build a TaskRunner, the new file first, run serially: 1,384 passed. test/test_taskrunner.py and test/test_pod_self_contained.py were 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 (base origin/main) and scripts/docs-lint.sh all 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 edits build_status, and its one conflict exists against origin/main already, 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@javenciu
javenciu requested review from a team and KiroCrewCaptain as code owners October 11, 2026 01:15
@javenciu
javenciu requested a review from buluoray October 11, 2026 01:15
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Oct 11, 2026
@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ⏭️ skipped

Revision a2d337d436d9b0ff1d33949ddd92eb4f99b1ce2e touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of a2d337d436d9b0ff1d33949ddd92eb4f99b1ce2e via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check that docs/system-specs/modules/taskrunner.md (~L1164–1167), which describes when load_checkpoint returns no checkpoint, is updated in this commit for the new spec-mismatch case.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of a2d337d436d9b0ff1d33949ddd92eb4f99b1ce2e via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

The cause is still there: TASK_PROGRESS.md is one file per folder. This fixes the reader, and the Not-a-goal section declares the overwrite as deferred.

What this change ships

Inventory (2 items) — 2 justified

Intent: when two specs share a folder, a task run should never skip a step because another spec finished it. FIX.

  1. A run of a second spec in the same folder no longer treats steps finished by the other spec's progress file as done. It starts from the top instead — justified
  2. A regression test drives the real TaskRunner.run on two specs in one folder and fails on base — justified

[FIRST-PRINCIPLES-REVIEWED] a2d337d

Description read

[DESCRIPTION-READ] 21365c2d13238765af50535a887930a63f2905365beea52519d846ad37bdf807

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed a2d337d436d9b0ff1d33949ddd92eb4f99b1ce2e via the fork AI-review pipeline; updated in place on each push.

Review details

No findings that block the merge.

FINDING — docs/system-specs/modules/taskrunner.md:1166 — the spec says load_checkpoint "returns no checkpoint when it cannot read one and otherwise recognizes completed task titles", but the new if spec_match.group(1) != spec_path.name: return None branch also returns no checkpoint when the progress file names a different spec. The owning spec now misstates the resume contract, and AGENTS.md requires the spec to be updated in the same commit. → Fix: in the same paragraph, say that the checkpoint is keyed to the spec named on its **Spec:** line, that a file naming another spec gives no checkpoint, and that a file with no **Spec:** line is parsed as before.

[OPUS-REVIEWED] a2d337d

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed a2d337d436d9b0ff1d33949ddd92eb4f99b1ce2e via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] a2d337d

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.
@javenciu
javenciu force-pushed the fix/taskrun-checkpoint-ignores-another-specs-progress branch from 19c92de to a2d337d Compare October 11, 2026 11:03
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 11, 2026

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@iamwhatever
iamwhatever enabled auto-merge (squash) October 11, 2026 17:35
@iamwhatever
iamwhatever merged commit 24cb15c into kirodotdev:main Oct 11, 2026
107 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants