<!-- normative -->

# Phase 5 run-entry fixes 3 — review (step 3 of phase 5)

<!-- SET-UP -->

The work under review is one commit, `01014226` (trailer `Actor: IMPLEMENTER`): it adds
the guard to `Controller.mark_infeasible`, the rewritten Commands narration in
`docs/run-entry.md`, and the two reshaped pins absorbed into
`tests/test_phase5_run_entry_fixes_2_review.py`. The commit chain is `01014226` ← `9304484`
(the step's brief commit) ← `6ad0989` — so `REV` is `6ad0989`, the fixes-2 closeout
commit, and it is `01014226`'s grandparent: `REV` is the brief's own stated red base and
is not `FINAL`'s direct parent, exactly as the brief required it to be read. The
implementer report commit is `73a90d1` (trailer `Actor: IMPLEMENTER`); it is not named as
`FINAL` anywhere in the report.

REVIEW ACCEPTANCE ran before anything else: `scripts/check-scope 6ad098906d6e1…
010142264aeaadbfdee24b61131a15956e6ffc94 docs/research/phase5-run-entry-fixes-3-brief.md`
→ `tripped: PILOT-R1 PILOT-R10`, `scope: ok`, exit 0. Every replay of the red evidence
below uses the brief's own stated red base (`REV` = `6ad0989`), never the work commit's
parent.

Commit trailers were verified (`git log --format='%h %an %s' -6`): both `01014226` and
`73a90d1` carry `Actor: IMPLEMENTER`; the working tree contains nothing uncommitted; nothing
outside `src/orchestrator/controller.py`, `docs/run-entry.md`,
`tests/test_phase5_run_entry_fixes_2_review.py` in the work commit.

Mutants ran on scratch copies of the tree made with `git archive` (never in place), and each
was diff-verified against `git show <rev>:<file>` before any result was trusted. One red
evidence replay needed the probes as committed at `66e047b`, verified blob-identical to the
file at `REV` (`git hash-object`), before the RESHAPED (FINAL) copies were substituted.

<!-- ANSWERS -->

**1. F26's rule-8 close.** The fixes-3 brief's `GOAL` (the copy committed at `9304484` —
and its embedded convenience copy inside the review brief `52faafe` differs nowhere from
that file, byte-diff exit 0) carries the later committed correction of the named row
verbatim: "`the dotted-import row is` `import orchestrator.experiment_spec.sub` — a dotted
path whose forbidden module is interior and whose leaf is not — and
`import orchestrator.experiment.trial_driver` (the fixes-2 brief's `GOAL` example) is green
at a leaf-only helper because its leaf `trial_driver` is already forbidden". F26's `FIXED`
(names that brief's commit, reads `no regression test`) is therefore the right rule-8
`ORIGIN: BRIEF` close form. The correction's mechanics re-verified against the pristine
`REV` helper (`tests/test_run_entry.py` at `544a0bf`: `_module_leaf` + `_FORBIDDEN_MODULES`
= {experiment, experiment_spec, experiment_phases, trial_driver, smoke_run}) in a scratch
run: `import orchestrator.experiment.trial_driver` → leaf-only helper flags it (`True`),
`import orchestrator.experiment_spec.sub` → leaf-only helper misses it (`False`) — so the
latter is the only form with red evidence at a leaf-only helper, and the delivered
`_module_segments` (present at both REV and FINAL) flags both. The delivered import
matrix's `dotted-import` row is `import orchestrator.experiment_spec.sub` exactly as the
correction names it, and the five-row matrix is green at FINAL in the module run below.
**Attacked-and-not-falsified.**

**2. F27's guard.** Red evidence first, both forms at `REV` and both green at FINAL:

- The absorbed probe as committed at `66e047b` against `REV` code: red at the named
  assertion — `AssertionError: F27: mark_infeasible admitted a terminal decision for a
  lineage with zero recorded failures, driving the run outcome to 'INFEASIBLE' from the
  prose guard alone`, `assert 'INFEASIBLE' != 'INFEASIBLE'`, framed at
  `tests/test_phase5_run_entry_fixes_2_review.py:112`. The failure is a failing assertion
  (not a collection error).
- The RESHAPED probe (FINAL text) against `REV` code: `Failed: DID NOT RAISE
  WorkflowError` framed at `:119` (the `with pytest.raises(WorkflowError):` line) — the
  exact red the reshape requires. The FINAL-text F28 pin against `REV`'s doc also fails at
  `:161` on the bare head in the pristine Commands text.
- Both probes green at FINAL (2 passed; both shapes' assertions satisfied: the guard raises
  on the zero-fingerprint drive and nothing is admitted).

Then the guard itself:

- (a) The read surface: `self.store.state(run_id)` is the cached projection
  (`store.py:268` returns `self._states[run_id]`; only `replay_fresh` re-reads). I walked
  the two-connection order (second `EventStore` on the same db, a `Controller` built
  directly on it, `record_failure` through the second controller, then
  `mark_infeasible` through the first): the refusal **fires** despite the durable log
  carrying the recorded failure — a false refusal (`fresh = store.replay_fresh(...)` shows
  the fingerprint; the first connection's cached projection shows 0). Outcome recorded:
  **fail-closed**. The reverse direction cannot happen: the cache is built by `_replay_all`
  at construction and extended only by locally admitted events, so it is a lower bound on
  the durable fingerprints — a stale read can never produce a false pass through this
  guard. This is the right trade (the F20 lesson was deciding/returning documents on a
  stale read; here nothing is decided from the stale read except refusing); the shipped
  caller (`_bind_acceptance`, `run_entry.py:436-452`) records through the same controller
  before calling, so the run-entry path cannot hit the false refusal. Note recorded, not
  filed: the refusal message says "no recorded failure fingerprints", which is true of the
  connection's projection and possibly false of the durable log.
- (b) Every emitter: `evaluate_repeated_failure`'s two internal
  `NODE_MARKED_INFEASIBLE` sites (`controller.py:2036`, `:2051`) still emit directly, past
  the new surface. Mutant: I drove the `REPLAN_REQUIRED` branch with zero fingerprints —
  possible only through trusted in-process injection (a synthetic `REPLAN_REQUESTED` with
  source `synthetic` is refused by event validation — `InvalidSourceAuthority`; with the
  controller source forged, the node enters `REPLAN_REQUIRED` and the branch drives the
  node to `INFEASIBLE`, outcome `INFEASIBLE`, zero fingerprints). Site 2 is gated by
  construction (needs two identical fingerprints). Conclusion: the policy is enforced at
  the public surface and **assumed by construction** at the two internal sites; breaking
  the construction requires the trusted in-process event-injection power that is the
  already-recorded-open `PILOT-R10` family (such code could admit `NODE_MARKED_INFEASIBLE`
  directly through the store with no guard at all). That is not a new unguarded public
  emitter finding: reaching the branch requires the trusted in-process injection power, so
  the residual is R10's already-recorded-open family, not F27's surface.
- (c) The policy's meaning. Drive: `record_failure` once (an unrelated refusal: action
  type `EXECUTE`, diagnostic category `AN_OLD_UNRELATED_REFUSAL`), then
  `mark_infeasible` with no new attempt, no new observation: **admitted** — node
  `INFEASIBLE`, run outcome `INFEASIBLE`, on the single older fingerprint. Verdict
  against the guard's words: the enforced precondition (≥1 recorded fingerprint on the
  node's lineage) is exactly the fixes-2 brief's prescribed mechanical one ("admitted as
  one recorded failure plus `NODE_MARKED_INFEASIBLE`" — the recorded-refusal route's own
  reading), and the surface's docstring states the caller contract ("The caller has
  already recorded the observed failure(s)"; "a caller with a single observed failure
  settles the node here"). The terminal decision rests on a recorded refusal of the
  lineage, not on prose alone. **Attacked-and-not-falsified** — the enforced policy equals
  the reading this stream's own brief and the fixes-2 review determined for the recorded
  refusal route; the table's one-line guard stays prose, and nothing in the proved surface
  is weaker or stronger than that reading's mechanical content.

**3. F28's absorbed pin and doc.**

- (a) The misnamed id: the node id
  `test_review_f28_documented_bare_command_is_executable` claims the documented bare
  command is executable; the delivered pin proves the opposite class — every documented
  head must be the `python3 scripts/orchestrate.py …` form (bare heads asserted absent),
  and the module docstring says exactly that ("every documented head is the `python3`
  form…, no bare head is documented, and the documented form runs as written"). The id is
  the committed claim; it misstates the enforced property (the mode-bit route it names was
  declined). **Finding F31 (P2, origin code).**
- (b) The pin's prerequisite assertion binds word presence, not the claim — mutated: a
  prerequisite sentence naming only `json` (the `python3` heads unchanged) leaves the pin
  green, and the stronger deletion of both new sentences leaves it green as well
  (`"yaml" in section` matches `RUN_SPEC.yaml` inside every head's own argument shape, so
  the word-presence check cannot see whether the prerequisite claim is named at all). Two
  mutants, two scratch trees, two diff-verifications, both green: **finding F32 (P2,
  origin code — row I's vacuous-truth class).**
- (c) Row J on prose: every documented head run as written on this host, full argument
  forms (not only `--help`) — `start --spec … --workdir … --store …`, `inspect --run-id …
  --store …`, `stop --run-id … --store …` — against real frozen repositories in the
  exit-gate drives (answer 6; runs driven by the **system** `python3` 3.13.5 with
  PyYAML 6.0.2, i.e. the doc's named prerequisite holds here and every head started). The
  two new sentences hold as committed: no bare head is documented (asserted by the pin and
  confirmed by reading the delivered section); the artefact sentence "the delivered
  `scripts/orchestrate.py` is not executable (mode 100644)" matches the tree
  (`git ls-tree 01014226`: `100644`, unchanged at HEAD). **Attacked-and-not-falsified**
  for the sentences; for the prerequisite sentence's enforced claim, see F32.

**4. Red evidence at `REV`.** Both committed probes as committed at `66e047b` (blob
verified byte-identical inside the `REV` tree — `ef723f24d2b6…` at both commits) fail at
`REV` on their named assertions:

- F27's: `assert 'INFEASIBLE' != 'INFEASIBLE'`, framed at
  `tests/test_phase5_run_entry_fixes_2_review.py:112` — the report's `:112` lands on the
  named assertion (F22's lesson observed).
- F28's: `assert False` where `False = os.access(_SCRIPT, os.X_OK)`, framed at `:128` —
  lands on the named assertion.
- each is a failing assertion at REV (no error, no skip), and each probe is green at FINAL
  (module run; and the two-probe run at FINAL = 2 passed).

F27's `FIXED` citation honesty: the report's red citation is the **committed-at-REV
probe's** assertion text (`assert 'INFEASIBLE' != 'INFEASIBLE'`, `:112`), and the report
says nothing that would claim the `pytest.raises` form failed at REV. I additionally drove
the reshaped probe against REV code: `Failed: DID NOT RAISE WorkflowError` — so both the
committed-at-REV and reshaped reds are real. Nothing in that fixes review's description
overstates the reshape. **Attacked-and-not-falsified.**

**5. Guarded-surface shape's other facets** (accepted-lineage settle-once; duplicate-call
dedup against the shared `infeasible-{node_id}` key; terminal-run late retention): the
report's `SHAPES: none` claims them "unchanged as measured by the fixes-2 review" —
**hand measurement is not a test.** Measurement walk at FINAL (three drives): live route
record-failure→mark→duplicate: +1 then dedup +0; terminal-run late call after a recorded
failure: retained late once, outcome unchanged, duplicate +0; BUT the fixes-2 review's
zero-fingerprint drives (accepted lineage / cancelled run, no failure chain) now **refuse**
under the new guard — the pre-fix behaviour (retained late) is changed for exactly that
drive. Mutant: the idempotency key changed at all three emit sites
(`infeasible-{node_id}` → `infeasible-m-{node_id}`) in a scratch copy, diff-verified, and
**both test modules pass 40/40** — `grep` confirms no committed test anywhere asserts the
key, a duplicate mark_infeasible call, or a direct late mark on a terminal run — the only
committed test touching the surface is the F27 refusal probe. So the facets are **not
pinned**, one of the "unchanged" claims is false for the fixes-2-measured drive, and
`SHAPES: none` is F25's class again. **Finding F30 (P2, origin report), against the
report** (the brief's shape breadth is right: the shapes it names actually vary across the
fix; it is the report that hides them behind a hand measurement).

**6. Phase 5 exit gate as a whole** — five operator classes as subprocesses against real
frozen repositories (scratch `git init` target with `src/app.py` raising
`NotImplementedError`, real yaml RUN_SPECs, the documented python3 head as the launcher
form, `inspect`/`stop` full forms as subprocesses, each result compared with a
brand-new-connection `replay_fresh` (document == durable fresh outcome), stdout/stderr
scanned for tracebacks):

- accept (`true`): exit 0, JSON `accepted: true`, outcome `ACCEPTANCE_CLAIMED`, document ==
  fresh ✓
- failing-command refusal (`exit 3`): exit 1, `accepted: false`, `INFEASIBLE`, no
  traceback, document == fresh ✓
- wall-clock timeout (`sleep 30`, `wall_clock_seconds: 1`): exit 1, `INFEASIBLE`, no
  traceback, document == fresh ✓
- mid-run cancel: **FALSIFIED** — finding F29 (P1). Reproducer and attribution in the
  finding.
- injected ProtocolViolation (scratch copy with `worktree.py:328`'s `"bundle", "create",
  ..., "HEAD"` mutated to a nonexistent ref — the F19 family): exit 1, `accepted: false`,
  `INFEASIBLE`, attempt accounting `FINALLY_SETTLED`, no traceback, document == fresh ✓

Plus every documented head run as written (all five drives drove `start` full-form;
`inspect` and `stop` full-form in the classes that use them; all through the system
`python3` that the doc names — sentence holds on this host). Durability: classes 1, 2, 3,
5: document == durable fresh outcome as measured by a fresh connection's replay.
**Four of five attacked-and-not-falsified; the mid-run-cancel class is falsified-with-reproducer (F29).**

**7. Regressions over the whole stream.** ACCEPTANCE re-measured (counts, not trust):

- `scripts/check-tests --fast`: **961 passed, 85 deselected** (74.57s) ✓
- `tests/test_run_entry.py` + `tests/test_phase5_run_entry_fixes_2_review.py`: **40
  passed** = 37 + 3 across the two modules ✓ (13.67s)
- `tests/test_milestone2_conformance.py`: **41 passed** ✓
- `tests/test_phase3_project_oracle.py`: **5 passed** (248.14s) ✓
- `scripts/check-static`: exit 0, the advisory lint rows print without failing (the report's
  description of the gate's behaviour is right — 104 advisory rows, none a gate) ✓
- `scripts/check-docs`: **350/350 links**, 0 errors, exit 0 ✓
- `scripts/check-scope` (this review's acceptance): `tripped: PILOT-R1 PILOT-R10` ✓ — the
  report's TRIPPED line matches byte-for-byte.

Held sets: the fixes step's load and refusal shapes, the one-stamp pins, the settle-claim
interleave pins (stale-outcome read, fresh-outcome read, double-stop-after-settled-timeout),
the import matrix (five rows), `test_clean_env_cli_shape` (still executing the documented
`python3` head — a real start/inspect/stop through the CLI), the F21 drift pin, and the
budgets/`run_specification`/late-event guarantees are the 37 pins inside the module run —
all green. The recorded TRIPPED set is unchanged (`PILOT-R1`, `PILOT-R10` — still the only
trips). **No regression found; the TRIPPED set matches.**

**8. Report hygiene.**

- VERIFIED lines re-measured: 961/85 (`--fast`, 74.57s vs 70.20s — count matches, same
  order of work), 40 passed (37+3), conformance 41, oracle 5 (248.14s vs 261.15s), static
  exit 0 with the advisory rows not gating, docs links 350/350, `check-scope` →
  `tripped: PILOT-R1 PILOT-R10` — the report's TRIPPED line matches exactly. Every count
  matches.
- `SHAPES: none` — against question 5: defective (**finding F30**): two of the three
  facets' properties are hand-measured only, and one of the fixes-2-measured drives has
  changed behaviour under the new guard.
- `INHERITED: none` — correct. All three received findings were fixed in this step: F26 by
  the brief commit (`9304484`, rule-8 form, verified above), F27 by the guarded surface,
  F28 by the doc row + reshaped pin. The received INHERITED list (F26 carried; F27, F28
  fixed) is discharged entirely: nothing is carried.
- `FINAL` names the work commit `01014226…` and never the report commit (`73a90d1`) ✓.
- `METHOD FRICTION: none` — against the template field: present as the single line ✓.
- `FIXED` line numbers against the delivered files: F27's red citations `:112` and F28's
  `:128` both **land on the named assertions in the delivered test file** (verified by the
  REV replay above; the file at `REV` is the same blob the implementer cited); the F27 fixed
  citation names the assertion, not a line number, for its FINAL-form (the pin only needs
  the REV line), and no stale numbers remain.

<!-- FINDINGS -->

**F29 (P1, origin: code) — the mid-run-cancel operator class falsifies the exit gate's
document contract and leaves the durable log unreplayable.** The failure reproduced in
every drive attempted: the full-gate class-4 drive, two race-driver drives at FINAL
(delays 2s and 4s), one isolated drive, and twice at `REV 6ad0989` with the same script —
pre-existing, not a regression of this step's work; the F27 guard is nowhere in the trace.
Drive: a launcher runs `python3 scripts/orchestrate.py start --spec … --workdir … --store …`
(visible command `sleep 15`/`sleep 30`, `wall_clock_seconds: 60`);
while the visible command is running a second process runs the documented `stop`
(`python3 scripts/orchestrate.py stop --run-id RUN …`): the stop exits 0 and records the
cancellation (`CANCELLATION_CONFIRMED`, `ATTEMPT_COST_SETTLED_CONSERVATIVELY`,
`NODE_CANCELLED` — seqs 9–11), and the launcher — whose in-memory projection never observes
the second process's admissions — continues the live lifecycle on its own stale
projection: `DISPATCH_ACKNOWLEDGED`, `EXECUTOR_OBSERVATION_ADMITTED`,
`ATTEMPT_EXECUTION_ENDED_UNRECONCILED`, `ATTEMPT_COST_RECONCILED`, `RESULT_ADMITTED`,
`ARTEFACT_ADMITTED`, `ARTEFACT_INTEGRATED`, `EVIDENCE_ADMITTED`, `VALIDATION_STARTED`,
`VALIDATION_PASSED`, `ACCEPTANCE_AUTHORISED` (seqs 12–22) are all admitted; the launcher
exits **0** with JSON `accepted: true`, outcome `ACCEPTANCE_CLAIMED` — a cancelled run, so
the documented contract ("`start` exits zero when acceptance was authorised and non-zero
for every non-accepted class — a recorded refusal, a **cancelled run**, or a timed-out
attempt") is falsified. Worse: the durable log is **unreplayable** — any new connection
(`inspect`, a recover, a fresh `EventStore`) raises `ReducerError:
ARTEFACT_INTEGRATED: unknown artefact_id 'RUN-…-artefact'` (`reducer.py:908`, via
`store.py:133`'s `_replay_all`), because on the replay the cancellation already reached the
node and the artefact-registration branch the live (stale-cache) path had taken cannot
recur. The documented `inspect` head — "It admits no events and is safe against a run
another process started" — exits 1 with a traceback. So of the exit gate's contract
sentences: "each a settled terminal outcome, the documented JSON and exit codes, no
traceback, document == durable fresh outcome" — falsified-with-reproducer (the terminal
outcome is `ACCEPTED`/claims-accepted instead of cancelled; the exit code is 0 instead of
1; a documented head traces back — though not the launcher itself; and "document ==
durable fresh outcome" fails harder: the durable fresh outcome is not computable at all).
The committed interleave pins cover the settle machinery's cross-connection order;
this class — the stop of a second process landing against a **purely live exec** — is
unpinned. Carried: F29 stays P1 until a next brief either orders the launcher's every
execution-phase admission against a fresh read (the F20 triple-read discipline applied at
the live `DISPATCH_ACKNOWLEDGED`/observation boundary, not only at the settle seam), or
re-edges the machine's cancellation-concurrency contract — and pins the class
(subprocess-level, like the old `cancel-race` drives, never an in-process double-`stop`
alone).

**F30 (P2, origin: report) — the implementer report's `SHAPES: none` claims hand
measurements as covered shapes, and one claimed-unchanged facet actually changed.**
Evidence: (i) the key mutant — both modules pass 40/40 with the shared key changed at all
three emit sites — proves no committed test pins the dedup/settle-once/late-retention
facets of `mark_infeasible`; (ii) the zero-fingerprint terminal-run late call — the
fixes-2 review's answer-2 drive — now raises under the guard (behaviour changed), so
"unchanged as measured by the fixes-2 review" is false for that drive; (iii) the brief's
shape names all three facets and the brief's rule says every named shape needs a test.
Carried: the three facets' pins — or an honest `SHAPES` naming them unbuilt and naming the
behaviour change — in the next brief.

**F31 (P2, origin: code) — the absorbed F28 pin's node id
`test_review_f28_documented_bare_command_is_executable` misstates the enforced
property** (the id claims the documented bare command is executable; the pin enforces "no
bare head documented and the documented `python3` form runs"). The docstring is honest;
  the claim-bearing id is not (and the id's claim is the opposite of the pin's own
  `assert not head.startswith(...)`). Carried: rename the node id in the next brief — the
  id is the claim (F24's honesty rule) — with the docstring unchanged.

**F32 (P2, origin: code) — the F28 pin's prerequisite sentence assertion binds word
presence, not the named claim** (row I's vacuous-truth class): `"yaml" in section` and
`"python3" in section` are already satisfied by the argument shape inside every head
(`--spec RUN_SPEC.yaml` and the `python3` interpreter), so the pin stays green through both
mutants (a `json`-naming prerequisite sentence; deletion of the new sentences). Carried:
bind the claim (e.g. the pin parses the sentences' heads separately from the argument
shapes), or drop the assertion and rely on the module docstring — but then say so.

<!-- SHAPES -->

Shapes this review measured **and is not filing** (formally because they were
attacked-and-not-falsified): the F27 guard's fail-closed stale-projection refusal (the
two-connection false refusal, message honesty note recorded in answer 2a); the
`evaluate_repeated_failure` two-site by-construction gating (broken only by the trusted
in-process injection that is the open `PILOT-R10` family); the one-fingerprint terminal
route's meaning (matches the reading the run-entry stream owns; un-ageing of the recorded
refusal is the recorded-refusal route's documented semantics).

Shapes this review measured and is filing: F29 (cancel-race window, unpinned), F30
(mark_infeasible's dedup/settle-once/late-retention facets, unpinned and partly changed),
F31 (the pin's claim-bearing id), F32 (word-presence helpers that bind words not claims).
A shape the next brief should watch when it rebuilds these pins: any "no traceback" drive
must exercise the **documented `inspect` head** against the produced store, not only the
launcher's own stderr, because the observable failure hides in the SECOND process —
exactly where F29's traceback lands.

<!-- METHOD FRICTION -->

`METHOD FRICTION: none` — the template's field was consulted as this review's required
last line: no friction worth the OWNER's time.

<!-- VERIFICATION of the review's own work -->
- All commands ran from the repo root with the project venv (`scripts/check-scope`,
  `scripts/check-tests --fast`, `scripts/check-static`, `scripts/check-docs`,
  `.venv/bin/python -m pytest …`); mutant and red-stream runs ran inside `git archive`
  scratch copies under `/tmp/kilo`, each diff-verified against `git show <rev>:<file>`
  before its result was trusted, and the mid-run-cancel drives ran as real subprocesses on
  scratch stores. The recorded count lines in this report are this review's own measured
  output, not the implementer numbers.
- Nothing in this review modified any file under `src/` or `tests/`, or any `docs/` file
  outside `docs/research/`; the review's only commit adds this report file.
