REPORT — phase4-recursive-planning-integration-fixes-implementer
STEP: phase4-recursive-planning-integration-fixes (the continuation fixes — the CHILD_OF depth walk and the full-suite profile leak)
REV: f74a9f0a8b236278f765496b80ec6a8238f9384b   FINAL: 6dc55f8927e03d771f98aec53b5e273af2b90968
CHANGED: src/orchestrator/controller.py — `_node_depth` walks CHILD_OF parentward (`from_node_id == current` → `to_node_id`), matching the production write and the reducer's `children_of`.
CHANGED: tests/test_planning_pilot.py — hand-built CHILD_OF relations corrected to the production direction (`_state`'s chain, the "rp" edge, and the per-trial-ceiling fixture).
CHANGED: tests/test_phase2_general_target.py — `_prepare`, `_compare`, and `test_patch_mode_never_batches_review_n7` capture the pre-mutation profile/factory and restore those bindings, instead of re-reading the mutated delegated `experiment.MODEL_PROFILE`.
CHANGED: tests/test_planning_pilot_routing.py — pin the scripted profile at import (`_PINNED_PROFILE`) and reset/restore `MODEL_CLIENT_FACTORY` in the `routed` fixture; both fixtures pass the pinned profile to `run_trial`.
CHANGED: tests/test_review_depth_walk.py — header records absorption of the probe as maintained pins of the fixed property (no test-body change).
VERIFIED: scripts/check-tests --fast — 950 passed, 45 deselected in 67.95s.
VERIFIED: pytest tests/test_phase2_general_target.py tests/test_planning_pilot_routing.py — 19 passed in 33.84s (REV: 2 failed / 17 passed).
VERIFIED: pytest tests/test_planning_pilot.py tests/test_review_depth_walk.py — 144 passed in 0.42s.
VERIFIED: pytest tests/test_phase3_project_oracle.py — 5 passed in 208.92s.
VERIFIED: scripts/check-static — exit 0 ("All checks passed!"; B/SIM advisory output does not gate).
VERIFIED: scripts/check-docs — exit 0 (table verification passed; 316 links OK, 0 errors).
VERIFIED: scripts/check-scope f74a9f0a8b236278f765496b80ec6a8238f9384b 6dc55f8927e03d771f98aec53b5e273af2b90968 docs/research/phase4-recursive-planning-integration-fixes-brief.md — scope: ok (6 paths).
VERIFIED (extra, not an ACCEPTANCE command): scripts/check-tests — 995 passed in 401.95s; the full-suite module ordering F5 names is green.
NOT VERIFIED: none.
FINDINGS:
  F1 | SEVERITY: P1 | ORIGIN: CODE | STATE: fixed
  `Controller._node_depth` filtered `to_node_id == current` and stepped to `from_node_id`, walking childward and returning the subtree height (a depth-2 leaf read 2, the root read 2); at proposal time the proposing parent reads 0, so `MAX_PROPOSAL_DEPTH` and the admission-time `maximum_depth` check never bound in production.
  FIXED: tests/test_review_depth_walk.py::test_a_depth_two_leaf_reads_depth_zero_and_the_root_reads_subtree_height (`assert Controller.node_depth(state, root) == 0` — was 2 == 0), ::test_the_pilot_depth_guard_never_refuses_a_node_at_depth_two (`assert payload is None` — full ADMITTED payload was returned), ::test_maximum_depth_run_limit_refuses_decomposition_past_the_limit (`pytest.raises(RunLimitExhausted)` DID NOT RAISE); all three green under `.venv/bin/python -m pytest tests/test_review_depth_walk.py` (3 passed). The controller walk now follows `from_node_id == current` to `to_node_id`, and the pilot's own hand-built fixtures were corrected to the production direction so they stop disagreeing with the authority.
  F5 | SEVERITY: P1 | ORIGIN: CODE | STATE: fixed
  tests/test_phase2_general_target.py's `finally` restored the profile by re-reading the delegated `experiment.MODEL_PROFILE` it had just overwritten, so the patch profile leaked past the module; tests/test_planning_pilot_routing.py read the leaked global at trial time (PatchModelClient with an empty default patch → "path field 'path' must contain non-empty strings" → trial abort with one DECOMPOSITION_ADMITTED instead of two).
  FIXED: tests/test_planning_pilot_routing.py::test_every_recursive_decomposition_routes_through_the_pilot[RECURSIVE_LAZY] and ::[RECURSIVE_CONCURRENT] (`assert len(events) == 2, "the fixed target nests exactly two levels"` — was 1 == 2); both green under `.venv/bin/python -m pytest tests/test_phase2_general_target.py tests/test_planning_pilot_routing.py` (19 passed; 2 failed / 17 passed at REV). The phase-2 `finally` blocks restore captured pre-mutation bindings, and the routing module pins its profile at import and resets/restores `MODEL_CLIENT_FACTORY`.
  F2 | SEVERITY: P2 | ORIGIN: BRIEF | STATE: carried
  The brief's No-mutation shape as written is unsatisfiable: the event's children carry `const parent_proposal` (and the controller's defaults), which the guard's return cannot (verified: tests/test_planning_pilot_routing.py:321-322 vs controller.py:742). The single consistent reading ("the driver forwards the producer payload without editing it; the dependency edges go through the dependencies argument") is implemented and pinned by the delivered test; the literal shape text stands as written in the frozen brief. Closeout: carried, not declined; the wording belongs to an OWNER/planner re-wording, and the next implementer brief at this seam inherits the pinning test and the divergence explanation.
  FIXED: no regression test — carried per R6; F2 changes no code in this step (the API-shape brief re-words the shape). `test_admitted_payload_is_forwarded_unmutated` is unchanged and still pins transit immutability.
  F3 | SEVERITY: P2 | ORIGIN: BRIEF | STATE: carried
  The implementer brief's acceptance note omits the slow-mark convention for new test modules under tests/, on which its own named oracle command's green depends (verified mechanically: pytest.ini's `slow` marker, `check-tests --fast` = `-m "not slow"`, the oracle's internal gate at src/orchestrator/project_oracle.py:731, the deselecting pre-commit hook, and measured-green constructive half on this host). Misfiled as METHOD FRICTION by the implementer; re-filed here as the brief defect it is. The counterfactual half (unmarked module breaks the oracle) is NOT VERIFIED — nested-oracle scratch unfaithful on this host.
  FIXED: no regression test — the convention is recorded in this brief's ACCEPTANCE note; carried because it is a brief-text defect of the prior step, not a code change.
  F4 | SEVERITY: P2 | ORIGIN: BRIEF | STATE: carried
  The implementer brief's `REV:` field names the pre-brief HEAD (1a4c0a7...) which cannot be this step's base (its brief commit consumes R2 in docs/record.md, so check-scope over that sha fails: "docs/record.md is in the diff and not in IN SCOPE"); the implementer's report propagated the field as its base claim — a claim not declared against its source, which stands (the work's actual base is 2b269fc, afc5316's parent). The next implementer brief's REV must name the revision the implementer builds on, and a copied verbatim field must at least be confirmed to name an ancestor-parent of the work's commit before it is claimed.
  FIXED: no regression test — carried per R6; this brief's REV (`f74a9f0...`, the step's base, with only the brief commit between it and FINAL) is correct, and `scripts/check-scope` over it is green.
SHAPES: none — the three absorbed depth shapes are built by tests/test_review_depth_walk.py (maintained pins) and the suite-context shape by the phase-2/routing pair; nothing probed by hand was left unbuilt.
TRIPPED: `PILOT-R2` (its "bounds admit exactly one recursive level" enrollment was measured-unenforced while F1 held; with the depth pins green it is measured-enforced again, and this row records the interval).
PROPOSED ROWS: none (the planner maintains docs/residuals.md; the absorbed pins need no open-defect registration per R5).
METHOD FRICTION: none — the brief named the files, the direction, and the two remedy surfaces; the only ordering wrinkle is that `check-scope` names FINAL, so it runs after the work commit and before this report commit, which the brief's own sequence implies.
INHERITED:
F2 | SEVERITY: P2 | ORIGIN: BRIEF | STATE: carried
  The brief's No-mutation shape as written is unsatisfiable: the event's children carry `const parent_proposal` (and the controller's defaults), which the guard's return cannot (verified: tests/test_planning_pilot_routing.py:321-322 vs controller.py:742). The single consistent reading ("the driver forwards the producer payload without editing it; the dependency edges go through the dependencies argument") is implemented and pinned by the delivered test; the literal shape text stands as written in the frozen brief. Closeout: carried, not declined; the wording belongs to an OWNER/planner re-wording, and the next implementer brief at this seam inherits the pinning test and the divergence explanation.

F3 | SEVERITY: P2 | ORIGIN: BRIEF | STATE: carried
  The implementer brief's acceptance note omits the slow-mark convention for new test modules under tests/, on which its own named oracle command's green depends (verified mechanically: pytest.ini's `slow` marker, `check-tests --fast` = `-m "not slow"`, the oracle's internal gate at src/orchestrator/project_oracle.py:731, the deselecting pre-commit hook, and measured-green constructive half on this host). Misfiled as METHOD FRICTION by the implementer; re-filed here as the brief defect it is. The counterfactual half (unmarked module breaks the oracle) is NOT VERIFIED — nested-oracle scratch unfaithful on this host.

F4 | SEVERITY: P2 | ORIGIN: BRIEF | STATE: carried
  The implementer brief's `REV:` field names the pre-brief HEAD (1a4c0a7...) which cannot be this step's base (its brief commit consumes R2 in docs/record.md, so check-scope over that sha fails: "docs/record.md is in the diff and not in IN SCOPE"); the implementer's report propagated the field as its base claim — a claim not declared against its source, which stands (the work's actual base is 2b269fc, afc5316's parent). The next implementer brief's REV must name the revision the implementer builds on, and a copied verbatim field must at least be confirmed to name an ancestor-parent of the work's commit before it is claimed.

R5's re-note on `PILOT-R2`: its "bounds admit exactly one recursive level" enrollment is measured-unenforced until F1 is fixed. F1 is fixed in this step; once the depth pins are green the enrollment is measured-enforced again, and the carried note records the interval.
