Skip to content

Commit 74671f7

Browse files
committed
Pin rlcr-stop-gate project root at every wrapper testsite
tests/test-stop-hook-bg-allow.sh invokes rlcr-stop-gate.sh at four spots (AC-9, AC-10c, AC-22, AC-22b). The wrapper resolves its project root as `${CLAUDE_PROJECT_DIR:-$(pwd)}`, giving the env var precedence over `cd`. When the outer runner exports CLAUDE_PROJECT_DIR (the normal case in hosted environments), those four tests were inspecting the outer repo instead of their per-test fixtures, falling through with "ALLOW: stop gate passed." and causing the suite to go red inside tests/run-all-tests.sh. Reproduced directly: CLAUDE_PROJECT_DIR=/tmp/outer-unrelated \ bash tests/test-stop-hook-bg-allow.sh ... FAIL: AC-10c FAIL: AC-22 Fix: pass `--project-root "$FIXTURE_REPO"` at every wrapper call site. The wrapper priority order is explicit flag > CLAUDE_PROJECT_DIR env > cwd, so the gate now pins deterministically to each fixture regardless of inherited environment. No product-code change. Validation: - bash tests/test-stop-hook-bg-allow.sh -> 39 passed, 0 failed - bash tests/run-all-tests.sh -> 1718 passed, 0 failed - CLAUDE_PROJECT_DIR=/tmp/outer-unrelated bash tests/test-stop-hook-bg-allow.sh -> 39 passed, 0 failed - HOME=/nonexistent/readonly bash tests/test-stop-hook-bg-allow.sh -> 39 passed, 0 failed - TZ=America/Los_Angeles bash tests/test-stop-hook-bg-allow.sh -> 39 passed, 0 failed - TZ=Asia/Tokyo bash tests/test-stop-hook-bg-allow.sh -> 39 passed, 0 failed systemMessage wording unchanged. Version stays at 1.16.0.
1 parent 9c80698 commit 74671f7

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

tests/test-stop-hook-bg-allow.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,12 @@ AC9_RESULT=$(emit_async_agent_launch_result "toolu_G" "agent_pending_G")
476476
write_transcript "$AC9_TRANSCRIPT" "$AC9_LAUNCH" "$AC9_RESULT"
477477

478478
AC9_OUT="$AC9_REPO/gate-out.txt"
479+
# Pass --project-root explicitly so an inherited CLAUDE_PROJECT_DIR
480+
# from the outer runner cannot redirect the gate to the outer repo.
479481
set +e
480482
(
481483
cd "$AC9_REPO"
482-
"$GATE_SCRIPT" --transcript-path "$AC9_TRANSCRIPT"
484+
"$GATE_SCRIPT" --project-root "$AC9_REPO" --transcript-path "$AC9_TRANSCRIPT"
483485
) > "$AC9_OUT" 2>&1
484486
AC9_EXIT=$?
485487
set -e
@@ -561,7 +563,9 @@ AC10C_OUT="$TEST_DIR/ac10c-out.txt"
561563
set +e
562564
(
563565
cd "$AC10C_REPO"
564-
HOME="$FAKE_HOME" "$GATE_SCRIPT" --transcript-path "$AC10C_TILDE_PATH"
566+
HOME="$FAKE_HOME" "$GATE_SCRIPT" \
567+
--project-root "$AC10C_REPO" \
568+
--transcript-path "$AC10C_TILDE_PATH"
565569
) > "$AC10C_OUT" 2>&1
566570
AC10C_EXIT=$?
567571
set -e
@@ -1307,7 +1311,7 @@ AC22_OUT="$TEST_DIR/ac22-out.txt"
13071311
set +e
13081312
(
13091313
cd "$AC22_REPO"
1310-
"$GATE_SCRIPT" --transcript-path "$AC22_TRANSCRIPT"
1314+
"$GATE_SCRIPT" --project-root "$AC22_REPO" --transcript-path "$AC22_TRANSCRIPT"
13111315
) > "$AC22_OUT" 2>&1
13121316
AC22_EXIT=$?
13131317
set -e
@@ -1362,7 +1366,7 @@ AC22B_OUT="$TEST_DIR/ac22b-out.txt"
13621366
set +e
13631367
(
13641368
cd "$AC22B_REPO"
1365-
"$GATE_SCRIPT"
1369+
"$GATE_SCRIPT" --project-root "$AC22B_REPO"
13661370
) > "$AC22B_OUT" 2>&1
13671371
AC22B_EXIT=$?
13681372
set -e

0 commit comments

Comments
 (0)