@@ -22,6 +22,8 @@ they stage the release fixture, start the fixture server, and sandbox
2222HOME/TEMP/agent-config destinations. Called bare, the download/checksum/
2323install-script phases (12-13) SKIP for lack of a fixture server, and the run
2424mutates the REAL profile — the venue-parity contract forbids that in any venue.
25+ The daemon runtime and cache are private to the run either way: every product
26+ process is started under a CBM_RUNTIME_DIR/CBM_CACHE_DIR this harness owns.
2527
2628Arguments:
2729 <binary-path> product binary to smoke
@@ -41,6 +43,20 @@ if [ -n "$SMOKE_MODE" ] && [ "$SMOKE_MODE" != "--agent-config-only" ]; then
4143fi
4244REPO_ROOT=" $( cd " $( dirname " ${BASH_SOURCE[0]:- $0 } " ) /.." && pwd) "
4345
46+ # Every product process below — the phases, the install/update E2E and the
47+ # daemon retirements — must reach a daemon rendezvous this run owns. Only
48+ # CBM_RUNTIME_DIR moves that rendezvous; the wrappers' HOME/TMPDIR/CBM_CACHE_DIR
49+ # sandbox does not, so without this the retirements land on the operator's live
50+ # account daemon (#1691, #1696).
51+ # shellcheck source=test-runtime.sh
52+ source " $REPO_ROOT /scripts/test-runtime.sh"
53+ cbm_test_runtime_init
54+ # Armed here rather than only with the fixture trap below: the fixture mktemp
55+ # and its cygpath conversion sit between the two, and under `set -e` a failure
56+ # there would otherwise leave the private root behind. The fixture trap
57+ # replaces this one and keeps the same cleanup as its first step.
58+ trap ' cbm_test_runtime_cleanup "$BINARY"' EXIT
59+
4460smoke_mktemp_file () {
4561 if [ -n " ${SMOKE_TEMP_ROOT:- } " ]; then
4662 mktemp " $SMOKE_TEMP_ROOT /cbm-smoke.XXXXXX"
@@ -100,8 +116,8 @@ copy_smoke_binary() {
100116 cp " $BINARY " " $destination "
101117}
102118
103- # Retire the shared account daemon (if one is running) and wait until it
104- # reports not-running. Install/uninstall flows leave an ephemeral daemon
119+ # Retire this run's private account daemon (if one is running) and wait until
120+ # it reports not-running. Install/uninstall flows leave an ephemeral daemon
105121# draining asynchronously whose mapped generation backing and open logs
106122# block rm on Windows (POSIX rm doesn't care) — so every cleanup of a
107123# fixture HOME that received an install, and the final cache removal, must
@@ -149,7 +165,11 @@ CODEX_LIFECYCLE_HOME=""
149165if command -v cygpath & > /dev/null; then
150166 TMPDIR=$( cygpath -m " $TMPDIR " )
151167fi
152- trap ' smoke_rmtree "$TMPDIR" "${DRYRUN_HOME:-}" "${CODEX_LIFECYCLE_HOME:-}"' EXIT
168+ # Runtime cleanup first, so no earlier cleanup step stands between the exit
169+ # and the private daemon's retirement; on Windows that retirement is also what
170+ # unblocks the fixture rm (mapped binary, open logs). smoke_rmtree never fails,
171+ # so the fixture removal still runs after it.
172+ trap ' cbm_test_runtime_cleanup "$BINARY"; smoke_rmtree "$TMPDIR" "${DRYRUN_HOME:-}" "${CODEX_LIFECYCLE_HOME:-}"' EXIT
153173
154174CLI_STDERR=$( smoke_mktemp_file)
155175# 10 of the cli call sites assign directly (VAR=$(cli ...)). Under
0 commit comments