# Code Review Report — Job `a9de9b22` - **Reviewer**: cline (session: `herdr:reviewer-cline-01`) - **Subject**: Layout engine improvement plan (Rev.2) + cumulative `git diff` - **Changeset**: 2 modified shell scripts + 1 new report (untracked) - `M .agents/skills/multi-agent-mux-resume/scripts/resolve_session_id.sh` - `M .agents/skills/multi-agent-mux-resume/scripts/resume_session.sh` - `?? .agents/reports/layout_engine_improvement_plan.md` (387 lines) - **Date**: 2026-08-26 --- ## 1. Scope The brief's stated work goal is the **layout engine improvement plan** (analyze Herdr skew, produce `.agents/reports/layout_engine_improvement_plan.md`). The cumulative `git diff` is a **mixed changeset**: the plan report (the deliverable) **plus** two `grok` agent-allowlist additions in the resume skill — a separate concern. Both are reviewed below per the brief's "누적 변경분(git diff)" instruction. Note: the plan is a **forward-looking spec**; it does **not** modify `layout.py`/`lib.sh` in this changeset (those are future W1–W8 tasks). The only **runtime** behavior change in this diff is the `grok` allowlist. ## 2. Layout Plan — Verification Against Actual Code The plan's high-stakes technical claims were checked against the live source: | Claim | Source location | Verified | |---|---|---| | Headless uses `n % 2` parity | `layout.py:115` `if n % 2 == 1:` → `headless_odd_down` (:120); even → `headless_even_right` (:125) | ✅ | | `lib.sh` does **not** pass `--max-cols` | `lib.sh:435` pipes `--min-cols … --min-rows … --sample-pane …` only; no `--max-cols` | ✅ | | `--max-cols` default returns `None` when env unset | `layout.py:203` `default=_env_int("MAM_MAX_COLS","MAM_MAX_PANE_COLS")` — no `default=` arg → `_env_int` returns `None` | ✅ | | "Double omission" makes signature-only fix inert in production | env unset + no flag ⇒ `max_columns=None` ⇒ no cap, regardless of signature default | ✅ Accurate | | `.mam.env.example` self-inconsistent | `:147` `#default: (unset -> no column cap)` vs `:148` `# MAM_MAX_PANE_COLS=3`; no `MAM_MAX_PANE_ROWS` anywhere | ✅ | | Existing tests fix the old contract | `test_layout.py:145` N=1→down; `:400` n=2→right; `:414` n=4 unlimited→right | ✅ | | `fill_singleton_column` checks `len(col)==1` | `layout.py:150` `if len(col) == 1:` → `fill_singleton_column` (:159) | ✅ | **Assessment**: The plan's central alarm — that wiring `max_columns` only via the signature default would pass tests but be **silently inert in production** (because `lib.sh` never passes `--max-cols` and `_env_int` yields `None`) — is **technically correct** and is the most valuable finding in the document. The proposed remedy (`lib.sh:435` explicitly pass `--max-cols`/`--max-rows` with `:-2` shell defaults + add `MAM_MAX_PANE_ROWS=2`) is the right fix. The single-decision-table design (§2), the trajectory correction (§3, n=4 stops at 2×2), and the parity-rejection rationale (§1) are internally consistent and actionable (Creator sign-off §13). Three objections sustained + three self-corrections (C-3/C-4/C-5) is a sound revision record. As a **report** deliverable, "lint" is N/A; **operability** (actionable/correct) ✅; **loss** — minor, see §5. ## 3. `grok` Allowlist Changes — Verification - `resolve_session_id.sh:39` adds `grok` to the `case`; error message `:40` updated to list grok. ✅ - `resume_session.sh:45` adds `grok` to the `case` (error `:46` is generic). ✅ - **Coherence**: `resume_session.sh:112` **already** had a `grok)` fallback (`--resume $UUID --permission-mode bypassPermissions`) before this diff — but the top-level validation `:45` rejected `grok`, so that path was **dead/unreachable**. This diff closes the gap: validation now matches the pre-existing downstream support. `grok` is a registered first-class adapter (`lib_py/agents/registry.py:16` `GrokAgentAdapter`), so resolution/resume are grok-aware end-to-end. - **Consistency**: brings the resume skill in line with peer skills (`create_session.sh:93`, `stop_session.sh:97`, `orc_onboard.sh:107` already accept grok). The resume skill was the last holdout. - `bash -n`: both scripts pass. ## 4. Test Results | Suite | Result | |---|---| | `bash -n` resolve_session_id.sh / resume_session.sh | OK | | `pytest tests/test_layout.py -q` | **26 passed** (unaffected — diff doesn't touch `layout.py`) | | `pytest tests/test_tier1_unit.py -q -k 'resume or grok or agent or find_workspace'` | **13 passed**, 48 deselected | | `pytest tests/test_tier2_component.py -q -k 'resume'` | **8 passed**, 32 deselected | No regressions from the `grok` additions; no test asserts the old grok-rejecting behavior. ## 5. Findings (non-blocking) - **F1 — Mixed/unrelated changeset (scope hygiene)**: the `grok` allowlist changes belong to the agent-onboarding concern, not the layout-engine task. Bundling them with the plan report muddies attribution. Observation only (the brief explicitly includes the cumulative diff, so both are reviewed). - **F2 — Stale usage docstrings (cosmetic)**: `resolve_session_id.sh:4,16` and `resume_session.sh:12` still advertise `--agent ` without `grok`, while the `case` now accepts grok. `--help` understates accepted agents. Pre-existing repo-wide pattern (create/stop share it), but the diff touched these files and could have aligned the docstrings in the same touch. Non-blocking. - **F3 — Minor clarity in plan §1**: the §1 table's "홀짝 반전 결과" column models the *hypothetical literal-reversal* implementation (n=1→right…), whereas the actual current code is the *non-reversed* parity (`odd→down / even→right`). Both are parity-based and both diverge from Rev.2's right-first trajectory, so the thesis holds; §1 lines 45–52 correctly state the *real* current test assertions. A reader skimming only the table could momentarily mis-map it to the current code. Cosmetic. - **F4 — Plan is spec-only this pass**: no `layout.py`/`lib.sh` mutation occurred in this changeset, so the "implementation" reviewed here is a plan + a small agent-allowlist fix — not the layout rework itself. Worth stating to set expectations for the next (W1–W8) implementation pass. ## 6. Verdict The layout plan is technically sound and its pivotal claim (production-inert `max_columns` wiring) is verified against live code; the `grok` allowlist changes are correct, coherent, and tested green. Findings are cosmetic/scope-only and non-blocking. No redesign-level rework is required. [VERDICT: PASS]