From 883c0f12549ca814ad01c5c90ee1d23f1f53ba26 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Tue, 2 Jun 2026 04:10:39 +0200 Subject: [PATCH] fix(mac): scope restart log by worktree --- scripts/restart-mac.sh | 2 +- test/scripts/restart-mac.test.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/restart-mac.sh b/scripts/restart-mac.sh index e9cf0cca92a6..2ca4ca536e1e 100755 --- a/scripts/restart-mac.sh +++ b/scripts/restart-mac.sh @@ -15,7 +15,7 @@ LOCK_KEY="$(printf '%s' "${ROOT_DIR}" | shasum -a 256 | cut -c1-8)" LOCK_DIR="${TMPDIR:-/tmp}/openclaw-restart-${LOCK_KEY}" LOCK_PID_FILE="${LOCK_DIR}/pid" WAIT_FOR_LOCK=0 -LOG_PATH="${OPENCLAW_RESTART_LOG:-/tmp/openclaw-restart.log}" +LOG_PATH="${OPENCLAW_RESTART_LOG:-${TMPDIR:-/tmp}/openclaw-restart-${LOCK_KEY}.log}" NO_SIGN=0 SIGN=0 AUTO_DETECT_SIGNING=1 diff --git a/test/scripts/restart-mac.test.ts b/test/scripts/restart-mac.test.ts index 45e421fe6c2e..6b38b1ac91cc 100644 --- a/test/scripts/restart-mac.test.ts +++ b/test/scripts/restart-mac.test.ts @@ -74,6 +74,15 @@ describe("scripts/restart-mac.sh", () => { expect(script).not.toContain("lsof -iTCP:${GATEWAY_PORT} -sTCP:LISTEN | head -n 5 || true"); }); + it("keeps the default restart log scoped to the current worktree lock", () => { + const script = readFileSync(restartScriptPath, "utf8"); + + expect(script).toContain( + 'LOG_PATH="${OPENCLAW_RESTART_LOG:-${TMPDIR:-/tmp}/openclaw-restart-${LOCK_KEY}.log}"', + ); + expect(script).not.toContain('LOG_PATH="${OPENCLAW_RESTART_LOG:-/tmp/openclaw-restart.log}"'); + }); + it("prefers the freshly packaged app unless an explicit app bundle is set", () => { const script = readFileSync(restartScriptPath, "utf8"); const chooseBlock = script.slice(