test(loop-lock): the b13 runs of the checkout's run_loop.sh take a loop lock of their own

test_b13_reexec_preserves_original_argv and test_b13_no_freeze_switch_
disables_reexec ran the checkout's run_loop.sh with --creator, which gets
past argument parsing to mam_acquire_loop_lock on the default marker,
$MAM_REAL_ROOT/.mam/loop-guard-active with MAM_REAL_ROOT = the script's own
checkout. In the main checkout that is the live loop's lock (taken and
released for a moment: a real loop refused, or the test refused); in a review
tree it left an empty .mam. Both now set MAM_LOOP_MARKER under their tmp_path.

A sweep of the 16 modules that use run_loop.sh (a per-test watcher for a new
.mam in the checkout, an empty .mam removed before each test) found only
these two; the others pin MAM_LOOP_MARKER already, end before the lock
(--help, argument errors), or run a copy of the tree.

Tests: test_loop_marker_isolation.py L1 runs every test that reaches the lock
through the checkout's run_loop.sh in a copy of the checkout and requires no
.mam there; W1 of the Issue #17 isolation test now also requires that no .mam
exists (it only looked for files, so the empty lock directory passed it). At
97c2946 both fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCGpJXhSZasJLU38ksDghe
This commit is contained in:
GodopuandClaude Opus 5.5 committed 2026-10-09 09:01:34 +09:00
1 parent 97c2946ee0
commit a93c9bf292
3 files changed
+55

No files matched your search

+4
View File
@@ -382,10 +382,13 @@ def test_b13_reexec_preserves_original_argv(tmp_path):
The arg parser consumes "$@" (shift), so capturing argv beforehand is mandatory.
"""
run_loop_sh = REPO_ROOT / ".agents" / "skills" / "multi-agent-mux-loop" / "scripts" / "run_loop.sh"
# The run reaches the loop lock: a marker of this test's own, never the
# checkout's .mam/loop-guard-active (the live loop's, in the main checkout).
res = subprocess.run(
["bash", str(run_loop_sh), "--creator", "nonexistent-agent", "--task", "test goal with spaces"],
capture_output=True,
text=True,
env=dict(os.environ, MAM_LOOP_MARKER=str(tmp_path / "loop-guard-active")),
cwd=str(REPO_ROOT),
)
combined = res.stdout + res.stderr
@@ -464,6 +467,7 @@ def test_b13_no_freeze_switch_disables_reexec(tmp_path):
run_loop_sh = REPO_ROOT / ".agents" / "skills" / "multi-agent-mux-loop" / "scripts" / "run_loop.sh"
env = os.environ.copy()
env["MAM_LOOP_NO_FREEZE"] = "1"
env["MAM_LOOP_MARKER"] = str(tmp_path / "loop-guard-active") # not the checkout's loop lock
res = subprocess.run(
["bash", str(run_loop_sh), "--creator", "nonexistent-agent", "--task", "test goal"],
capture_output=True,