From 649b90b586268409fe642797f34fda445e421ed5 Mon Sep 17 00:00:00 2001 From: autonomic-bot Date: Wed, 27 May 2026 06:16:54 +0100 Subject: [PATCH] launch.sh: resolve script to absolute path (SELF) so the watchdog re-invokes correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: start_watchdog used $0, which breaks when launch.sh is called by a relative path (the watchdog tmux session cd's into PLAN_DIR, so a relative $0 no longer resolves — "No such file or directory", watchdog dies instantly). Resolve BASH_SOURCE to an absolute SELF once and use it for the watchdog self-invocation. Verified: watchdog now starts and its handoff_check immediately pinged the Adversary about a standing CLAIMED gate. Co-Authored-By: Claude Opus 4.7 (1M context) --- cc-ci-plan/launch.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cc-ci-plan/launch.sh b/cc-ci-plan/launch.sh index 2cd14ca..0957b6a 100755 --- a/cc-ci-plan/launch.sh +++ b/cc-ci-plan/launch.sh @@ -23,6 +23,10 @@ set -euo pipefail +# Absolute path to this script, so the watchdog re-invokes it correctly regardless of how it +# was called or what cwd the tmux session uses (a relative $0 breaks once we cd into PLAN_DIR). +SELF="$(readlink -f "${BASH_SOURCE[0]}")" + # ----- config ------------------------------------------------------------- PLAN_DIR="${PLAN_DIR:-/srv/cc-ci/cc-ci-plan}" CLAUDE_BIN="${CLAUDE_BIN:-claude}" @@ -181,7 +185,7 @@ start_watchdog() { fi log "starting watchdog" tmux new-session -d -s "$WATCHDOG_SESSION" -c "$PLAN_DIR" \ - "exec >>'$LOG_DIR/watchdog.log' 2>&1; '$0' watchdog" + "exec >>'$LOG_DIR/watchdog.log' 2>&1; '$SELF' watchdog" } stop_loops() {