diff --git a/codex/SKILL.md b/codex/SKILL.md index 0ff1e3e553..ad3f966747 100644 --- a/codex/SKILL.md +++ b/codex/SKILL.md @@ -949,6 +949,13 @@ if [ "$_CODEX_EXIT" = "124" ]; then _gstack_codex_log_event "codex_timeout" "330" _gstack_codex_log_hang "review" "$(wc -c < "$TMPERR" 2>/dev/null || echo 0)" echo "Codex stalled past 5.5 minutes. Common causes: model API stall, long prompt, network issue. Try re-running. If persistent, split the prompt or check ~/.codex/logs/." +elif [ "$_CODEX_EXIT" != "0" ]; then + # Surface non-zero exits (parse errors, arg-shape breaks, etc.) so the + # calling agent doesn't read "no output" as a silent model/API stall and + # burn 30-60min misdiagnosing it. See #1327. + echo "[codex exit $_CODEX_EXIT] $(head -1 "$TMPERR" 2>/dev/null || echo "no stderr captured")" + head -20 "$TMPERR" 2>/dev/null | sed 's/^/ /' || true + _gstack_codex_log_event "codex_nonzero_exit" "review:$_CODEX_EXIT" fi ``` @@ -1187,6 +1194,12 @@ if [ "$_CODEX_EXIT" = "124" ]; then _gstack_codex_log_event "codex_timeout" "600" _gstack_codex_log_hang "challenge" "$(wc -c < "$TMPERR" 2>/dev/null || echo 0)" echo "Codex stalled past 10 minutes. Common causes: model API stall, long prompt, network issue. Try re-running. If persistent, split the prompt or check ~/.codex/logs/." +elif [ "$_CODEX_EXIT" != "0" ]; then + # Surface non-zero exits so the calling agent doesn't read "no output" as + # a silent model/API stall. See #1327. + echo "[codex exit $_CODEX_EXIT] $(head -1 "$TMPERR" 2>/dev/null || echo "no stderr captured")" + head -20 "$TMPERR" 2>/dev/null | sed 's/^/ /' || true + _gstack_codex_log_event "codex_nonzero_exit" "challenge:$_CODEX_EXIT" fi # Fix 2: surface auth errors from captured stderr instead of dropping them if grep -qiE "auth|login|unauthorized" "$TMPERR" 2>/dev/null; then @@ -1334,6 +1347,12 @@ if [ "$_CODEX_EXIT" = "124" ]; then _gstack_codex_log_event "codex_timeout" "600" _gstack_codex_log_hang "consult" "$(wc -c < "$TMPERR" 2>/dev/null || echo 0)" echo "Codex stalled past 10 minutes. Common causes: model API stall, long prompt, network issue. Try re-running. If persistent, split the prompt or check ~/.codex/logs/." +elif [ "$_CODEX_EXIT" != "0" ]; then + # Surface non-zero exits so the calling agent doesn't read "no output" as + # a silent model/API stall. See #1327. + echo "[codex exit $_CODEX_EXIT] $(head -1 "$TMPERR" 2>/dev/null || echo "no stderr captured")" + head -20 "$TMPERR" 2>/dev/null | sed 's/^/ /' || true + _gstack_codex_log_event "codex_nonzero_exit" "consult:$_CODEX_EXIT" fi ``` @@ -1356,6 +1375,12 @@ if [ "$_CODEX_EXIT" = "124" ]; then _gstack_codex_log_event "codex_timeout" "600" _gstack_codex_log_hang "consult-resume" "$(wc -c < "$TMPERR" 2>/dev/null || echo 0)" echo "Codex stalled past 10 minutes. Common causes: model API stall, long prompt, network issue. Try re-running. If persistent, split the prompt or check ~/.codex/logs/." +elif [ "$_CODEX_EXIT" != "0" ]; then + # Surface non-zero exits so the calling agent doesn't read "no output" as + # a silent model/API stall. See #1327. + echo "[codex exit $_CODEX_EXIT] $(head -1 "$TMPERR" 2>/dev/null || echo "no stderr captured")" + head -20 "$TMPERR" 2>/dev/null | sed 's/^/ /' || true + _gstack_codex_log_event "codex_nonzero_exit" "consult-resume:$_CODEX_EXIT" fi 5. Capture session ID from the streamed output. The parser prints `SESSION_ID:` diff --git a/codex/SKILL.md.tmpl b/codex/SKILL.md.tmpl index ed118a1193..69abdfc620 100644 --- a/codex/SKILL.md.tmpl +++ b/codex/SKILL.md.tmpl @@ -175,6 +175,13 @@ if [ "$_CODEX_EXIT" = "124" ]; then _gstack_codex_log_event "codex_timeout" "330" _gstack_codex_log_hang "review" "$(wc -c < "$TMPERR" 2>/dev/null || echo 0)" echo "Codex stalled past 5.5 minutes. Common causes: model API stall, long prompt, network issue. Try re-running. If persistent, split the prompt or check ~/.codex/logs/." +elif [ "$_CODEX_EXIT" != "0" ]; then + # Surface non-zero exits (parse errors, arg-shape breaks, etc.) so the + # calling agent doesn't read "no output" as a silent model/API stall and + # burn 30-60min misdiagnosing it. See #1327. + echo "[codex exit $_CODEX_EXIT] $(head -1 "$TMPERR" 2>/dev/null || echo "no stderr captured")" + head -20 "$TMPERR" 2>/dev/null | sed 's/^/ /' || true + _gstack_codex_log_event "codex_nonzero_exit" "review:$_CODEX_EXIT" fi ``` @@ -329,6 +336,12 @@ if [ "$_CODEX_EXIT" = "124" ]; then _gstack_codex_log_event "codex_timeout" "600" _gstack_codex_log_hang "challenge" "$(wc -c < "$TMPERR" 2>/dev/null || echo 0)" echo "Codex stalled past 10 minutes. Common causes: model API stall, long prompt, network issue. Try re-running. If persistent, split the prompt or check ~/.codex/logs/." +elif [ "$_CODEX_EXIT" != "0" ]; then + # Surface non-zero exits so the calling agent doesn't read "no output" as + # a silent model/API stall. See #1327. + echo "[codex exit $_CODEX_EXIT] $(head -1 "$TMPERR" 2>/dev/null || echo "no stderr captured")" + head -20 "$TMPERR" 2>/dev/null | sed 's/^/ /' || true + _gstack_codex_log_event "codex_nonzero_exit" "challenge:$_CODEX_EXIT" fi # Fix 2: surface auth errors from captured stderr instead of dropping them if grep -qiE "auth|login|unauthorized" "$TMPERR" 2>/dev/null; then @@ -476,6 +489,12 @@ if [ "$_CODEX_EXIT" = "124" ]; then _gstack_codex_log_event "codex_timeout" "600" _gstack_codex_log_hang "consult" "$(wc -c < "$TMPERR" 2>/dev/null || echo 0)" echo "Codex stalled past 10 minutes. Common causes: model API stall, long prompt, network issue. Try re-running. If persistent, split the prompt or check ~/.codex/logs/." +elif [ "$_CODEX_EXIT" != "0" ]; then + # Surface non-zero exits so the calling agent doesn't read "no output" as + # a silent model/API stall. See #1327. + echo "[codex exit $_CODEX_EXIT] $(head -1 "$TMPERR" 2>/dev/null || echo "no stderr captured")" + head -20 "$TMPERR" 2>/dev/null | sed 's/^/ /' || true + _gstack_codex_log_event "codex_nonzero_exit" "consult:$_CODEX_EXIT" fi ``` @@ -498,6 +517,12 @@ if [ "$_CODEX_EXIT" = "124" ]; then _gstack_codex_log_event "codex_timeout" "600" _gstack_codex_log_hang "consult-resume" "$(wc -c < "$TMPERR" 2>/dev/null || echo 0)" echo "Codex stalled past 10 minutes. Common causes: model API stall, long prompt, network issue. Try re-running. If persistent, split the prompt or check ~/.codex/logs/." +elif [ "$_CODEX_EXIT" != "0" ]; then + # Surface non-zero exits so the calling agent doesn't read "no output" as + # a silent model/API stall. See #1327. + echo "[codex exit $_CODEX_EXIT] $(head -1 "$TMPERR" 2>/dev/null || echo "no stderr captured")" + head -20 "$TMPERR" 2>/dev/null | sed 's/^/ /' || true + _gstack_codex_log_event "codex_nonzero_exit" "consult-resume:$_CODEX_EXIT" fi 5. Capture session ID from the streamed output. The parser prints `SESSION_ID:`