REPORT — phase5-exit-gate-review
STEP: phase5-exit-gate (Phase 5: claim the exit gate — the loop's exit is the gate)
REV: 21d891aaa6d572adcfcb24fd6f762b6b0485040a   FINAL: b6bc9f3a6de41df4ffed0ef6b10110ff0d3c5ceb
CHANGED: docs/research/phase5-exit-gate-review.md — this report alone. No code, no test, no other document: a reviewer
  fixes nothing, every guarantee of the brief was re-driven live at FINAL, and no guarantee was falsified. The review
  added one throwaway `git worktree` at FINAL to re-measure the docs gate at that commit and removed it afterwards.

VERIFIED: REVIEW ACCEPTANCE, run first — `scripts/check-scope 21d891aaa6d572adcfcb24fd6f762b6b0485040a b6bc9f3a6de41df4ffed0ef6b10110ff0d3c5ceb docs/research/phase5-exit-gate-brief.md` — exit 0, prints `claimed: docs/self-host.md`, `tripped: none`, `scope: ok (2 path(s) in 21d891aaa6d572adcfcb24fd6f762b6b0485040a..b6bc9f3a6de41df4ffed0ef6b10110ff0d3c5ceb)`. The tree was clean at dispatch (`git status --porcelain` empty, head `fc794f6`), and no session then head writes the commits under review (`git show b6bc9f3 --format=%b` and `git show a4d0dc84dc03f79ae66d11dc5adc9579072c6cc6 --format=%b` each carry `Actor: IMPLEMENTER`; `git show fc794f6 --format=%b` carries `Actor: PLANNER`).
VERIFIED: scripts/check-tests — `1069 passed in 422.37s (0:07:02)`, exit 0 (this review's standing battery and falsification ground; 1069 = 963 fast + 106 slow, the fixes-9 review's shape unchanged).
VERIFIED: scripts/check-tests --fast — `963 passed, 106 deselected in 69.13s (0:01:09)`, exit 0 (the report's figure re-measured: same counts, wall-clock drifts run to run).
VERIFIED: .venv/bin/python -m pytest tests/test_run_entry_kernel_id_refusal.py tests/test_run_entry_loader_envelope.py tests/test_phase5_run_entry_fixes_6_review.py — `7 passed in 4.94s`, exit 0 (2 kernel-id cases + 2 envelope cases + 3 absorbed probes).
VERIFIED: .venv/bin/python -m pytest tests/test_phase5_run_entry_fixes_5_review.py tests/test_phase5_run_entry_fixes_4_review.py tests/test_run_entry.py tests/test_phase5_run_entry_fixes_2_review.py — `54 passed in 21.47s`, exit 0 (the loader's whole committed battery; the held pins — `kernel_id load refusal`, `kernel_id fallback`, the `Loader-refusal envelope`, the `Read-refusal pin`, the F38/F39/F40 probes, and `test_protocol_violation_refusal_shape` — are all green at FINAL with no test edit).
VERIFIED: scripts/check-static — exit 0. The gated `ruff check --select BLE001,S110 src/orchestrator` prints "All checks passed!"; the advisory line prints `Found 104 errors.` (unchanged from the report's figure and from every figure it carries).
VERIFIED: scripts/check-docs — exit 0. This tree prints `376 Total (in 843ms) 174 Unique 376 OK 0 Errors`; a throwaway worktree at FINAL (`git worktree add --detach /tmp/kilo/final-wt b6bc9f3a6de41df4ffed0ef6b10110ff0d3c5ceb`, removed afterwards) prints `376 Total (in 200ms) 174 Unique 376 OK 0 Errors` — the report's figure re-measured at FINAL itself (same counts, only the duration string drifts), so it is the gate's own printed line and never the REV line the brief's CONTEXT quotes.
VERIFIED: question 1, the gate claim re-driven live at FINAL through the documented `python3 scripts/orchestrate.py` heads as subprocesses against real frozen repositories (each built by `git init`/`add`/`commit` with one derivable component, `src/app.py`), my hand runner `.venv/bin/python /tmp/kilo/redrive_exit_gate.py`, 41 checks — attacked-and-not-falsified on every guarantee the brief names, no class falsified: (a) accept — `start` exits 0, stdout JSON `accepted: true`, `outcome: ACCEPTANCE_CLAIMED`, stderr empty, no traceback, and the printed outcome equals a brand-new `EventStore` connection's `replay_fresh("RUN-ACCEPT").outcome` = `ACCEPTANCE_CLAIMED`; (b) failing-command refusal — exit 1, `accepted: false`, `outcome: INFEASIBLE`, no traceback, document == durable fresh outcome, and the documented `stop` head on the settled run exits 0 printing `{"outcome": "INFEASIBLE", "run_id": "RUN-FAILCMD"}` with the durable fresh outcome unchanged afterwards (`INFEASIBLE`, un-re-written); (c) wall-clock timeout (`limits.wall_clock_seconds: 1`, a `time.sleep(30)` command) — exit 1, `INFEASIBLE`, no traceback, document == durable fresh outcome; (d) mid-run cancel — the second process's documented `stop` head exits 0 with no traceback, the launcher exits 1 with `accepted: false`, `outcome: CANCELLED`, no traceback, and the document equals the durable fresh replay; `inspect` exits 0 with no traceback and parses to JSON carrying the same outcome in every externally drivable case.
VERIFIED: question 1, the validation-stage face (guarantee attacked-and-not-falsified with this reproducer). Against a real frozen repository, `python3 scripts/orchestrate.py start --spec bad.yaml --workdir ./wd --store ./bad.db` with a dict `project_kernel.kernel_id` (`{"a": 1}`) exits 1 with stdout 0 bytes, the store file ABSENT and the workdir NOT created — the refusal precedes any store open, because `scripts/orchestrate.py:69` calls `run_entry.load_run_spec` before `:73` constructs the `EventStore` (not merely zero events). The refusal's terminal form is a raw Python traceback — the uncaught `RunSpecError` leaving `main()` — whose last line is `orchestrator.run_entry.RunSpecError: project_kernel.kernel_id must be a non-empty string is invalid: {'a': 1}`, exactly the "terminal exception" the report records. The brief promises `no traceback` only of the four externally drivable classes (questions 1 and FOCUS both scope it there, and the status paragraph's own "no traceback" clause carries only those four), so nothing briefed is falsified; the shape itself is entered below.
VERIFIED: question 1, the carried `ProtocolViolation` class adjudicated honest (guarantee attacked-and-not-falsified). `test_protocol_violation_refusal_shape` (`tests/test_run_entry.py:609`) exists and is green in the 54-passed battery line above, and it is an executor-seam monkeypatch: `monkeypatch.setattr(run_entry, "build_command_executor", build_with_violation)` (`:627`) replaces the seam so the substituted executor's `dispatch` raises the violation. The "named not rebuilt" carry is honest: external re-drive needs an injection at the executor seam that no documented head exposes, so re-deriving it needs an `IN SCOPE` test edit the brief forbids ("Every committed test module ... read-only here"), and a reviewer fixes nothing. The committed pin carries the class and the status names it (`test_protocol_violation_refusal_shape`, "an executor-seam monkeypatch, named not rebuilt").
VERIFIED: question 2, F1's one-reading claim (guarantee attacked-and-not-falsified). `git show b6bc9f3a6de41df4ffed0ef6b10110ff0d3c5ceb:docs/self-host.md | grep -n "Status:"` names Phases 1–5 as `Status: **delivered**` and Phase 6 as `Status: partially done`, so a claimed exit gate reads "delivered" — the Phases 1/2/3 convention the finding cites. `git diff 21d891aaa6d572adcfcb24fd6f762b6b0485040a b6bc9f3a6de41df4ffed0ef6b10110ff0d3c5ceb -- docs/self-host.md` is one hunk inside the Phase 5 status paragraph: `Status: **in progress.**` becomes `Status: **delivered.**`, and `The exit gate is not yet claimed.` is replaced by the claim with its evidence; the Phase 5 goal, the exit-gate definition, Phase 6/7/8, and every other phase's status are byte-identical (`git show b6bc9f3a6de41df4ffed0ef6b10110ff0d3c5ceb --stat` changes `docs/self-host.md` alone, 13 insertions / 2 deletions). The competing readings were each attacked: leaving the marker "in progress" beside "The exit gate is claimed" contradicts the paragraph the GOAL says "records the claim"; any other word (say "claimed") leaves the file's marker vocabulary, which the ten-round "delivered" sentence and Phases 1–4 set; and splitting the flip into a second commit breaks the brief's single work commit whose sha is FINAL. Exactly one reading survives — the implementer's — so the step need not return to planning, and apart from that flip the edit claims only the gate (the ten-round delivery sentence and the disposal sentence stand byte-identical inside the rewritten lines).
VERIFIED: question 2, one imprecision about the status text, recorded rather than filed because it changes no actor's action, no count, and no close. The brief numbers "the five operator classes" two ways — CONTEXT's pin list makes `(e)` the injected `ProtocolViolation` and rides the validation-stage face separately as "the gate's input face", while the gate-claim bullet makes `(e)` the validation-stage face and rides `ProtocolViolation` on its pin. The status paragraph follows the bullet's five and joins ProtocolViolation with "and the injected-`ProtocolViolation` class rides on its committed pin ... (an executor-seam monkeypatch, named not rebuilt)", so its "five operator classes were re-driven live at FINAL through the documented heads" names the five faces my re-drive actually drove through the heads (the four settled-terminal classes plus the validation-stage face) with the sixth carried — and that is the only reading under which the sentence is true. Both numberings describe the same six faces with the same treatment, so nothing else turns on it.
VERIFIED: question 2, F1's `STATE: fixed` adjudicated against rule 5's close forms (guarantee attacked-and-not-falsified on the form it used). The available close is the one-reading close the implementer used — `fixed` with a `FIXED:` line reading `no regression test` and naming the reading taken — and not the closeout-only form. Ground: the F35 class (`docs/research/phase5-run-entry-fixes-5-implementer.md`), a one-reading ORIGIN: BRIEF finding whose `FIXED:` reads "no regression test — the reading taken is the one consistent with the brief's GOAL… No brief text correction is needed because no other reading keeps the GOAL's sentence true", adjudicated honest on record.md#observations' lesson "An `ORIGIN: BRIEF` finding's close form follows where the text lives" and reaffirmed for F43 by the fixes-9 review's answer 2. F1 has that shape exactly: the defective words sit in the OUT OF SCOPE parenthetical, subordinate to a GOAL that no other reading keeps true, so no later brief's text correction is owed. The `fixed: recorded in the review that filed it` alternative question 2 offers is the F41 class — a defect in an already-committed **report** (`docs/research/phase5-run-entry-fixes-7-review.md`, carried there and closed at that step's closeout) — while F1 is a defect in a committed brief, whose authoring lesson the form routes to record.md's Observations at closeout; record.md is out of this step's scope (OUT OF SCOPE forbids the edit) and out of this review's reach (a review writes its report and nothing else), so whether the closeout owes that line is the planner's write, not a defect this step leaves open.
VERIFIED: question 3, the untouched seam, verified rather than taken from the report's word. `git diff ca9a25a82aa562692ff4302275970fc52658c43c b6bc9f3a6de41df4ffed0ef6b10110ff0d3c5ceb -- src/orchestrator/run_entry.py` is empty — the seam is byte-identical to `ca9a25a` ("Refuse a present-but-wrong-typed kernel_id at load (FRK-1, R11)", the fixes-8 step's FINAL) — and `git diff 21d891aaa6d572adcfcb24fd6f762b6b0485040a b6bc9f3a6de41df4ffed0ef6b10110ff0d3c5ceb -- tests/` is empty, so no test module is edited. Every battery module is green at FINAL (the lines above).
VERIFIED: question 3, the report's forms and counts (J-class; guarantee attacked-and-not-falsified except where F2 names the one defect). `FINAL` names the work commit `b6bc9f3a6de41df4ffed0ef6b10110ff0d3c5ceb` ("Claim the Phase 5 exit gate"), never the report commit `a4d0dc84dc03f79ae66d11dc5adc9579072c6cc6`. `TRIPPED: none` matches check-scope's `tripped:` line. The embedded brief (review brief lines 19–165) diffs byte-exact against `git show b6bc9f3a6de41df4ffed0ef6b10110ff0d3c5ceb:docs/research/phase5-exit-gate-brief.md` (145 lines, exit 0). Every template field is present and filled, and nothing outside it is added: REPORT, STEP, REV+FINAL, CHANGED, VERIFIED, NOT VERIFIED, FINDINGS, SHAPES, TRIPPED, PROPOSED ROWS, METHOD FRICTION, INHERITED — no `DECISION` and no `CLOSEOUT`, which are the planner's appends. Every count figure above is this session's re-measured printed line.
VERIFIED: question 3, `SHAPES: none` read against rule 7 with the sameness claim checked against the file rather than trusted. `_run_cli` (`tests/test_run_entry.py:61`) runs `[_documented_interpreter(), str(_SCRIPT), *args]` with `_SCRIPT` resolving to `scripts/orchestrate.py` (`:33`) and `_documented_interpreter()` returning the `python3` on PATH (`:44`; it imports yaml here, and the fallback is named in the file), and `_make_repo` (`:81`) runs `git init -q`/`add -A`/`commit -q -m base` over one derivable component — so the subprocess re-drive IS the shape the suite's pins build (`test_settled_start_shape_relative_workdir`, `test_clean_env_cli_shape`, `test_cancelled_launcher_shape`, `test_cancel_race_class_shape`), not an unbuilt shape. The "document == durable fresh replay" check likewise is not unbuilt: the returned outcome is re-read from the durable log (`src/orchestrator/run_entry.py:535`, `:557`, `:620`), so the equality is the implementation's construction, and the cross-process form is pinned by `test_cancel_race_class_shape` (`tests/test_run_entry.py:1072`–`1081`, `inspected_document["outcome"] == fresh.outcome == "CANCELLED"`) with the outcome values pinned by `test_settle_claim_shape_*` (`:732`, `:776`, `:815`). One shape the re-drive probed is not built by the suite — the F2 evidence, listed below.
VERIFIED: `INHERITED: none` holds against the received set (rule 2; guarantee attacked-and-not-falsified). The brief received the fixes-9 review's clean block ("Nothing received is still open, and nothing new is open after this review" — FFR-4 closed by this step's brief, FRK-1 fixed at `ca9a25a`, FFR-1/2/3 closed by text, F41 closed at the fixes-7 closeout), so nothing came in open; F1 is filed `fixed`, not carried, so it adds nothing; the carry adjudicated in question 1 rides on a green committed pin and needs no future action; and my own F2 records rather than carries — nothing is open, and no residual row rides (`tripped: none`).
NOT VERIFIED: the implementer's own re-drive harness is not committed, so its `43 checks, 0 failures` tally cannot be re-run as a command; every guarantee it asserts was re-driven independently here (my 41 checks over the same six faces and the same guarantees, all holding). Nothing else is left unverified: no pre-image was taken from a report's account (`git show`, `git diff`, and `git worktree` supply all five pre-images), and no count is quoted from the brief's CONTEXT rather than re-measured.
FINDINGS:
  F2 | SEVERITY: P2 | ORIGIN: DOCUMENT | STATE: fixed
  The implementer report's SHAPES lead reads `none — every shape the re-drive probed has its pin in the committed battery`, but the one face the report newly drove — the validation-stage face through the documented `python3 scripts/orchestrate.py start` head — has no committed test: the file-backed drive it cites (`test_kernel_id_load_refusal`, `tests/test_run_entry_kernel_id_refusal.py:93`) calls `run_entry.load_run_spec` in-process, never the head, and the "fixes-8/9 reviews' runners" it adds are hand measurements, which rule 7 says are not tests. Nothing in the battery pins the property the report and `docs/self-host.md` record ("refuses at load with the store absent") — that the head loads the spec before it constructs the store (`scripts/orchestrate.py:69` before `:73`) — nor the face's terminal form; the only head-driven load-refusal pin asserts the opposite property for the freeze boundary (`test_fail_closed_load_shape_freeze_boundary_admits_zero_events`, `tests/test_run_entry.py:937`: store created, zero events). Swapping those two lines would leave the recorded guarantee silently broken with no pin firing.
  FIXED: no regression test — a defect in the already-committed report `a4d0dc84dc03f79ae66d11dc5adc9579072c6cc6`; a committed report is never modified and a reviewer fixes nothing, so its close is the one the form gives this class, `recorded in the review that filed it` (this review, question 3). The unbuilt shape it names is recorded below in SHAPES, never in INHERITED — nothing is open against the delivery, since every guarantee of the brief is verified live at FINAL — so whether to pin the head's load-before-store ordering and its terminal form is the next brief's decision.
SHAPES: probed by this review's hand runner `.venv/bin/python /tmp/kilo/redrive_exit_gate.py` (41 checks; every documented head driven as a subprocess against real frozen repositories); the committed suite builds most of what it drives (see VERIFIED question 3), and these it does not:
  - The validation-stage face through the documented `start` head: dict `project_kernel.kernel_id` → exit 1, stdout 0 bytes, store file and workdir absent, stderr a raw Python traceback ending `orchestrator.run_entry.RunSpecError: project_kernel.kernel_id must be a non-empty string is invalid: {'a': 1}`. No committed test drives the head for this class, so both its ordering property (load before `EventStore`) and its terminal form are unpinned — the F2 evidence.
  - The cross-process "printed document == fresh `replay_fresh` outcome" comparison for the ACCEPTANCE_CLAIMED and failing-command INFEASIBLE faces: the suite compares a head-driven document against a fresh connection only for CANCELLED (`tests/test_run_entry.py:1072`–`1081`) and compares `result.outcome` to `replay_fresh` only in the in-process settle-claim pins (`:732`, `:776`, `:815`), while this re-drive compared all four heads' JSON against a brand-new connection and re-read the durable outcome after `stop`.
  - Head-driven `stop` over a settled INFEASIBLE run with the outcome un-re-written: `test_clean_env_cli_shape` (`tests/test_run_entry.py:842`) drives the head's `stop` only over an accepted run, and `test_stop_never_rewrites_a_settled_outcome` (`:378`) calls `run_entry.stop_run` in-process.
  - The (e) face's traceback form in either direction: with no pin asserting the head's stderr for a load refusal, neither today's traceback nor a clean named refusal would break a test. No `test_bug_*` pin is needed for these (nothing here is an open code defect), and none is registered.
TRIPPED: none
PROPOSED ROWS: none
METHOD FRICTION: none — no deviation from the brief, the report form, or the battery discipline; the documented head ran literally (`python3 scripts/orchestrate.py …`, whose `python3` imports yaml here, so no substitution is recorded), every count above is a re-measured printed line, and no new test file was created because nothing needed proving beyond what the shapes below record.
INHERITED:
nothing came in and nothing is open after this review. The received set is the fixes-9 review's clean block (FFR-4 closed by this step's brief text, FRK-1 fixed at `ca9a25a`, FFR-1/FFR-2/FFR-3 closed by the fixes-8 brief's text, F41 closed at the fixes-7 closeout) and nothing was carried in it; F1 is filed `fixed` by the implementer and its close form is adjudicated above, so it rides nowhere; the `ProtocolViolation` carry adjudicated in question 1 rides on a green committed pin and owes no future action; and this review's F2 is a defect in an already-committed report, which the form closes as `recorded in the review that filed it` rather than carrying. No residual row rides (rule 3: `tripped: none`).

CLOSEOUT
DECLINED: none
DIVERGENCES CLOSED: none
