ci: fix monitor-ci.sh grabbing the wrong workflow run - #57
Conversation
Every PR push triggers two workflows: CI (the real test matrix, event pull_request) and Claude Code Review (event pull_request_target). The old commit-based lookup, `gh run list --commit SHA` with no workflow filter, returned both runs in an order that isn't guaranteed to put CI first - so it could silently report on the Claude Code Review run instead of the actual test matrix, without ever noticing the mismatch. Fix by looking up each workflow explicitly by name (-w/--workflow) and monitoring both to completion. OVERALL: ALL_PASS now requires both runs to succeed (or, for Claude Code Review, legitimately skip - it no-ops on draft PRs and PRs from untrusted forks). Also fix the === BRANCHES: === line extraction: the anchored grep '^=== BRANCHES:' never matched, because every line from the jobs logs API is prefixed with an ISO-8601 timestamp. Drop the anchor and strip the timestamp for a clean line.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code review4 issues found (3 bugs, 1 CLAUDE.md compliance violation). Note: this run's inline-comment tool wasn't available in this session (and 1. Failure-log lookup always resolves to a null job ID pgxntool-test/.claude/skills/ci/scripts/monitor-ci.sh Lines 164 to 170 in f6e507f Step 3's cached Fix: add 2. Un-anchored BRANCHES grep can capture the echoed (unexpanded) step source pgxntool-test/.claude/skills/ci/scripts/monitor-ci.sh Lines 134 to 141 in f6e507f Removing the Suggested fix: strip the timestamp first, then re-apply the 3. Status label changed to Code: Doc: pgxntool-test/.claude/skills/ci/SKILL.md Lines 63 to 69 in f6e507f The Step 4 jq filter changed from a hardcoded "PASS" literal to Suggested fix: update SKILL.md's example lines to 4. CLAUDE.md violation: pgxntool-test/.claude/skills/ci/scripts/monitor-ci.sh Lines 220 to 225 in f6e507f This PR restructures the failure-reporting loop and re-adds Suggested fix: change |
Rework the previous fix (hardcoded CI + Claude Code Review names) into a default-include model: discover every workflow run GitHub actually triggered for the pushed commit and require all of them to pass (or legitimately skip), with an EXCLUDE_WORKFLOWS array as the escape hatch for a workflow that should never gate this check. This way any future workflow added to either repo is covered automatically, without having to remember to update a hardcoded list here. Also fixes a bug introduced while testing the rework: gh run list --jq only accepts a plain jq expression, not extra jq flags like --argjson. Passing --argjson straight to gh run list failed with 'unknown command', which the surrounding `|| echo "[]"` fallback silently swallowed - discovery always returned zero runs and looped for the full timeout. Fixed by piping gh's raw --json output into a real jq invocation instead.
Summary
monitor-ci.sh's commit-based run lookup had no--workflowfilter, so on a push it could nondeterministically grab either theCIrun or theClaude Code Reviewrun for the same SHA (both trigger on the same push) and silently report on the wrong one.OVERALL: ALL_PASSnow requires both to succeed (or, for Claude Code Review, legitimately skip — it no-ops on draft PRs / untrusted-fork PRs).=== BRANCHES: ===extraction used an anchoredgrep '^=== BRANCHES:', which never matched because the jobs-logs API prefixes every line with an ISO-8601 timestamp. That safeguard had never actually fired even when the right run was picked.Both fixes verified against the real run pair for commit
2cbe91a(the SHA from the original bug report) inPostgres-Extensions/pgxntool-test.Test plan
bash -nsyntax check2cbe91a810283d683eb5c07ef5fd901bd79b22c1and confirmed it finds both runs by name, prints a clean=== BRANCHES: ===line, reports all matrix jobs, and returnsOVERALL: ALL_PASS