REPORT — phase5-run-entry-fixes-2-implementer
STEP: phase5-run-entry-fixes-2 (Phase 5: the settle-route fixes — F17–F25)
REV: 544a0bf0ae130d7391d5215054c78ca60bebd81d   FINAL: b98310d4f6df56f98c35aefc5bdcbfccd390ee70
CHANGED: src/orchestrator/controller.py — a small public `Controller.mark_infeasible` surface beside `record_failure`/`evaluate_repeated_failure`: one `NODE_MARKED_INFEASIBLE` admission on `any_non_terminal`, the deterministic-infeasibility route that does not need a manufactured repeat.
CHANGED: src/orchestrator/run_entry.py — one `FAILURE_RECORDED` per observed failure in both refusal paths, each followed by `mark_infeasible` instead of a forged second stamp plus `evaluate_repeated_failure`; `_settle_executor_refusal` settles the attempt's accounting first and unconditionally, re-reads the fresh outcome at the point of emission, and returns the durable fresh outcome re-read after its own admissions; `start_run` catches `ProtocolViolation` and settles it through the same recorded-refusal path; the module docstring's fail-closed claim is narrowed to the loader-refusable classes with the freeze boundary named.
CHANGED: docs/run-entry.md — the Run-spec section's fail-closed sentence is narrowed to loader-refusable malformed specs and names the freeze-boundary classes (DECLARED divergence, unfreezable repository) as zero-event refusals that may leave the store file created.
CHANGED: tests/test_run_entry.py — F18 one-stamp assertions on both refusal paths; a `ProtocolViolation`-refusal pin; three settle-claim pins (stale read, fresh read, double stop after a settled timeout); a freeze-boundary zero-events drift guard; every dotted import segment checked with a red dotted-import row; the clean-env pin runs the documented `python3` form via `_documented_interpreter`.
VERIFIED: scripts/check-tests --fast — 961 passed, 82 deselected in 100.07s (0:01:40), exit 0. The 82 = the review's 76 + this step's 6 new slow cases.
VERIFIED: .venv/bin/python -m pytest tests/test_run_entry.py — 37 passed in 16.58s (31 received + the dotted row + five new cases). The interpreter is the one the ACCEPTANCE line names.
VERIFIED: .venv/bin/python -m pytest tests/test_milestone2_conformance.py — 41 passed in 0.41s.
VERIFIED: .venv/bin/python -m pytest tests/test_phase3_project_oracle.py — 5 passed in 283.36s (0:04:43).
VERIFIED: scripts/check-static — exit 0 (the gated BLE001/S110 select over `src/orchestrator` prints no items; the advisory B/SIM run prints 104 non-gating items).
VERIFIED: scripts/check-docs — exit 0, 346 links, 0 errors.
VERIFIED: scripts/check-scope 544a0bf0ae130d7391d5215054c78ca60bebd81d b98310d4f6df56f98c35aefc5bdcbfccd390ee70 docs/research/phase5-run-entry-fixes-2-brief.md — `tripped: PILOT-R1 PILOT-R10`, `scope: ok (5 path(s) in 544a0bf0..b98310d)`, exit 0.
VERIFIED: Red evidence at REV 544a0bf on a scratch worktree (src diff-verified as REV by construction; the new tests copied in): F18 `test_settled_start_shape_wall_clock_overrun` red at `assert len(fingerprints) == 1` (`assert 2 == 1`, tests/test_run_entry.py:585) and `test_start_shape_records_a_refusal_without_authorising` red at `assert types.count("FAILURE_RECORDED") == 1` (`assert 2 == 1`, line 298); F19 `test_protocol_violation_refusal_shape` red at `raise AssertionError("start_run escaped with ProtocolViolation instead of settling the run through the recorded-refusal path")` (line 633); F20 `test_settle_claim_shape_stale_outcome_read` red at `assert result.outcome == "CANCELLED"` (`assert 'INFEASIBLE' == 'CANCELLED'`, line 762) and `test_settle_claim_shape_fresh_outcome_read` red at `assert ... accounting_state == "FINALLY_SETTLED"` (`assert 'PROVISIONALLY_SETTLED' == 'FINALLY_SETTLED'`, line 806). All green at FINAL.
VERIFIED: Red evidence for F23 against the delivered leaf-only helper (scratch probe reproducing REV's `_imported_module_names`/`_module_leaf` verbatim): `AssertionError: the pin misses the 'dotted-import' spelling: ['sub']`, red at the assertion `assert leaves & _FORBIDDEN_MODULES`. Green at FINAL's segment-checking helper.
NOT VERIFIED: none — every claim is covered by a run named above. F21 and F24 are drift guards with no failing assertion at any revision; F22 and F25 are already-committed report defects closed as recorded.
FINDINGS:
  F17 | SEVERITY: P2 | ORIGIN: BRIEF | STATE: fixed
  The fixes-brief's ACCEPTANCE named a bare `pytest` line that cannot go green on this host, and the fixes report substituted an interpreter instead of filing the fact.
  FIXED: no regression test — this brief's commit 3375429f6ff17e199a767d0a1e474ef8c7cfcc1f re-cut the ACCEPTANCE lines to `.venv/bin/python -m pytest`, names that interpreter deliberately, and this report claims exactly those commands.

  F18 | SEVERITY: P1 | ORIGIN: CODE | STATE: fixed
  Both refusal paths stamped one observed failure's fingerprint twice and solved the repeated-failure gate off the forged pair, so the durable log recorded a history that never happened and `inspect` read two failures for one overrun.
  FIXED: tests/test_run_entry.py::test_settled_start_shape_wall_clock_overrun — at REV the named failing assertion is `assert len(fingerprints) == 1` (line 585): `AssertionError: assert 2 == 1`; tests/test_run_entry.py::test_start_shape_records_a_refusal_without_authorising — at REV `assert types.count("FAILURE_RECORDED") == 1` (line 298): `assert 2 == 1`. At FINAL both record exactly one failure, reach `INFEASIBLE` through `NODE_MARKED_INFEASIBLE`, and admit no `REPLAN_REQUESTED` of reason `REPEATED_FAILURE_WITHOUT_NEW_EVIDENCE`; `evaluate_repeated_failure` and the fingerprint material are unchanged.

  F19 | SEVERITY: P1 | ORIGIN: BRIEF | STATE: fixed
  The Settled-start shape named three escape classes but the delivered `start_run` handled only `AttemptTimedOut` and `AttemptCancelled`, so a mid-dispatch `ProtocolViolation` escaped with the run live.
  FIXED: tests/test_run_entry.py::test_protocol_violation_refusal_shape — at REV the named failing assertion is `raise AssertionError("start_run escaped with ProtocolViolation instead of settling the run through the recorded-refusal path")` (line 633). At FINAL the injected dispatch yields `accepted: false`, `outcome: INFEASIBLE`, attempt accounting `FINALLY_SETTLED`, root `INFEASIBLE`.

  F20 | SEVERITY: P1 | ORIGIN: CODE | STATE: fixed
  The settle read the fresh outcome once and then reduced against the stale in-memory projection: a second process's `stop` interleaved between the read and the emissions could append a late forged chain and leave the launcher's JSON naming a stale outcome, and a stop before the read left the timed-out attempt `PROVISIONALLY_SETTLED` on a terminal run.
  FIXED: tests/test_run_entry.py::test_settle_claim_shape_stale_outcome_read — at REV the named failing assertion is `assert result.outcome == "CANCELLED"` (line 762): `assert 'INFEASIBLE' == 'CANCELLED'`; tests/test_run_entry.py::test_settle_claim_shape_fresh_outcome_read — at REV `assert ... accounting_state == "FINALLY_SETTLED"` (line 806): `assert 'PROVISIONALLY_SETTLED' == 'FINALLY_SETTLED'`. At FINAL the settle settles accounting first, re-reads at the point of emission, and returns the durable fresh outcome; the double-stop-after-settled-timeout variant is built green at both (`test_settle_claim_shape_double_stop_after_settled_timeout`).

  F21 | SEVERITY: P2 | ORIGIN: BRIEF | STATE: fixed
  The Fail-closed-load shape's universal "every malformed class refused before any store is opened" was false: the CLI creates the store file at construction, so a DECLARED divergence or an unfreezable repository leaves the file behind.
  FIXED: no regression test — a claim narrowed to truth has no failing assertion. The drift guard tests/test_run_entry.py::test_fail_closed_load_shape_freeze_boundary_admits_zero_events pins the measured behaviour (both freeze-boundary classes exit non-zero, admit zero events, and leave the store file created) and is green at REV and FINAL; docs/run-entry.md and the module docstring now state exactly that.

  F22 | SEVERITY: P2 | ORIGIN: DOCUMENT | STATE: fixed
  The fixes report's red-evidence line numbers matched neither the delivered test file nor one consistent scratch layout.
  FIXED: no regression test — recorded in docs/research/phase5-run-entry-fixes-review.md; a defect in an already-committed report has no failing assertion and no next action.

  F23 | SEVERITY: P2 | ORIGIN: CODE | STATE: fixed
  The import pin collapsed each import path to its leaf, so a dotted absolute import whose forbidden module is an interior segment (`import orchestrator.experiment_spec.sub`) was not flagged.
  FIXED: tests/test_run_entry.py::test_import_spelling_shape[dotted-import] — at REV against the delivered leaf-only helper the named failing assertion is `assert leaves & _FORBIDDEN_MODULES`: `AssertionError: the pin misses the 'dotted-import' spelling: ['sub']`. At FINAL `_module_segments` checks every dotted segment and all five spellings are flagged; the dynamic-import class (`__import__`, `importlib.import_module`) is named in the pin's docstring as a static pin's known unenforced class.

  F24 | SEVERITY: P2 | ORIGIN: CODE | STATE: fixed
  The clean-env pin launched `[sys.executable, …]` while its docstring and the doc row named `python3 scripts/orchestrate.py`, skewing the claim from the artefact.
  FIXED: no regression test — `_documented_interpreter` runs the `python3` on PATH when it can import `yaml`, falls back to `sys.executable` only otherwise, and the pin's docstring states the choice. `test_clean_env_cli_shape` is green at REV and FINAL; on this host the system `python3` 3.13.5 resolves `yaml`.

  F25 | SEVERITY: P2 | ORIGIN: DOCUMENT | STATE: fixed
  The fixes report's SHAPES claim ("nothing probed by hand was left unbuilt") was false: five shapes were unbuilt.
  FIXED: no regression test — recorded in docs/research/phase5-run-entry-fixes-review.md; the unbuilt shapes it names (ProtocolViolation escape, both settle/stop interleavings, freeze-refused store creation, dotted import, dynamic import) are now built or named in this step's pins and SHAPES.

  F26 | SEVERITY: P2 | ORIGIN: BRIEF | STATE: carried
  This brief's GOAL names `import orchestrator.experiment.trial_driver` as a dotted-import row "red at the delivered helper", but that path's leaf `trial_driver` is in `_FORBIDDEN_MODULES`, so the delivered leaf-only helper already flags it (green) and it cannot demonstrate the fix; the brief's own prose names the genuinely-red form `import orchestrator.experiment_spec.sub` (a dotted path into a harness submodule). Reading taken: the dotted row is `import orchestrator.experiment_spec.sub`, whose forbidden module is interior and which is red at the delivered helper.
  FIXED: no regression test — a later committed brief should correct the named row to a leaf-non-forbidden dotted path; carried until then.
SHAPES: shapes probed that the suite does not build: (i) the same-instant adversarial race between the settle's point-of-emission fresh read and its own `record_failure`/`mark_infeasible` emissions — a second process's `stop` committed in that sub-step gap can still append a late node-level chain, because there is no cross-process lock; the two deterministic orders the brief pins (stop before the read, and between the decision read and the point-of-emission read) are built, and this residual race is outside the check-before-emit claim by the brief's own discipline. (ii) The dynamic-import class (`__import__("orchestrator.experiment")`, `importlib.import_module`) is outside the static AST pin and is named in `test_import_spelling_shape`'s helper docstring. The double-stop-after-settled-timeout variant the review probed clean is built as `test_settle_claim_shape_double_stop_after_settled_timeout`.
TRIPPED: PILOT-R1 PILOT-R10 — copied from check-scope's `tripped:` line, verbatim. Both rows stay accepted: this brief's path never admits a decomposition, so no admitted payload exists to mutate (`PILOT-R1`), and `PILOT-R10`'s in-process trusted-code circumvention is not closed.
PROPOSED ROWS: none — every finding maps to rows the ledger already carries (F18's manufactured precondition is B and A; F20's interleaving is H; the brief/claim skews in F17, F24, and F26 are J).
METHOD FRICTION: none against the method or docs/templates/report.txt. The only reading forced by the brief is filed as F26 (a defect in the brief, not friction).
INHERITED:
  Nothing received is still open — the received set was F17–F25, and each is fixed by this step (F17 via the ACCEPTANCE re-cut in this brief's commit 3375429; F18, F19, F20, F23 with red evidence; F21 and F24 as narrowed claims / an honest pin; F22 and F25 as recorded in docs/research/phase5-run-entry-fixes-review.md). This step adds one carried finding:
  F26 | SEVERITY: P2 | ORIGIN: BRIEF | STATE: carried — the brief names `import orchestrator.experiment.trial_driver` as a dotted-import row "red at the delivered helper", but that leaf is already forbidden, so the row is green; the reading taken is the brief's own red form `import orchestrator.experiment_spec.sub`. A later committed brief should correct the named row.
