Review loop (--review-only, --all-reviewer): round 1 (@3a30d7d) 4/4 PASS; each reviewer reproduced W1 failing on the pre-fix tree. Seven #50/#55 and leak modules (112 tests) from a clean worktree left no .mam in the checkout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCgu9Fa9iT7TbJUSzdq4Ff
6.9 KiB
Code Review Report: fix/u1e-workspace-root (Test Isolation Fix for test_u1e)
- Job ID:
4be97273 - Reviewer:
agy(Session:herdr:reviewer-agy-01, Role:Reviewer) - Date: 2026-10-13
- Target Branch:
fix/u1e-workspace-root - Base Commit:
42e2a7ea9bd3e2770ed8626d789193428ca3aa8b - Head Commit:
3a30d7da894cdac26b7ec054b4e66fe9fa3dc8db - Verification Path:
/var/folders/q_/68sxgw3j073dgjg8wl9s08vw0000gn/T/mam-review/loop-20261013T025803Z-c69408/1 - Verification Environment: macOS (Darwin 24.3.0, arm64), Python 3.9.6, pytest-8.4.2
1. Executive Summary
This review evaluated commit 3a30d7da894cdac26b7ec054b4e66fe9fa3dc8db, which fixes a test workspace isolation leak discovered during earlier review runs in tests/test_issue50_dispatch.py::test_u1e_a_dry_run_record_is_not_an_open_job and adds regression coverage to tests/test_issue17_workspace_root_isolation.py.
The root cause was confirmed, the fix was verified both positively and negatively (reproducing failure on base, success on head), and an exhaustive audit across tests/ confirmed no other tests suffer from this defect.
Verdict: PASS.
2. Root Cause Analysis
In tests/test_issue50_dispatch.py, test_u1e_a_dry_run_record_is_not_an_open_job invokes subprocess.run on WRAPPER (multi-agent-mux-delegate-job).
WRAPPERsources.agents/skills/lib.sh.- In
lib.sh:26, ifWORKSPACE_ROOTis unset in the execution environment, it defaults to:which points to the repository checkout root.WORKSPACE_ROOT="${WORKSPACE_ROOT:-$(cd "$SKILL_DIR/../.." && pwd)}" - In
lib.sh:149-155andlib.sh:3168,_init_herdr_isolationautomatically creates and populates$WORKSPACE_ROOT/.mam/shim/herdr. - Because
u1epreviously created a customenvcontainingHOMEandMAM_ENV_FILEbut omittedWORKSPACE_ROOT, executingu1ewrote directly into<checkout>/.mam/shim/herdr.
3. Verification of Fix & Regression Coverage
3.1 The Fix
In tests/test_issue50_dispatch.py:169-170, WORKSPACE_ROOT=str(tmp_path) was added to env:
env = dict(os.environ, HOME=str(tmp_path), MAM_ENV_FILE=str(tmp_path / ".mam.env.absent"),
WORKSPACE_ROOT=str(tmp_path))
This guarantees that any .mam/shim creation is strictly contained within tmp_path.
In tests/test_issue17_workspace_root_isolation.py:43, "tests/test_issue50_dispatch.py::test_u1e_a_dry_run_record_is_not_an_open_job" was appended to NODES. Test W1 copies the checkout into a temporary sandbox and executes every node in NODES, asserting that no .mam directory is created in the copy.
3.2 Negative Reproduction (Pre-fix Validation)
In an isolated temporary clone checked out at base commit 42e2a7ea9bd3e2770ed8626d789193428ca3aa8b, u1e was added to NODES before the fix. Running W1 failed immediately with:
AssertionError: tests wrote into the checkout they ran in: ['.mam/shim', '.mam/shim/herdr']
assert ['.mam/shim',...m/shim/herdr'] == []
FAILED tests/test_issue17_workspace_root_isolation.py::test_w1_no_test_writes_into_the_checkout_it_runs_in
This confirms that W1 effectively catches the defect.
3.3 Positive Execution (Post-fix Validation)
Ran tests/test_issue17_workspace_root_isolation.py in the verification directory with sanitized environment and isolated --basetemp:
tests/test_issue17_workspace_root_isolation.py .. [100%]
============================== 2 passed in 30.47s ==============================
Verified that no .mam was created in the verification tree (ls: .mam: No such file or directory, git status clean).
4. Codebase Audit for Similar Invocations
An automated search across all test modules in tests/ identified all other locations where WRAPPER or lib.sh are invoked:
test_issue14_delivery_ack.py:_base_envexplicitly setsenv["WORKSPACE_ROOT"] = str(cwd).test_issue17_item4_decisions.py:_envexplicitly setsWORKSPACE_ROOT=str(tmp_path).test_issue18_liveness_contract.py:_envexplicitly setsenv["WORKSPACE_ROOT"] = str(cwd).test_issue26_envfile.py:_envexplicitly sets"WORKSPACE_ROOT": str(home).test_issue26_ints.py:_base_envexplicitly sets"WORKSPACE_ROOT": str(home).test_issue33_budget.py:_envexplicitly setsenv["WORKSPACE_ROOT"] = str(home).test_issue50_dispatch_herdr.py:Box.envexplicitly setsWORKSPACE_ROOT=str(self.ctl).test_issue6_turn_handshake.py:_run_lib_shand_run_wrapperexplicitly setrun_env["WORKSPACE_ROOT"] = str(cwd).- Modules using
mam_sandboxorown_workspace_rootfixtures: correctly receive isolatedWORKSPACE_ROOT.
No other un-isolated invocations exist in the test suite.
[VERDICT: PASS]