@@ -68,6 +68,31 @@ smoke_file_sha256() {
6868 fi
6969}
7070
71+ # Fixture cleanup, never an assertion. On Windows a directory holding an
72+ # executable that was just written or just run can refuse deletion for a moment
73+ # while a scanner or an unreaped child still holds it. Under `set -e` a plain
74+ # `rm -rf` then kills the run WITHOUT printing anything — three release smoke
75+ # jobs died exactly that way, silently, immediately after "OK 13h".
76+ #
77+ # Retry so the disk actually gets reclaimed (these fixtures hold ~300 MB
78+ # binaries and runners are disk-tight), then warn and continue: an ephemeral
79+ # temp dir must never decide the verdict.
80+ smoke_rmtree () {
81+ local target
82+ for target in " $@ " ; do
83+ [ -n " $target " ] || continue
84+ local attempt
85+ for attempt in 1 2 3 4 5 6 7 8 9 10; do
86+ rm -rf " $target " 2> /dev/null && break
87+ sleep 0.5
88+ done
89+ if [ -e " $target " ]; then
90+ echo " warn: could not remove smoke fixture $target (leaving it to the runner)"
91+ fi
92+ done
93+ return 0
94+ }
95+
7196# Every platform ships ONE binary, Windows included: a fixture copy is complete
7297# with nothing beside it.
7398copy_smoke_binary () {
@@ -123,7 +148,7 @@ DRYRUN_HOME=""
123148if command -v cygpath & > /dev/null; then
124149 TMPDIR=$( cygpath -m " $TMPDIR " )
125150fi
126- trap ' rm -rf "$TMPDIR" "${DRYRUN_HOME:-}"' EXIT
151+ trap ' smoke_rmtree "$TMPDIR" "${DRYRUN_HOME:-}"' EXIT
127152
128153CLI_STDERR=$( smoke_mktemp_file)
129154cli () { " $BINARY " cli " $@ " 2> " $CLI_STDERR " ; }
@@ -970,7 +995,7 @@ chmod 755 "$INSTALL_DIR/codebase-memory-mcp"
970995INSTALLED_VER=$( " $INSTALL_DIR /codebase-memory-mcp" --version 2>&1 )
971996if ! echo " $INSTALLED_VER " | grep -qE ' v?[0-9]+\.[0-9]+|dev' ; then
972997 echo " FAIL: installed binary --version failed: $INSTALLED_VER "
973- rm -rf " $REPLACE_DIR "
998+ smoke_rmtree " $REPLACE_DIR "
974999 exit 1
9751000fi
9761001
@@ -986,7 +1011,7 @@ chmod 755 "$INSTALL_DIR/codebase-memory-mcp"
9861011REPLACED_VER=$( " $INSTALL_DIR /codebase-memory-mcp" --version 2>&1 )
9871012if ! echo " $REPLACED_VER " | grep -qE ' v?[0-9]+\.[0-9]+|dev' ; then
9881013 echo " FAIL: replaced binary --version failed: $REPLACED_VER "
989- rm -rf " $REPLACE_DIR "
1014+ smoke_rmtree " $REPLACE_DIR "
9901015 exit 1
9911016fi
9921017echo " OK: binary replacement succeeded (version: $REPLACED_VER )"
@@ -1000,12 +1025,12 @@ chmod 755 "$INSTALL_DIR/codebase-memory-mcp"
10001025READONLY_VER=$( " $INSTALL_DIR /codebase-memory-mcp" --version 2>&1 )
10011026if ! echo " $READONLY_VER " | grep -qE ' v?[0-9]+\.[0-9]+|dev' ; then
10021027 echo " FAIL: read-only replacement --version failed: $READONLY_VER "
1003- rm -rf " $REPLACE_DIR "
1028+ smoke_rmtree " $REPLACE_DIR "
10041029 exit 1
10051030fi
10061031echo " OK: read-only binary replacement succeeded"
10071032
1008- rm -rf " $REPLACE_DIR "
1033+ smoke_rmtree " $REPLACE_DIR "
10091034
10101035echo " "
10111036echo " === Phase 7: MCP advanced tool calls ==="
@@ -2671,7 +2696,7 @@ if ! echo "$INSTALL_OUT" | grep -qi 'detected agents'; then
26712696fi
26722697echo " OK 9b-1: install with minimal agents exits cleanly"
26732698retire_account_daemon " 9b-1-cleanup"
2674- rm -rf " $EMPTY_HOME "
2699+ smoke_rmtree " $EMPTY_HOME "
26752700
26762701# 9b-2: Install twice (idempotent)
26772702IDEM_HOME=$( smoke_mktemp_dir)
@@ -2695,7 +2720,7 @@ if [ "$COUNT" != "1" ]; then
26952720fi
26962721echo " OK 9b-2: double install is idempotent"
26972722retire_account_daemon " 9b-2-cleanup"
2698- rm -rf " $IDEM_HOME "
2723+ smoke_rmtree " $IDEM_HOME "
26992724
27002725# 9b-3: Uninstall without prior install
27012726CLEAN_HOME=$( smoke_mktemp_dir)
@@ -2708,7 +2733,7 @@ if [ "$UNINSTALL_RC" -ge 128 ]; then
27082733fi
27092734echo " OK 9b-3: uninstall without install doesn't crash"
27102735retire_account_daemon " 9b-3-cleanup"
2711- rm -rf " $CLEAN_HOME "
2736+ smoke_rmtree " $CLEAN_HOME "
27122737
27132738# 9b-4: Install over corrupt JSON
27142739CORRUPT_HOME=$( smoke_mktemp_dir)
@@ -2719,7 +2744,7 @@ run_no_crash 9b-4 env HOME="$CORRUPT_HOME" "$BINARY" install -y
27192744# Should either fix it or handle gracefully — not crash
27202745echo " OK 9b-4: install over corrupt JSON doesn't crash"
27212746retire_account_daemon " 9b-4-cleanup"
2722- rm -rf " $CORRUPT_HOME "
2747+ smoke_rmtree " $CORRUPT_HOME "
27232748
27242749# 9b-8: Double uninstall
27252750DBL_HOME=$( smoke_mktemp_dir)
@@ -2734,7 +2759,7 @@ run_no_crash 9b-8-first env HOME="$DBL_HOME" "$DBL_UNINSTALLER" uninstall -y -n
27342759run_no_crash 9b-8-second env HOME=" $DBL_HOME " " $BINARY " uninstall -y -n
27352760echo " OK 9b-8: double uninstall doesn't crash"
27362761retire_account_daemon " 9b-8-cleanup"
2737- rm -rf " $DBL_HOME "
2762+ smoke_rmtree " $DBL_HOME "
27382763
27392764# 9b-9: Non-interactive update without --standard/--ui should fail cleanly (not hang)
27402765if [ " $( uname -s) " != " MINGW64_NT" ] 2> /dev/null; then
@@ -2748,7 +2773,7 @@ if [ "$(uname -s)" != "MINGW64_NT" ] 2>/dev/null; then
27482773fi
27492774
27502775retire_account_daemon " 9-cleanup"
2751- rm -rf " $FAKE_HOME " " $EMPTY_HOME "
2776+ smoke_rmtree " $FAKE_HOME " " $EMPTY_HOME "
27522777
27532778if [ " $SMOKE_MODE " = " --agent-config-only" ]; then
27542779 echo " "
@@ -2848,7 +2873,7 @@ else
28482873 fi
28492874fi
28502875
2851- rm -rf " $SECURITY_DIR "
2876+ smoke_rmtree " $SECURITY_DIR "
28522877
28532878echo " "
28542879echo " === Phase 11: process kill E2E ==="
@@ -3063,7 +3088,7 @@ sys.exit(0)
30633088 exit 1
30643089 fi
30653090
3066- rm -rf " $UPDATE_HOME "
3091+ smoke_rmtree " $UPDATE_HOME "
30673092
30683093else
30693094 # Local mode: basic binary replacement test (no download)
@@ -3083,7 +3108,7 @@ else
30833108 exit 1
30843109 fi
30853110 echo " OK 14: binary replacement + verify (local mode)"
3086- rm -rf " $UPDATE_DIR "
3111+ smoke_rmtree " $UPDATE_DIR "
30873112fi
30883113
30893114# ── Phase 12 + 13: Download E2E + install script E2E (CI only) ──
@@ -3234,7 +3259,7 @@ else
32343259 echo " OK 12f: binary runs without signing ($DL_OS )"
32353260fi
32363261
3237- rm -rf " $DL_DIR "
3262+ smoke_rmtree " $DL_DIR "
32383263
32393264echo " "
32403265echo " === Phase 13: install script E2E ==="
@@ -3301,7 +3326,7 @@ if [ "$DL_OS" != "windows" ] && [ -f "$REPO_ROOT/install.sh" ]; then
33013326 echo " OK 13f: PATH setup (rc file may not have been modified if already present)"
33023327 fi
33033328
3304- rm -rf " $INSTALL_TEST_HOME " " $INSTALL_TEST_DIR "
3329+ smoke_rmtree " $INSTALL_TEST_HOME " " $INSTALL_TEST_DIR "
33053330
33063331elif [ -f " $REPO_ROOT /install.ps1" ] && command -v powershell.exe & > /dev/null; then
33073332 echo " --- Phase 13: install.ps1 E2E (Windows) ---"
@@ -3356,7 +3381,7 @@ elif [ -f "$REPO_ROOT/install.ps1" ] && command -v powershell.exe &>/dev/null; t
33563381 exit 1
33573382 fi
33583383
3359- rm -rf " $PS1_TEST_HOME " " $PS1_TEST_DIR "
3384+ smoke_rmtree " $PS1_TEST_HOME " " $PS1_TEST_DIR "
33603385else
33613386 echo " SKIP Phase 13: no install script available for this platform"
33623387fi
0 commit comments