<!-- informative -->

# Re-review 3: bounded recursive-planning pilot — admission guard

Revision reviewed: **`0791ff8`** (detached worktree `/tmp/kilo/pilot-rr3`), the fix
for [re-review 2](phase4-recursive-planning-pilot-re-review-2.md).
Verdict: **GO, confirmed.** R1 and R3 were real defects and are fixed; R4 and R5
are closed; R2 is recorded in the spec; R6 is acknowledged as a commit-message
artifact. No new safety issue.

Baseline on `0791ff8` (confirmed independently): **848 passed**;
`scripts/check-tests --fast` **818 passed, 30 deselected**; `scripts/check-docs`
rc 0; `scripts/check-static` rc 0; working tree clean.

## Residuals: verified closed

- **R1 — fixed.** `check_scope_containment` now takes the parent's scope *set* and
  requires a child to be inside *any* of them (`planning_pilot.py:85-112`), and
  `admit_proposal` passes the contract's full `declared_scopes`
  (`planning_pilot.py:312,338`). Probe: a parent owning
  `["src/alpha/**", "src/beta/**"]` admits a `src/beta/x.py` child and refuses a
  `src/gamma/x.py` child; a bare `**` in the set does not grant an escape. Tests
  pin both directions.
- **R3 — fixed, and the boundary is now pinned by number.** The overshooting
  `chain_depth=MAX_PROPOSAL_DEPTH` is corrected, and
  `test_the_exact_depth_boundary_is_pinned` asserts `depth == MAX_PROPOSAL_DEPTH`
  for the refused case and `MAX_PROPOSAL_DEPTH - 1` for the admitted one. Probe:
  controller depth 1 admitted, depth 2 refused, depth 3 refused.
- **R4 — fixed.** The empty-proposal check runs before the scope and budget
  derivation (`planning_pilot.py:298-301`), so an empty proposal against an
  unregistered parent budget reports "a proposal must declare at least one child"
  rather than the budget error. Pinned.
- **R5 — addressed.** `Controller.node_depth` is a public static method delegating
  to `_node_depth` (`controller.py:166-176`), and the guard calls the public form
  (`planning_pilot.py:227`). Probe: public == private == guard on a chain.
- **R2 — recorded, correctly.** The bare-`**` limitation and its reasoning are in
  the spec's residual section, alongside the multi-scope rule. The fixed target
  owns `src/**`, so it is unaffected.
- **R6 — acknowledged.** The "F11" reference in the previous commit message does
  not exist in either pilot review; the re-review response is the correction of
  record. Cosmetic.

## Earlier findings: still hold

F2/F3 (budget validation), F6 (deep copy), F8 (one shared containment rule, `..`/
empty/all-glob refused), F1 (single-layer containment, accepted and pinned),
F7/F10 (recorded). Guarantees 1, 3, 9, 10 re-verified; probe confirms sibling
escape, `..`, over-budget, and missing-state are all still refused.

## Advisory notes (non-blocking)

- **`parent_scope` is now assertion-only.** After R1, `admit_proposal` checks
  containment against the contract's full `declared_scopes`, and the
  `parent_scope` keyword is used only to require membership in that set. That is
  the correct bound (the parent's real territory is the contract), but a producer
  that passed a *narrower* scope expecting the guard to confine children to it
  will now find the guard admits anything inside any declared scope. Worth one
  line in the spec's derivation note so the producer does not read `parent_scope`
  as a restriction.
- **Dead duplicate check.** `admit_proposal` still has a second
  `if not proposed: raise ...` (`planning_pilot.py:335-336`) after the deep copy,
  now unreachable because the `if not children` check at line 298 fires first.
  Harmless; remove for clarity.
- **Process note acknowledged.** The heredoc-batching issue and the "a suite that
  passes is not evidence a boundary is covered" observation are accurate; R3 is
  the clean example (the off-by-one fix left the old test green one level out).
  Nothing further to verify in code.

## Verdict

**GO, confirmed.** The guard's bounds are derived from replayable state or the
tables, stated values are checked against the derived ones, the depth matches the
controller by construction and by a test that compares the two, and containment
handles a parent's several scopes. The producer may land on this guard; F1 stays
the accepted single-layer decision, with F7 and F10 recorded.

## Reproduce

```
git worktree add --detach /tmp/kilo/pilot-rr3 0791ff8

PYTHONPATH=/tmp/kilo/pilot-rr3/src <venv>/python /tmp/kilo/pilot-probes/rr3_probe.py   # R1, R3, R4, R5 + regressions

.venv/bin/python -m pytest -q                          # 848 passed
.venv/bin/python -m pytest -q tests/test_planning_pilot.py
scripts/check-docs ; scripts/check-static ; scripts/check-tests --fast
```

## Implementer's response (2026-09-30)

**GO** confirmed. Both notes cleared. **849 passed**; `scripts/check`,
`scripts/check-static` and `scripts/check-docs` all rc 0 (251 links).

**The dead `if not proposed` branch is removed.** It became unreachable when R4
moved the empty-proposal check ahead of the scope and budget derivation, so the
guard carried two checks for one condition. The earlier one stays; the later one
goes.

**`parent_scope` is documented as an assertion, not a restriction.** The review is
right that it would be easy to misread. Containment has always used the contract's
full scope set — `check_scope_containment` receives `declared_scopes` — so the
argument narrows nothing; it exists so a caller can state which region it believes
it is subdividing and be refused if the contract disagrees. The spec now says that
explicitly, and a pin asserts the consequence: a producer may omit it entirely and
a multi-scope parent still admits a child into its second declared region.

Worth noting the shape of this note. Both residuals were found by reading the code
rather than by testing it — one unreachable branch and one argument that does less
than its name suggests. Neither is a defect, and neither would have failed a test.
That is the same lesson as R3 in the previous round, where a test stayed green
while asserting a boundary one level out of position: a passing suite is evidence
about behaviour, not about whether the code says what it means.
