Skip to content

spec(queen): finalize.t27 -- a cancelled or failed run keeps its observations, its first error and what it still owes (Closes #10424) - #10426

Merged
gHashTag merged 1 commit into
masterfrom
claude/queen-finalize
Oct 18, 2026
Merged

gHashTag merged 1 commit into
masterfrom
claude/queen-finalize

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

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:

  1. Observations survive. observations_kept() and entry_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.
  2. The first end and the exact reason survive. 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), which dispatch_exit.t27 folds into DX_SHUTDOWN.
  3. A failed cleanup keeps its owner. entry_after_check() keeps a resource pending until a read says it is gone. reap_action() releases a worktree only on worktree_keep.t27 reap_verdict proof. Repeated failures flag an entry; they never drop it. This list is what ai.t27.runner-reap should read. On 2026-10-06 the volumes filled with finished worktrees (80 + 98 removed by hand) because nothing listed them as owed.
  4. Shutdown waits for probes. shutdown_step() adds in-flight readiness probes on top of drain.t27 exit_step(), bounded by PROBE_GRACE_MS = 3000. A pinned invariant keeps the grace plus the 2 s server close inside EXIT_SECONDS. A cut probe answers unknown.
  5. Unknown stays 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) and drain (exit_step). The claw conclusions are restated and pinned instead of imported, because claw/t27f_gate.t27 pulls in two modules that both declare KINDS.

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 -> IMPLEMENTED
  • t27c test-report specs/queen/finalize.t27 -> 26 tests, 26 pass, 0 FAIL, 0 vacuous, 6 invariants
  • t27c seal --save then --verify -> all hashes MATCH (.trinity/seals/queen_QueenFinalize.json)

Not run: tri mutate spec, because the tri binary is not built on the lab.

🤖 Generated with Claude Code

…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>
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-18 11:41:11 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 49
PRs with All Checks Green 1
READY 0
FAILING 49
PENDING 0
NO CHECKS YET 0

These columns do not partition: 0 + 49 + 0 + 0 = 49, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=fad12492937a != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

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.

queen: finalize.t27 -- a cancelled or failed run keeps its observations, its first error and what it still owes

1 participant