From f8ba1e1f54929622598994f2829d2e428391fa24 Mon Sep 17 00:00:00 2001 From: Claude Code Bot Date: Mon, 23 Nov 2026 15:43:44 -0800 Subject: [PATCH] fix(swm-macos-runner): part 1 review follow-ups Ignore a non-numeric id= in the slot state file so it never reaches a request URL. Document the IP bound and the hash-copy pointer in config.sh. TERM-before-KILL for the build is deferred: teardown already uses the 300 s ExitTimeOut. Advances #294 --- scripts/swm-macos-runner/config.sh | 4 +++- scripts/swm-macos-runner/supervisor.sh | 8 +++++++- scripts/swm-macos-runner/tests/test-supervisor.sh | 8 ++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/scripts/swm-macos-runner/config.sh b/scripts/swm-macos-runner/config.sh index 7f4f8ca..bdeb56d 100755 --- a/scripts/swm-macos-runner/config.sh +++ b/scripts/swm-macos-runner/config.sh @@ -19,6 +19,8 @@ export TART_HOME # Per-call limits in seconds for the tart commands. : "${SWM_CLONE_LIMIT_S:=600}" : "${SWM_RUN_LIMIT_S:=30}" +# The supervisor bounds the ip call at SWM_IP_LIMIT_S + 10 (190 s), above 180 on purpose: +# tart ip --wait gets the full limit to give up first. : "${SWM_IP_LIMIT_S:=180}" : "${SWM_EXEC_LIMIT_S:=60}" : "${SWM_STOP_LIMIT_S:=60}" @@ -58,7 +60,7 @@ _swm_sha256() { if command -v "${SHA256SUM_BIN}" >/dev/null 2>&1; then "${SHA256SUM_BIN}" "$@"; else "${SHASUM_BIN}" -a 256 "$@"; fi } -# _swm_image_hash DIR: 12 hex over file digests plus the base digest (as NOS _nos_image_hash). +# _swm_image_hash DIR: 12 hex over file digests plus the base digest (copy of _nos_image_hash, nos-runner/config.sh; change both). _swm_image_hash() { local files f d list="" files="$(cd "$1" && find . -type f)" || return 1 diff --git a/scripts/swm-macos-runner/supervisor.sh b/scripts/swm-macos-runner/supervisor.sh index 081784f..74cfd98 100755 --- a/scripts/swm-macos-runner/supervisor.sh +++ b/scripts/swm-macos-runner/supervisor.sh @@ -78,7 +78,13 @@ slot_load() { while IFS='=' read -r k v; do case "${k}" in name) SL_NAME="${v}" ;; - id) SL_ID="${v}" ;; + id) + if [[ -z "${v}" || "${v}" =~ ^[0-9]+$ ]]; then + SL_ID="${v}" + else + log "ignoring non-numeric runner id '${v}' in ${SLOT_FILE}" + fi + ;; fails) [[ "${v}" =~ ^[0-9]+$ ]] && SL_FAILS="${v}" ;; alert) SL_ALERT="${v}" ;; job) SL_JOB="${v:-0}" ;; diff --git a/scripts/swm-macos-runner/tests/test-supervisor.sh b/scripts/swm-macos-runner/tests/test-supervisor.sh index 9afb5c3..48e708e 100755 --- a/scripts/swm-macos-runner/tests/test-supervisor.sh +++ b/scripts/swm-macos-runner/tests/test-supervisor.sh @@ -322,6 +322,14 @@ check_is "orphan: no clone while id= is still registered" 0 "$(clones)" check_is "orphan: id= kept for retry" 999 "$(slot id)" check_is "orphan: fails=1" 1 "$(slot fails)" +echo "-- a non-numeric id= in the state file is never put in a URL" +reset +mkdir -p "${S}/state" +printf 'name=\nid=../x\nfails=0\nalert=\njob=0\n' >"${S}/state/slot" +sup once +check_not "bad id: no request URL contains ../x" grep -qF -- '../x' "${S}/requests.log" +check "bad id: log names the bad id" grep -qF -- '../x' "${S}/sup.err" + echo "-- pf ok stale -> no mint, one pf alert" reset touch -t 200001010000 "${S}/pf.ok"