diff --git a/packages/mosaic/framework/tools/fleet/test-start-agent-session.sh b/packages/mosaic/framework/tools/fleet/test-start-agent-session.sh index df73747..11a4c3f 100755 --- a/packages/mosaic/framework/tools/fleet/test-start-agent-session.sh +++ b/packages/mosaic/framework/tools/fleet/test-start-agent-session.sh @@ -50,8 +50,10 @@ grep -qF 'already running' /tmp/mosaic-start-agent-idempotent.out || fail "dupli # - Intercepts 'new-session' calls and records its arguments to a file. # - For 'has-session' calls, exits 1 (session does not exist) so the script # proceeds to launch instead of printing "already running". -# - For 'list-panes' calls, returns a synthetic PID so the heartbeat sidecar -# path is exercised without needing a real tmux session. +# - For 'list-panes' calls, returns empty so PANE_PID stays unset and the +# heartbeat sidecar is NOT spawned (heartbeat is not the focus of this test; +# test 6 and 7 cover that path). This prevents any real-filesystem side +# effects or leaked background processes. # - For all other subcommands, exits 0. # # Assertions: @@ -62,7 +64,8 @@ grep -qF 'already running' /tmp/mosaic-start-agent-idempotent.out || fail "dupli FAKE_BIN=$(mktemp -d) FAKE_RUNTIME_BIN=$(mktemp -d) TMUX_ARGS_FILE=$(mktemp) -CLEANUP_DIRS+=("$FAKE_BIN" "$FAKE_RUNTIME_BIN") +HB_RUN_DIR3=$(mktemp -d) +CLEANUP_DIRS+=("$FAKE_BIN" "$FAKE_RUNTIME_BIN" "$HB_RUN_DIR3") # Write the fake tmux shim (uses only positional args, no sourced vars). cat > "$FAKE_BIN/tmux" </dev/null || true) @@ -118,7 +123,8 @@ echo "$all_args" | grep -qF "mosaic yolo pi --model openai-codex/gpt-5.5:high" | # ── Test 4: when no extra runtime-bin dirs exist, exec still appears ─────────── TMUX_ARGS_FILE2=$(mktemp) FAKE_BIN2=$(mktemp -d) -CLEANUP_DIRS+=("$FAKE_BIN2") +HB_RUN_DIR4=$(mktemp -d) +CLEANUP_DIRS+=("$FAKE_BIN2" "$HB_RUN_DIR4") cat > "$FAKE_BIN2/tmux" </dev/null || true) @@ -171,7 +179,8 @@ echo "$all_args4" | grep -qF "mosaic yolo pi" || fail "pane command does not inc TMUX_ARGS_FILE5=$(mktemp) FAKE_BIN5=$(mktemp -d) FAKE_RUNTIME_BIN5=$(mktemp -d) # this dir IS on the launcher's PATH below -CLEANUP_DIRS+=("$FAKE_BIN5" "$FAKE_RUNTIME_BIN5") +HB_RUN_DIR5=$(mktemp -d) +CLEANUP_DIRS+=("$FAKE_BIN5" "$FAKE_RUNTIME_BIN5" "$HB_RUN_DIR5") cat > "$FAKE_BIN5/tmux" </dev/null || true)