IMPLEMENTER BRIEF — phase5-run-entry-fixes-5 (Phase 5: the loader face — F34 and the F33 clause restate)

GOAL: F34 is disposed and the fixes-4 review's committed red probe is green — `load_run_spec` refuses a YAML-unparseable spec file as a named `RunSpecError`, so `docs/run-entry.md`'s fail-closed sentence ("a loader-refusable malformed spec is refused as a named `RunSpecError` before any store is opened or any event is admitted"), the module docstring's "Loading is fail-closed" sentence, and `RunSpecError`'s "one named failure" docstring all hold as written with nothing to reword — the `OSError` refusal is unchanged, and the refusal still admits zero events and leaves the store file absent. The F33 clause's literal parenthetical is restated in this brief as the boundary the fixes-4 review pinned: fail-closed retention means an artefact id **no terminal attempt owns** (the `{attempt_id}-artefact` shape and its owning terminal attempt), never "never admitted anywhere in the log" — whose literal form is unsatisfiable (a pure `reduce(state, event)` cannot measure final-log membership, and retention writes no state record) — and the reading's residual is the recorded, pinned boundary (`tests/test_phase5_run_entry_fixes_4_review.py::test_review_f33_residual_crafted_terminal_owned_artefact_retained`: a crafted `{terminal_attempt}-artefact` id with no prior `ARTEFACT_ADMITTED` is retained rather than refused; an id no terminal attempt owns still raises `ReducerError`).

CONTEXT: The fixes-4 step closed out (its review raises no P0 and no P1; [record.md](../record.md)'s row at REV `5711e48…`, Fixed 5 / Red 1 / Carried 1 / Declined 0 / Reviews 1). F34 (P2, ORIGIN: CODE, carried by the fixes-4 review) is the loop's last carried finding — the loop's exit condition ("no P1 or P2 finding remains", the `Carried` column) is what this step pays. F34's mechanism: `load_run_spec` (`src/orchestrator/run_entry.py:265-272`) catches only `OSError`, so `yaml.safe_load`'s decode errors escape raw — measured through the documented CLI head on the delivered code: `python3 scripts/orchestrate.py start --spec BAD.yaml …` (BAD.yaml = `run_id: [unclosed\n  - oops\n`) → exit 1, `yaml.parser.ParserError` traceback on stderr, NO JSON document, store file ABSENT, zero events. The zero-events/no-store half is what F21's narrowing claimed and measured; the falsified sentence is the named refusal ("refused as a named `RunSpecError`"). Pre-existing since the run entry point's own origin (dae836f), not a regression of any step. The fix the review names: widen `load_run_spec`'s except to catch the YAML decode errors and wrap them as `RunSpecError` (a message naming the path and the decode error, raised `from` it), keeping the `OSError` refusal as-is; `validate_run_spec` and everything downstream are untouched. The clause restate is the fixes-4 review's planner pointer to this step's planner: rule 8's close form bites where the text lives, so the corrected clause lives in this committed brief and F33's boundary stops being a clause-reading question.

INHERITED:

From `docs/research/phase5-run-entry-fixes-4-implementer.md`, its `INHERITED` block verbatim:

  INHERITED:
  none — every received INHERITED item (F26, F27, F28) is fixed by the prior step; nothing was open to carry in. The fixes-3 review's FINDINGS set was moved into this brief's body (F29–F32); all four are fixed in this step; nothing is carried.

From `docs/research/phase5-run-entry-fixes-4-review.md`, its `INHERITED` block verbatim:

  INHERITED:

  Nothing received is still open. The received INHERITED (the fixes-3 report's: "none — every
  received INHERITED item F26/F27/F28 is fixed by that step; F29–F32 moved into this brief's
  body; nothing is carried") is consistent with what this review verified: F29–F32 are this
  step's brief-body items and are disposed here (their red evidence re-measured at this review's
  REV scratch, answers 3 and 7). Carried by THIS review: F34 (above), the pre-image for the next
  step's absorb. The F33 clause correction is a planner pointer, not a carried defect (F33's own
  residual, recorded in the disposition note above).

