launch.sh: resolve script to absolute path (SELF) so the watchdog re-invokes correctly
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) <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,10 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
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 -------------------------------------------------------------
|
# ----- config -------------------------------------------------------------
|
||||||
PLAN_DIR="${PLAN_DIR:-/srv/cc-ci/cc-ci-plan}"
|
PLAN_DIR="${PLAN_DIR:-/srv/cc-ci/cc-ci-plan}"
|
||||||
CLAUDE_BIN="${CLAUDE_BIN:-claude}"
|
CLAUDE_BIN="${CLAUDE_BIN:-claude}"
|
||||||
@@ -181,7 +185,7 @@ start_watchdog() {
|
|||||||
fi
|
fi
|
||||||
log "starting watchdog"
|
log "starting watchdog"
|
||||||
tmux new-session -d -s "$WATCHDOG_SESSION" -c "$PLAN_DIR" \
|
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() {
|
stop_loops() {
|
||||||
|
|||||||
Reference in New Issue
Block a user