From aa8c71c87f56748292dcc70c5493ad795bbf892e Mon Sep 17 00:00:00 2001 From: elkaix Date: Tue, 11 Aug 2026 20:31:05 -0400 Subject: [PATCH] test: fabricate HOME in the prelaunch-interrupt lease case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit t48 launches the real implementer-loop to prove that an interrupt arriving before any companion job exists releases the lease instead of poisoning it. It did so without fabricating HOME, so what the loop found on disk depended on the host. On a developer machine the Codex companion is installed, workspace-writer enumeration returns an empty list, and the lease releases cleanly. On the CI runner no companion exists, that enumeration reports liveness unknown, and write_lock_release correctly refuses to release a lease it cannot prove quiescent — printing a message containing "lease retained", which the case greps for. The case failed on CI and passed everywhere it was authored. Give it the same fabricated HOME the rest of the suite uses: a fake companion at the canonical plugin path, a node forwarder built from REAL_NODE so the nvm shim is never invoked under the overridden HOME, and an empty status document. The git shim stays first on PATH so the digest window it opens is unaffected. All four assertions are unchanged. The interrupt path and the conservative retention in write_lock_release are both correct and untouched; only the test's environment was uncontrolled. Verified in both environments: 54 passed, 0 failed under an empty HOME (53/1 before this change) and under the developer HOME. --- tests/lease.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/lease.sh b/tests/lease.sh index e49bc47..da783fc 100755 --- a/tests/lease.sh +++ b/tests/lease.sh @@ -1211,14 +1211,23 @@ t47_unknown_lock_entry_is_not_deleted() ( # ---------------------------------------------------------------- review finding 4 t48_prelaunch_interrupt_releases_without_poison() ( - local repo shim marker output plan pid rc count real_git + local repo shim marker output plan pid rc count real_git t48_home node_shim companion status repo="$TEST_ROOT/prelaunch-interrupt-repo" shim="$TEST_ROOT/prelaunch-interrupt-shim" marker="$TEST_ROOT/prelaunch-interrupt.marker" output="$TEST_ROOT/prelaunch-interrupt.output" plan="$repo/plan.md" + t48_home="$TEST_ROOT/prelaunch-interrupt-home" + node_shim="$TEST_ROOT/prelaunch-interrupt-node-shim" + companion="$t48_home/.claude/plugins/cache/openai-codex/codex/test/scripts/codex-companion.mjs" + status="$TEST_ROOT/prelaunch-interrupt-status.json" real_git=$(command -v git) - mkdir -p "$repo" "$shim" || return 1 + mkdir -p "$repo" "$shim" "$node_shim" "$(dirname "$companion")" || return 1 + ln -sf "$FAKE" "$companion" || return 1 + printf '#!/usr/bin/env bash\nif [ "${1:-}" = "-e" ]; then exec %q "$@"; fi\nshift\nexec %q %q "$@"\n' \ + "$REAL_NODE" "$REAL_NODE" "$FAKE" > "$node_shim/node" || return 1 + chmod +x "$node_shim/node" || return 1 + status_empty > "$status" git init -q "$repo" || return 1 ( cd "$repo" || exit 1 @@ -1239,8 +1248,8 @@ t48_prelaunch_interrupt_releases_without_poison() ( set -m ( cd "$repo" && - exec env PATH="$shim:$PATH" MAESTRO_TEST_REAL_GIT="$real_git" \ - MAESTRO_TEST_DIGEST_MARKER="$marker" MAESTRO_LOCK_WAIT_SEC=0 \ + exec env HOME="$t48_home" PATH="$shim:$node_shim:$PATH" MAESTRO_TEST_REAL_GIT="$real_git" \ + MAESTRO_TEST_DIGEST_MARKER="$marker" MAESTRO_TEST_STATUS="$status" MAESTRO_LOCK_WAIT_SEC=0 \ bash "$LOOP" --plan "$plan" --verify true --max-iters 1 ) > "$output" 2>&1 3>&1 & pid=$!