Repository navigation
Description
Problem
The tend-review run for a new PR triggers on pull_request_target: opened and runs in parallel with the tests workflow. Its Step 6 (CI monitoring) polls gh pr checks <number> --required in a loop and exits as soon as no required check is still pending/queued/in_progress.
In this repo, the only status context that reports as "required" at polling time is pre-commit.ci - pr. The branch's real required omnibus, check-ok-to-merge (defined in tests.yaml with if: always() and a long needs: list), is not registered as a check-run until its dependencies start completing. So the review's polling loop sees only pre-commit.ci - pr, watches it pass in a few minutes, and exits reporting "CI passed" while test-rust and siblings are still running.
Evidence
Most recent occurrence: PR #5807 (rust toolchain 1.93.1 → 1.94.1).
- 11:12:32Z — tend-review run 24562181409 started.
- 11:17:10Z — review session ended. Session JSONL shows
gh pr checks 5807 --requiredreturned onlypre-commit.ci - pr;check-ok-to-mergewas not in the response (0 occurrences in the tool-result log vs. 3 forpre-commit.ci - pr). - 11:18:59Z — first
test-rustfailure (a newclippy::manual_saturating_arithmeticlint in Rust 1.94). - 11:40:35Z —
check-ok-to-mergecheck-run finally registered on commit8ff52aff, 23 minutes after the review had finished.
The bot's review therefore signalled "all required checks passed" while the PR was actually broken. A human maintainer had to flag it; reconstructing the root cause took 4 subsequent tend-mention runs on the PR thread.
Proposed fix
Add a short section to .claude/skills/running-tend/SKILL.md telling future bot sessions on this repo not to use gh pr checks --required in the review monitoring loop. Poll without --required so the loop waits for every in-flight tests job to finish.
--- a/.claude/skills/running-tend/SKILL.md
+++ b/.claude/skills/running-tend/SKILL.md
@@ -15,3 +15,32 @@
- Main CI workflow: `tests` (watched by tend-ci-fix)
- Dependency management: Dependabot (tend-weekly is disabled)
- Automerge: `pull-request-target.yaml` auto-merges single-commit `prql-bot` PRs
once CI passes
+
+## CI monitoring after review
+
+When polling CI after submitting a review (Step 6 of `tend-ci-runner:review`),
+**do not use `gh pr checks --required`** on this repo. The required check
+`check-ok-to-merge` is an `alls-green` omnibus defined in `tests.yaml` with
+`if: always()` and a long `needs:` list; its check-run is not registered
+until its dependencies (`test-rust`, `test-js`, etc.) complete. `tend-review`
+runs triggered by `pull_request_target: opened` run in parallel with `tests`,
+so at polling time `gh pr checks --required` sees only `pre-commit.ci - pr`;
+the loop exits as soon as it passes and misses in-flight test failures.
+
+Poll without `--required` instead:
+
+```bash
+for i in $(seq 1 15); do
+ sleep 60
+ gh pr checks <number> 2>&1 | grep -v "/runs/$GITHUB_RUN_ID/" \
+ | grep -q 'pending\|queued\|in_progress' || {
+ gh pr checks <number>
+ exit 0
+ }
+done
+echo "CI still running after 15 minutes"
+exit 1
+```
+
+The wider poll catches every `tests` job; budget up to 15 minutes since the
+full `tests` matrix runs longer than `pre-commit.ci - pr` alone.I can't apply this myself — the CI sandbox marks .claude/skills/ as a sensitive path and blocks writes from both the Edit tool and Bash, even in a worktree under $TMPDIR. Same block was noted in #5802 for a different skill update; that diff ended up needing a maintainer to land it too.
Gate assessment
- Evidence level: Critical (wrong outcome — bot signalled CI passed while PR was broken).
- Structural: Yes — any
pull_request_target: opened-triggered review on this repo will see the same race. - Occurrences: 1 this cycle; Critical + structural passes Gate 1 at 1.
- Magnitude: Targeted addition (~29 lines in an existing skill file).
Activity
prql-bot commentedon Apr 18, 2026
Verified the root cause from the session log and the current
tests.yaml:check-ok-to-mergeis analls-greenomnibus withif: always()and a longneeds:list, so its check-run isn't registered until its dependencies start completing. Thetend-reviewrun for #5807 (run 24562181409) started at 11:12:32Z and exited at 11:17:10Z, while thetestsrun on the same commit failed later (conclusion: failure). The proposed diff — polling without--requiredin.claude/skills/running-tend/SKILL.md— matches the evidence and doesn't duplicate upstreamtend-ci-runner:running-in-ciguidance (which uses--requiredas a default that this repo's omnibus structure breaks).Couldn't apply the patch automatically: the CI sandbox lists
/home/runner/work/prql/prql/.claude/skillsunderdenyWithinAllow, and the Edit tool is blocked with a permissions error. This is a deliberate policy gate for skill changes, so I'm leaving the diff in the issue body for a maintainer to land rather than bypassing the sandbox.max-sixty commentedon Apr 18, 2026
is there a way we can change the polling to not miss the "required task which hasn't yet started"?
can we move this issue to the tend repo / open one there? it seems like an upstream problem
prql-bot commentedon Apr 18, 2026
A few options, in order of how much they'd change:
gh run list --commit <sha> --json name,status,conclusionsees runs the moment they're queued, so it doesn't depend on a check-run being registered. This sidesteps the wholealls-green/if: always()race.gh pr checks | jq 'select(.name==...)'). Avoids--required's "what's registered right now" snapshot, but adds API surface and assumes the bot can read branch protection.check-ok-to-mergehas time to register). Cheapest, but fragile — arbitrary constant against a variable matrix.Option 1 seems like the cleanest upstream default; the proposed repo-local diff (drop
--required) is a strict subset of that.Agreed — the
--requireddefault lives intend-ci-runner:reviewStep 6, and any repo that uses analls-greenomnibus (a fairly common pattern) will hit the same race. I don't have write access tomax-sixty/tendto transfer it, and my scope here is limited to the PRQL org, so I'll leave opening the upstream issue to you.max-sixty commentedon Apr 18, 2026
open the upstream issue with option 1
prql-bot commentedon Apr 18, 2026
Opened upstream: max-sixty/tend#305. Filed with Option 1 (poll workflow runs via
gh run list --commit <sha>instead ofgh pr checks --required) as the proposed fix, along with the tradeoffs (waits for all runs, not just required ones; optional branch-protection filter to narrow it) and alternatives considered. The PRQL #5807 incident is cited as the downstream evidence.review: poll statusCheckRollup + mergeStateStatus instead of `gh pr c…
skills(running-tend): close bot-opened issues when resolved
prql-bot commentedon Apr 20, 2026
Resolved upstream in tend.
The CI monitoring loop in
tend-ci-runner:running-in-ci(now shipped with tend 0.1.0) pollsstatusCheckRollupinstead ofgh pr checks --required, filters out the current run's own check, and includes a 30s grace re-check so late-registering omnibus checks likecheck-ok-to-mergeare picked up. The comment block on that loop explicitly calls out this repo's scenario — thealls-greenomnibus registers only once itsneeds:list reaches terminal, so--requiredwould see onlypre-commit.ci - prand exit early. The rollup sees matrix jobs asIN_PROGRESSwhile they run, so the loop correctly waits for them.The
reviewskill's Step 6 now defers to that loop rather than inlining its own--requiredpoll, so newtend-reviewruns on this repo will wait for the fulltestsmatrix. Closing.