From 102977cf7cd2a34cc9b65ff19e14ec74686798d8 Mon Sep 17 00:00:00 2001 From: Petrus Pennanen Date: Thu, 16 Jul 2026 11:46:26 +0300 Subject: [PATCH] fix: codex webhook receiver launched without env, crash-looping on missing secret start_receiver's env-assignment chain ended with NODE_BIN=$(...) on its own continuation line, turning the whole chain into an assignment-only statement. The node receiver was then launched on the next line with none of the WEBHOOK_WAKE_* variables exported, so webhook-wake.mjs exited immediately on the missing secret and the supervisor relaunched it every 30s. Net effect: @codexmb's low-latency wake webhook has been dead since the chain was added, codex only woke via the slow poller. Resolve NODE_BIN on its own line first, keep the env prefix attached to the node invocation. Verified live on the MB: receiver listening on :8791, tunnel registered (http 200), POST with secret accepted and self-messages skipped. Co-Authored-By: Claude Fable 5 --- scripts/codex-webhook-supervisor.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/codex-webhook-supervisor.sh b/scripts/codex-webhook-supervisor.sh index c35fc05..d9358e3 100755 --- a/scripts/codex-webhook-supervisor.sh +++ b/scripts/codex-webhook-supervisor.sh @@ -44,6 +44,11 @@ receiver_running(){ } start_receiver(){ receiver_running || { + # NODE_BIN must be resolved on its own line: if it sits at the end of the + # env-assignment chain, the whole chain becomes an assignment-only + # statement and node launches with NO env (receiver exits on missing + # WEBHOOK_WAKE_SECRET, crash-looping every cycle). + NODE_BIN="$(command -v node || echo /usr/local/bin/node)" WEBHOOK_WAKE_SECRET="$SECRET" \ WEBHOOK_WAKE_PORT="$PORT" \ WEBHOOK_WAKE_SCRIPT="$WAKE" \ @@ -53,7 +58,6 @@ start_receiver(){ WEBHOOK_WAKE_LOG="/tmp/codex-webhook-wake.log" \ IAK_CODEX_APP_NAME="ChatGPT" \ IAK_NUDGE_TEXT="check rooms [codex]" \ - NODE_BIN="$(command -v node || echo /usr/local/bin/node)" "$NODE_BIN" "$RECEIVER" >>/tmp/codex-webhook-wake.log 2>&1 & sleep 1 if kill -0 $! 2>/dev/null; then log "receiver started"; else log "receiver FAILED to start"; fi