fix: GitHub PRs never showed review glyphs, and CI dots misreported multi-workflow pushes - #7
Open
ubuntudroid wants to merge 3 commits into
Open
Conversation
jq's // operator treats false as falsy, so `.isDraft // empty` erased isDraft:false and the guard bailed with GCI_REVIEW="" — no GitHub PR could ever show a review glyph. Extract via an explicit null check on .pullRequest instead, so only a missing PR bails. Regression-tested by stubbing gh with a shell function in test.sh: non-draft, draft, and missing-PR responses. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
actions/runs?branch=X&per_page=1 returns whichever workflow run was created last — on repos with several workflows per push that is often a skip-conditioned one (e.g. "Claude Code"), so a green or running push rendered as the ⚪ 'other' state. Fetch the branch head's check runs (what the PR page aggregates) and let the most severe canonical status win: failed > running > pending > manual > canceled > success > unknown > skipped. The winning run supplies id/url/updated for the CI pane; a 404 (branch not on the remote) counts as no CI rather than a transient error, so labels don't freeze. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
commits/<ref>/check-runs answers 422 "No commit found for SHA" when the ref doesn't resolve — 404 only covers a missing repo. Merged branches are typically auto-deleted, so the previous 404-only guard returned rc 5 (api-error), making the poller SKIP the workspace every cycle: the stale pre-merge label froze and gci_merged_pr never ran. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 20, 2026
ubuntudroid
added a commit
to ubuntudroid/herdr-git-status
that referenced
this pull request
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two independent bugs made the plugin's GitHub support look broken on real-world repos. Both are root-caused, regression-tested, and verified live against PRs on a repo with many workflows per push.
1. Review glyphs never appeared on GitHub PRs
In
gci_review_for_mr(), the draft flag was extracted withjq -r '.data.repository.pullRequest.isDraft // empty'jq's
//operator treatsfalseas falsy — not justnull— so every non-draft PR (isDraft: false) collapsed to empty, tripped the[ -n "$draft" ]guard, and returned withGCI_REVIEW="". Draft PRs passed the guard but render no badge by policy anyway: no GitHub PR could ever show a review glyph. GitLab was unaffected (detailed_merge_statusis a string).Fixed by bailing only on a genuinely missing PR:
jq -r 'if .data.repository.pullRequest == null then empty else (.data.repository.pullRequest.isDraft|tostring) end'2. CI dot misreported repos with several workflows per push
gci_latest_ci()sampled a single workflow run (actions/runs?branch=X&per_page=1) — whichever was created last. On repos where a push triggers several workflows, that is often a skip-conditioned one, so a green or running push rendered as the ⚪ "other" state (observed live: a skipped "Claude Code" run masking 17 green + 1 running checks).Fixed by aggregating all check runs on the branch head — the same signal the PR page shows — with the most severe canonical status winning (
failed > running > pending > manual > canceled > success > unknown > skipped). The decisive run supplies id/url/updated for the CI pane. A 404 (branch not on the remote yet/anymore) now counts as "no CI" instead of a transient error, so labels don't freeze.Tests
gci_review_for_mrgithub path covered by stubbingghwith a shell function: non-draft (the regression), draft, and missing-PR responses.gci_github_checks_statuscovered for severity ordering, queued→pending, skipped-only, and empty input — including the tab-IFS field-collapse edge case for runs without a conclusion.bash test.sh: 113 checks green.🤖 Generated with Claude Code