Skip to content

fix(run-tracker): retire a run on every keyed run-done verdict so set-visibility is not blocked - #406

Merged
danielhanold merged 7 commits into
mainfrom
fix/a-finished-run-left-active-in-run-json-blocks-set-visibility
Oct 8, 2026
Merged

danielhanold merged 7 commits into
mainfrom
fix/a-finished-run-left-active-in-run-json-blocks-set-visibility

Conversation

@danielhanold

@danielhanold danielhanold commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

↩ Change 0540 — A finished run left active in run.json blocks set-visibility and cannot be cancelled

Summary

A run that ended with a keyed run-done verdict other than run-complete (no-attributable-claim, run-unclaimed) left run.json at active. set-visibility then refused as if a run were live and named run cancel, which refuses unclaimed runs, so nothing but a hand edit could clear it.

  • Every keyed run-done verdict now retires its run through the existing successful-run closeout (run.json ends completed); report lines unchanged; a blocked closeout reports run-stop … completion-unaccounted and replays on a repeat verdict.
  • Halted/stop/retry/continue verdicts and observe mode unchanged; cancelling/cancelled/superseded runs are never relabelled.
  • The live-run scan picks its remedy with run cancel's own ownership predicate (runCancelOwner): cancel when it would accept, "once its dispatch has returned, run docket run verdict <key>" otherwise, by hand for a cancelling run with no claim.
  • FindRunByChange skips a completed run whose latest report line is not run-complete, so resume still works for a change whose earlier run ended run-unclaimed.
  • Decision recorded as ADR-0148 (extends ADR-0124 Rule 1).

Review (deep tier)

# Severity Finding Disposition
1 important run-unclaimed run retired to completed dead-ends a later run start --resume fixed — 354d0d6
2 important docket run verdict <key> remedy could end a still-live, not-yet-claimed dispatch fixed — 653708c (remedy qualified)
3 minor liveRunsUnder comment overstated what the verdict remedy guarantees fixed — 75102dd
4 minor Spec-required ADR not yet recorded fixed — ADR-0148 on the docket branch

Test plan

  • Full suite green at 75102dd (go run ./cmd/docket development test).
  • New integration tests for each run-done outcome, blocked-closeout replay, halted stays active, never-relabel, observe mode, remedy matrix, and resume after run-unclaimed; guards mutation-tested.

run-unclaimed and no-attributable-claim now drive the same ownership closeout as run-complete, so run.json leaves active instead of stranding the run for the live-run scan. runTrackerCompleteRun carries the outcome token so success lines are unchanged; its one direct test caller passes VerdictRunComplete.
…lete (review finding: run-unclaimed retirement dead-ends resume)

Retiring a run-unclaimed run to completed left run.json naming its change, so
a later run start --resume for that change found it and answered "nothing to
resume", which run cancel cannot clear. FindRunByChange now skips a completed
run whose run-tracker record's latest report line is not run-done ... run-complete;
such a run owns no worktree and holds no reservation, so the resume mints a
fresh run. A run-complete line, or an unreadable record, still refuses as before.
…spatch returns (review finding: verdict remedy can end a live unclaimed dispatch)

liveRunsUnder cannot tell a finished run that claimed nothing from a live
dispatch that has not claimed yet; running the keyed verdict on the live one
makes the record terminal and the child's claim is refused. The remedy now
reads "once its dispatch has returned, run `docket run verdict <key>`".
… every refused run (review finding: verdict remedy loops on a halted change)

For a run cancel refuses (authority-unavailable, claim-mismatch), the keyed
verdict retires the run only on a run-done outcome; a run-stop verdict leaves
run.json active. Soften liveRunsUnder's comment to promise only that.
@danielhanold
danielhanold merged commit ab42a50 into main Oct 8, 2026
7 checks passed
@danielhanold
danielhanold deleted the fix/a-finished-run-left-active-in-run-json-blocks-set-visibility branch October 8, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant