diff --git a/scripts/deploy/restart-toolkit-socket.sh b/scripts/deploy/restart-toolkit-socket.sh index 32de296..5c424ad 100755 --- a/scripts/deploy/restart-toolkit-socket.sh +++ b/scripts/deploy/restart-toolkit-socket.sh @@ -91,7 +91,22 @@ if ! kill -0 "$socket_pid" 2>/dev/null; then fi if command -v curl >/dev/null 2>&1; then - curl -fsS "http://127.0.0.1:$socket_port/health" >/dev/null + socket_ready="false" + + for _ in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do + if curl -fsS "http://127.0.0.1:$socket_port/health" >/dev/null; then + socket_ready="true" + break + fi + + sleep 1 + done + + if [ "$socket_ready" != "true" ]; then + echo "[deploy:toolkit] socket did not become healthy; recent log output follows." + tail -n 80 "$log_file" || true + exit 1 + fi fi echo "[deploy:toolkit] socket running as $socket_pid" diff --git a/src/data/toolkit/changelog.json b/src/data/toolkit/changelog.json index 089f7b9..50a3438 100644 --- a/src/data/toolkit/changelog.json +++ b/src/data/toolkit/changelog.json @@ -19,6 +19,7 @@ "summary": "Fixed deployed Toolkit socket restarts when SSH sessions do not load the user's Node path.", "changes": [ "Updated the Toolkit socket restart script to find Node and npm from standard macOS, Homebrew, and NVM locations.", + "Added a bounded health retry so deploys wait for the socket to bind before failing.", "Kept the restart command safe for non-interactive SSH deploy sessions.", "Preserved the shared workspace socket behavior for deployed Toolkit editing." ]