The copied block's "F34 (above)" names that report's `FINDINGS` entry; it is moved verbatim here so the brief is the actor's only input and the reference resolves:

  F34 | SEVERITY: P2 | ORIGIN: CODE | STATE: carried
  The run-entry loader's documented fail-closed face does not hold for a spec file the YAML
  decoder itself cannot parse. docs/run-entry.md (:12, the sentence this step's F21 narrowed):
  "a loader-refusable malformed spec is refused as a named `RunSpecError` before any store is
  opened or any event is admitted"; run_entry's module docstring (:7-9) and the
  `RunSpecError` docstring (:53-55, "the operator sees one named failure, never a run-time
  surprise") repeat it. `load_run_spec` (src/orchestrator/run_entry.py:265-272) catches only
  OSError, so `yaml.safe_load`'s errors escape raw. Measured through the documented CLI head on
  the delivered code: `python3 scripts/orchestrate.py start --spec BAD.yaml …` (BAD.yaml =
  "run_id: [unclosed\n  - oops\n") → exit 1, `yaml.parser.ParserError` traceback on stderr, NO
  JSON document, store file ABSENT, zero events. Zero events and no store hold — the half F21's
  narrowing claimed and measured — but the refusal is not "as a named
  `RunSpecError`". No committed pin drives `load_run_spec` at all (tests/test_run_entry.py and
  tests/test_phase5_run_entry_fixes_2_review.py reference validate_run_spec/freeze_target only;
  the clean-env pin feeds the CLI a VALID spec), so the file-level loader face — read, decode,
  OSError-refusal, decode-refusal — is unpinned. Pre-existing at the run entry point's own origin
  commit (dae836f, `except OSError` unchanged there and at REV), NOT a regression of this step.
  FIXED: none — carried. The next step's brief absorbs the committed red probe
  (tests/test_phase5_run_entry_fixes_4_review.py::test_review_f34_unparseable_spec_file_refused_as_a_named_run_spec_error)
  green: widen `load_run_spec`'s except to catch the YAML decode errors and wrap them as
  `RunSpecError` (the doc's sentence then holds as written, nothing to reword), keeping the
  OSError refusal as-is.

IN SCOPE: src/orchestrator/run_entry.py

RESIDUALS:

none — rule 3 selection for this brief's `IN SCOPE`: no `docs/residuals.md` trigger glob matches `src/orchestrator/run_entry.py` (the ten `PILOT-R*` triggers name `planning_pilot.py`, `controller.py`, `reducer.py`, `decomposition.py`, `model.py`, and `derive_obligations.py`; the store is byte-verified against `docs/residuals.md` before this brief's commit, rule 2). No residual row rides, so the residual half of `scripts/check-scope` has nothing to carry here and it prints `tripped: none` — the line your report's `TRIPPED` field copies.

OUT OF SCOPE:
- Editing this brief file (`docs/research/phase5-run-entry-fixes-5-brief.md`). A committed brief is never modified; a re-cut is a new file.
- The reducer's retained-admission pair (`src/orchestrator/reducer.py`) and every committed pin of the earlier steps: F33's boundary is restated above as brief text, no code there changes, and `tests/test_run_entry.py`, `tests/test_phase5_run_entry_fixes_2_review.py`, and `tests/test_phase5_run_entry_fixes_4_review.py` are read-only here — the absorbed probe turns green from the fix alone. If a pin would have to change for acceptance to pass, stop and report `IN SCOPE` as insufficient.
- `validate_run_spec`, `freeze_target`, `start_run`/`_bind_acceptance`, the controller stack, the store, the experiment harness, `scripts/orchestrate.py`.
- `docs/run-entry.md`, the module docstring, and the `RunSpecError` docstring: the fix makes their sentences true as written — nothing is reworded, narrowed, or widened. If you find a sentence the fix cannot make true, stop and report rather than reword it (a document amended is an OWNER commit, rule 5).
- No `docs/tables/*` change and no table regeneration, no `docs/event-catalogue.md` change and no new event type, no `docs/control-plane.md` edit, no `docs/residuals.md` or `docs/record.md` edit, no `docs/self-host.md` edit, no `docs/method.md` or `docs/templates/` edit.
- The fixes-4 review's `SHAPES` disclosures stand as disclosed and are not built here: the launcher's cache-vs-durable divergence inside the two-connection window (no committed claim reads `store.state` for a decision read), the cross-route `infeasible-{node_id}` key-identity coverage note (`evaluate_repeated_failure`'s two emit sites share the key with `mark_infeasible`; renaming only those two keeps every pin green), and the stop-after-observation drive's documented-workflow stop face (its CLI faces live in the class pin).
- Registry and control files: `tests/open_defects.yaml`, `tests/counterexamples.yaml`, `tests/guard_mutation_matrix.yaml`, `tests/fixture_fidelity.yaml`, `tests/verifier_registry.yaml`, `tests/spend_paths.yaml`, `tests/invariants.py`, `tests/helpers.py`, `pytest.ini`, tool configuration. No test file changes and no new test file — the standing `tests/test_phase3_project_oracle.py` line is therefore not owed (it is named only for a brief that adds a file under `tests/` or `scripts/`).
- No new dependencies, no tooling configuration, no reformatting. No new exception class (`RunSpecError` is the named failure) and no `*Executor`/`*ModelClient` class or provider-registry registration.
- Name no test `test_bug_*` (the open-defect registry would then own it).

ACCEPTANCE: Commands (run every one and paste what each prints into `VERIFIED`; expected result is green, exit 0, for each):

    scripts/check-tests --fast
    .venv/bin/python -m pytest tests/test_phase5_run_entry_fixes_4_review.py tests/test_run_entry.py tests/test_phase5_run_entry_fixes_2_review.py
    scripts/check-static
    scripts/check-docs
    scripts/check-scope 8adc6c544277e002e7c555df395582043920f098 <FINAL> docs/research/phase5-run-entry-fixes-5-brief.md

Every `pytest` line names `.venv/bin/python -m pytest` deliberately (F17's carried correction: the bare `pytest` on PATH has no `pytest-timeout` and `pytest.ini`'s `strict_config = true` rejects it on this host — run these lines exactly as written and claim them under these names). `tests/test_run_entry.py` and `tests/test_phase5_run_entry_fixes_2_review.py` are named as the run-entry battery that must not regress under the loader widening. Never put a full run in `ACCEPTANCE`; the reviewer runs `scripts/check-tests`. `REV` below names the step's base — the parent of this brief commit — and is not claimed to be `FINAL`'s parent (F4's lesson).

Red evidence at `REV` `8adc6c544277e002e7c555df395582043920f098` (command `.venv/bin/python -m pytest tests/test_phase5_run_entry_fixes_4_review.py`; each unit must be replayable): the previous review's own committed probe is red at `REV` as committed — `tests/test_phase5_run_entry_fixes_4_review.py::test_review_f34_unparseable_spec_file_refused_as_a_named_run_spec_error` — the named failing assertion at `REV` being its `pytest.fail` translation at tests/test_phase5_run_entry_fixes_4_review.py:313: `Failed: F34: an unparseable spec file is refused as ParserError, not the documented named `RunSpecError`: ParserError('while parsing a flow sequence', …)` (the probe's `except run_entry.RunSpecError` face never triggers at `REV` because `load_run_spec` re-raises the raw `yaml.parser.ParserError`; the fail message names the class that escaped). The fixes-4 review adjudicated this fail shape as red for an unreachable read at its answer 3d and named the probe "the next step's pre-image per the report.txt convention" — that red is this step's red evidence, already in the tree, and `FIXED` names the node id, the command, that failing message, and the delivered file's line numbers or none (F22's lesson). Measured at `REV`: `scripts/check-tests --fast` 961 passed, 97 deselected, 66.40s; `scripts/check-tests` 1057 passed, 1 failed (exactly that node), 435.05s; `scripts/check-docs` 358/358 links, 0 errors; `scripts/check-static` exit 0 (104 advisory rows, no gate).

Slow-mark convention: the probe's module stays slow-marked by its existing `pytestmark = pytest.mark.slow` (`src/orchestrator/project_oracle.py:731`'s internal gate runs `scripts/check-tests --fast`, and the pre-commit hook deselects the same way); no new module is needed and no test file is edited.

Named shapes to build — the list of shapes, not the number of tests. One shape needs at least one test, and every named shape needs one:

- `Loader-decode refusal shape` (F34): the absorbed probe is the shape's test — `load_run_spec` on a YAML-unparseable file raises the named `RunSpecError` (from the decode error) before any store is opened or any event is admitted, and the refusal still admits zero events and leaves the store file absent. The `OSError` face is kept as-is and is not a named shape here (it is unchanged behaviour and no new pin is owed for it); if your work probes it and the suite does not build it, name it in `SHAPES` rather than claiming it covered.
- `Clause-restate shape` (F33's boundary): no new test — the boundary is text in this brief (terminal-owner shape, never final-log membership), and its faces are already built and stay green unchanged: `tests/test_phase5_run_entry_fixes_4_review.py::test_review_f33_residual_crafted_terminal_owned_artefact_retained` (the named residual — a crafted `{terminal_attempt}-artefact` id with no prior `ARTEFACT_ADMITTED` is retained) and `tests/test_run_entry.py::test_stale_admission_race_log_replays`'s unknown-id fail-closed assertion (an id no terminal attempt owns still raises `ReducerError`). The shape entry exists so the restate is not hidden as prose-only work.

REV: 8adc6c544277e002e7c555df395582043920f098
CLOSE OUT: yes
DIVERGENCES: none
REVIEW: one session — attack the loader's refusal face at every malformed class the decoder and the filesystem can produce (unparseable YAML, wrong top-level type, missing keys, an unreadable path), the named-`RunSpecError` contract's every documented face (`docs/run-entry.md`'s fail-closed sentence, the module docstring, `RunSpecError`'s docstring) against the delivered except clause, and the clause restate's boundary (the terminal-owner test and its named residual — the residual pin stays green and the ownerless-id face still raises `ReducerError`). Report each guarantee as falsified-with-reproducer or attacked-and-not-falsified with the method.

You implement one brief. You do not plan, re-scope, or decide what the work is. Read every file
in IN SCOPE before editing it; if what you find contradicts the brief, report that instead of
guessing. Modify only what IN SCOPE names. If you find uncommitted changes in the tree, stop and say
so. Stop and report rather than improvise when IN SCOPE is
insufficient, the brief contradicts the code, you have already failed twice at this goal, or the
requirement is ambiguous and no single reading is consistent with the rest of the brief. If exactly
one reading is consistent, take it and file a FINDING with ORIGIN: BRIEF that names the reading you
took. No new dependencies, no tooling configuration, no reformatting. Run every ACCEPTANCE command;
fix what is in scope and report what is not.

A defect in the brief is a FINDING, never METHOD FRICTION. METHOD FRICTION is only for the method and
its templates: any place you deviated from them, found them ambiguous, or found them silent. Report
friction you worked around — that is the section the method learns from.

Commit your own work. When ACCEPTANCE passes, commit the files you changed, and only those, in one
commit whose message ends with the trailer `Actor: IMPLEMENTER`. That commit's full sha is FINAL.
Then append docs/templates/report.txt verbatim, fill it in, write it to
docs/research/<phase>-<subject>-implementer.md, and commit it in a second commit with the same
trailer. Do not amend the first commit to add the report: FINAL must not change after the report
names it. If you cannot commit, stop and say so; do not leave work uncommitted for someone else to
commit.

# report.txt

REPORT — <phase>-<subject>-<role>
STEP: <implementer brief subject>
REV: <copied from the brief's REV — the step's base, not FINAL's parent>   FINAL: <implementer: sha of your work commit, never the commit that holds this report;
  reviewer: the sha under review, copied from the review brief>
CHANGED: <files, one line each>
VERIFIED: <command, duration, counts>
         Every VERIFIED and ACCEPTANCE claim names the command that actually ran — never a
         substituted interpreter, wrapper, or narrowed form. If the documented form cannot run in
         your environment, record both commands and the documented form's separate check.
NOT VERIFIED: <why, or none>
FINDINGS: none | one block each:
  ID | SEVERITY: P0|P1|P2 | ORIGIN: BRIEF|CODE|DOCUMENT | STATE: fixed|declined|carried
  <root cause, one line>
  FIXED: <node id, command, and the named failing assertion at REV — or "no regression test">
         An error or a collection failure is not red. The assertion has to be the thing that
         failed; a run that merely crashed proves nothing.
  STATE means: fixed (above); declined = not a defect, with the reason; carried = a real defect
  left unfixed, passed on in INHERITED. A defect you will not fix now is carried, never declined.
  An ORIGIN: BRIEF finding is fixed once a later committed brief corrects the text: FIXED: names
  that brief's commit and reads "no regression test". Carried means a future actor has something to
  do with it; at closeout a finding with no possible next action is closed — a defect in an
  already-committed report reads FIXED: recorded in the review that filed it, and an authoring
  lesson from a finished brief goes into record.md's Observations.
SHAPES: <shapes probed that the suite does not build, or none with a reason>
        Every shape this report names needs a test or an entry here: a hand measurement is not a
        test. A facet claimed unchanged is re-driven at FINAL when your fix touches its surface.
        SHAPES: none claims nothing probed is left unbuilt — never that unbuilt probes were left
        unnamed.
TRIPPED: <copied from check-scope's tripped: line>
PROPOSED ROWS: <ledger rows, or none>
METHOD FRICTION: none | <where you deviated from the method or its templates, misread them, or
  found them silent. A defect in the brief is a FINDING, not friction. This form is exhaustive:
  every field is filled and nothing outside it is added. A departure from the form is friction
  even when it changes no outcome — silence is not compliance.>
INHERITED:
<<every INHERITED item you received that is still open, copied verbatim; then each
  finding you marked carried, with its ID>>
Rule 2 governs the planner's copy of this block. What goes in it is yours: an implementer or
reviewer who received an obligation, finding, entry or trigger carries it forward verbatim, and
adds anything new that is still open. A block reading `none` is correct only when nothing came in
and nothing is open. INHERITED never carries residual rows; they are re-selected from the store per
brief.
