Repository navigation
spec(queen): finalize.t27 -- a cancelled or failed run keeps its observations, its first error and what it still owes (Closes #10424) - #10426
Merged
Conversation
…rvations, its first error and what it still owes (Closes #10424) Five rules, each a test block: completed observations survive every outcome; the first failure and the exact cancel reason survive, and a cleanup error is never primary; a failed release stays in a pending-cleanup list with its owner until a read confirms it is gone; shutdown waits for in-flight readiness probes; an unknown status stays unknown. Reuses worktree_keep, control, dispatch, dispatch_exit, turn_stop and drain. Idea from REA (morluto/rea 6.6/6.7, MIT), no code. Railway lab: spec-status IMPLEMENTED, test-report 26/26, 0 FAIL, 0 vacuous, 6 invariants; seal verify all MATCH. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10424
What
specs/queen/finalize.t27(module QueenFinalize) is the law for how a Queen bee run, or a claw check run, ends. It has five rules, and each one has its own test blocks:observations_kept()andentry_after_finalize()keep every completed observation for every outcome. A done journal entry is never erased and an intent is never promoted.report_kind()reports a stopped run that did work as partial, never empty.takes_primary()keeps the first failure or cancel, and a cleanup error never becomes primary.cancel_reason_after()keeps the first named cancel reason (operator, drain, turn limit, fenced, issue closed, unstated), whichdispatch_exit.t27folds intoDX_SHUTDOWN.entry_after_check()keeps a resource pending until a read says it is gone.reap_action()releases a worktree only onworktree_keep.t27reap_verdictproof. Repeated failures flag an entry; they never drop it. This list is whatai.t27.runner-reapshould read. On 2026-10-06 the volumes filled with finished worktrees (80 + 98 removed by hand) because nothing listed them as owed.shutdown_step()adds in-flight readiness probes on top ofdrain.t27exit_step(), bounded byPROBE_GRACE_MS= 3000. A pinned invariant keeps the grace plus the 2 s server close insideEXIT_SECONDS. A cut probe answers unknown.final_status()never coerces unknown to unavailable.status_action()probes an unknown status again.check_conclusion()posts neutral, not failure, for a cancelled or unknown claw check.Reused by import:
worktree_keep,control(effects journal),dispatch(verdicts),dispatch_exit(exit reasons),turn_stop(step_on_abort, grace) anddrain(exit_step). The claw conclusions are restated and pinned instead of imported, becauseclaw/t27f_gate.t27pulls in two modules that both declareKINDS.The idea comes from REA (morluto/rea, rea-agents 6.6/6.7, MIT). No code was taken. The runtime wiring (gHashTag/trios) and the reaper are not in this PR.
Verified (Railway lab, not the Mac)
t27c spec-status specs/queen/finalize.t27-> IMPLEMENTEDt27c test-report specs/queen/finalize.t27-> 26 tests, 26 pass, 0 FAIL, 0 vacuous, 6 invariantst27c seal --savethen--verify-> all hashes MATCH (.trinity/seals/queen_QueenFinalize.json)Not run:
tri mutate spec, because thetribinary is not built on the lab.🤖 Generated with Claude Code