From fa61a3afc9f1a3e181429a878df2f525304b4664 Mon Sep 17 00:00:00 2001 From: Michael Suchacz <203725896+ibetitsmike@users.noreply.github.com> Date: Thu, 5 Mar 2026 01:07:49 +0000 Subject: [PATCH 1/2] fix: add ~75s grace period for Codex review CI check The Codex review step was failing immediately when Codex hadn't responded yet. Now retries up to 6 times at 15s intervals (~75s) before giving up, while still failing immediately if there are actual comments to address. --- .github/workflows/pr.yml | 52 ++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index c3c24b8..65bf951 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -114,24 +114,36 @@ jobs: run: | set -uo pipefail - # Check if Codex has been requested as a reviewer or has left comments. - # Exit codes: 0=approved, 1=comments to address, 10=no response yet. - if ./scripts/check_codex_comments.sh "$PR_NUMBER"; then - rc=0 - else - rc=$? - fi + # Grace period: retry up to ~75s when Codex hasn't responded yet. + max_attempts=6 + interval=15 + attempt=0 - case "$rc" in - 0) - echo "✅ Codex review approved" - ;; - 10) - echo "⏳ Codex review not yet received — request one with: @codex review" - exit 1 - ;; - *) - echo "❌ Codex review has comments to address" - exit 1 - ;; - esac + while true; do + attempt=$((attempt + 1)) + + if ./scripts/check_codex_comments.sh "$PR_NUMBER"; then + rc=0 + else + rc=$? + fi + + case "$rc" in + 0) + echo "✅ Codex review approved" + exit 0 + ;; + 10) + if [ "$attempt" -ge "$max_attempts" ]; then + echo "⏳ Codex review not yet received after ${attempt} attempts — request one with: @codex review" + exit 1 + fi + echo "⏳ No Codex response yet (attempt ${attempt}/${max_attempts}), retrying in ${interval}s..." + sleep "$interval" + ;; + *) + echo "❌ Codex review has comments to address" + exit 1 + ;; + esac + done From 8f19709f53416e9603d0c85d4fdfae6ab2891cee Mon Sep 17 00:00:00 2001 From: Michael Suchacz <203725896+ibetitsmike@users.noreply.github.com> Date: Thu, 5 Mar 2026 01:30:49 +0000 Subject: [PATCH 2/2] fix: match bot login in reactions and handle null pushedDate GitHub GraphQL returns 'chatgpt-codex-connector[bot]' for reaction users but 'chatgpt-codex-connector' for comment authors. Use startswith() instead of exact match for reactions. Also fix pushedDate null handling: jq -r turns null into the string "null" which breaks timestamp comparison. Use // "" to get an empty string instead. --- scripts/check_codex_comments.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/check_codex_comments.sh b/scripts/check_codex_comments.sh index 734a1a8..c0013e9 100755 --- a/scripts/check_codex_comments.sh +++ b/scripts/check_codex_comments.sh @@ -89,11 +89,11 @@ fi # Check for thumbs-up reaction from Codex bot (must be after latest push) last_push=$(echo "$data" | jq -r \ - '.data.repository.pullRequest.commits.nodes[-1].commit.pushedDate // empty') + '.data.repository.pullRequest.commits.nodes[-1].commit.pushedDate // ""') has_thumbsup=$(echo "$data" | jq -r --arg bot "$BOT_LOGIN" --arg since "${last_push:-}" \ '[.data.repository.pullRequest.reactions.nodes[]? - | select(.user.login == $bot) + | select(.user.login | startswith($bot)) | select($since == "" or .createdAt > $since) ] | length')