Skip to content

Commit 7e3acb1

Browse files
committed
🤖 fix: short-circuit checks when Codex gate already failed
Update wait_pr_ready.sh to exit immediately when wait_pr_codex.sh --once returns a terminal failure, instead of always invoking wait_pr_checks.sh first. This preserves true fail-fast behavior and avoids unnecessary delay when Codex has already produced actionable feedback. --- _Generated with [`mux`](https://github.com/coder/mux) • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.26`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.26 -->
1 parent 2974392 commit 7e3acb1

1 file changed

Lines changed: 36 additions & 33 deletions

File tree

scripts/wait_pr_ready.sh

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -70,52 +70,55 @@ while true; do
7070
CODEX_RC=$?
7171
fi
7272

73+
CODEX_STATUS=$(status_from_rc "$CODEX_RC") || exit 1
74+
75+
# True fail-fast behavior: if Codex is already terminal-failed, exit immediately
76+
# without waiting for the checks gate.
77+
if [ "$CODEX_RC" -eq 1 ]; then
78+
echo -ne "\r⏳ Gate status: Codex=${CODEX_STATUS} | Checks=skipped "
79+
echo ""
80+
echo ""
81+
echo "❌ PR #$PR_NUMBER is not ready."
82+
echo ""
83+
echo "--- Codex gate output ---"
84+
if [ -n "$CODEX_OUT" ]; then
85+
echo "$CODEX_OUT"
86+
else
87+
echo "(no output)"
88+
fi
89+
echo ""
90+
echo "Address Codex feedback (or retry if Codex was rate-limited), push, and request review again:"
91+
echo ""
92+
echo " gh pr comment $PR_NUMBER --body-file - <<'EOF'"
93+
echo " @codex review"
94+
echo ""
95+
echo " Please take another look."
96+
echo " EOF"
97+
exit 1
98+
fi
99+
73100
if CHECKS_OUT=$("$WAIT_CHECKS_SCRIPT" "$PR_NUMBER" --once 2>&1); then
74101
CHECKS_RC=0
75102
else
76103
CHECKS_RC=$?
77104
fi
78105

79-
CODEX_STATUS=$(status_from_rc "$CODEX_RC") || exit 1
80106
CHECKS_STATUS=$(status_from_rc "$CHECKS_RC") || exit 1
81-
82107
echo -ne "\r⏳ Gate status: Codex=${CODEX_STATUS} | Checks=${CHECKS_STATUS} "
83108

84-
if [ "$CODEX_RC" -eq 1 ] || [ "$CHECKS_RC" -eq 1 ]; then
109+
if [ "$CHECKS_RC" -eq 1 ]; then
85110
echo ""
86111
echo ""
87112
echo "❌ PR #$PR_NUMBER is not ready."
88-
89-
if [ "$CODEX_RC" -eq 1 ]; then
90-
echo ""
91-
echo "--- Codex gate output ---"
92-
if [ -n "$CODEX_OUT" ]; then
93-
echo "$CODEX_OUT"
94-
else
95-
echo "(no output)"
96-
fi
97-
echo ""
98-
echo "Address Codex feedback (or retry if Codex was rate-limited), push, and request review again:"
99-
echo ""
100-
echo " gh pr comment $PR_NUMBER --body-file - <<'EOF'"
101-
echo " @codex review"
102-
echo ""
103-
echo " Please take another look."
104-
echo " EOF"
105-
fi
106-
107-
if [ "$CHECKS_RC" -eq 1 ]; then
108-
echo ""
109-
echo "--- Checks gate output ---"
110-
if [ -n "$CHECKS_OUT" ]; then
111-
echo "$CHECKS_OUT"
112-
else
113-
echo "(no output)"
114-
fi
115-
echo ""
116-
echo "Fix issues locally, push, and rerun this script."
113+
echo ""
114+
echo "--- Checks gate output ---"
115+
if [ -n "$CHECKS_OUT" ]; then
116+
echo "$CHECKS_OUT"
117+
else
118+
echo "(no output)"
117119
fi
118-
120+
echo ""
121+
echo "Fix issues locally, push, and rerun this script."
119122
exit 1
120123
fi
121124

0 commit comments

Comments
 (0)