Repository navigation
Description
Summary
The advisory-bot gate (scripts/lib/advisory-review-gate.sh) strands PRs in waiting-for-advisory-bots indefinitely whenever one of the four monitored bots doesn't review a given PR (common — Codex/SonarCloud only review a subset). The two timeout fallbacks that were specifically built to handle absent bots are silently disabled because they depend on GitHub's pushedDate, which now returns null.
Root cause
The gate requires all four monitored advisory bots to submit before approving:
gemini-code-assist, copilot-pull-request-reviewer, sonarqubecloud, chatgpt-codex-connector
Two fallbacks (lines 216-224) are supposed to proceed anyway when bots are absent:
- head-age > 20 min —
head_age_secfrompushedDate - quiescence > 10 min —
time_since_last_sub, but guarded onhead_time_rawbeing non-empty (line 200)
Both derive from this query (line 180-183):
query($url:URI!){resource(url:$url){...on PullRequest{commits(last:1){nodes{commit{pushedDate}}}}}}pushedDate is deprecated and now returns null:
$ gh api graphql -f query='...pushedDate committedDate...' -f url=.../pull/518
{"committedDate":"2026-06-11T21:39:01Z","pushedDate":null}
With pushedDate=null:
head_timeis empty →head_age_secstays0→ fallback test issue from agent #1 never fires.head_time_rawis empty → thetime_since_last_subblock (line 200) is skipped → stays0→ fallback Go-live improvements for PR review agent #2 never fires.
The code intentionally refuses to fall back to committedDate (lines 173-177, to stop cherry-picks bypassing the gate) — so there is no backup head-age source. Result: the gate return 1 (wait) forever for any PR missing a full 4/4 bot set.
Evidence (run 27376131558, 2026-06-11)
Every advisory-gate warning in the batch run shows the tell-tale zeros:
[advisory-gate] WARNING: Only 3/4 advisory bots submitted so far (head age: 0s, last submission: 0s ago)
head age: 0s on PRs that are hours/days old = pushedDate resolving to null across the board.
PRs stranded as waiting-for-advisory-bots this run: #479, #518, #550 (.github-private) plus ~21 more org-wide (24 total).
On #518, only 3 of 4 monitored bots submitted (copilot-pull-request-reviewer, gemini-code-assist, sonarqubecloud) — chatgpt-codex-connector (Codex) never reviewed it, so the gate waits indefinitely. The only escape today is FORCE_REVIEW=true.
Impact
Any PR that isn't reviewed by all four advisory bots is parked in waiting-for-advisory-bots and never approved by pr-review — a meaningful slice of the "PRs pending review" backlog. Because Codex (and often SonarCloud-as-a-review) are selective, this is the common case, not the edge case.
Proposed fix
Restore a working head-age source so the absent-bot fallbacks fire:
- Replace
pushedDatewith a reliable timestamp — e.g. the head commit's committer date via REST (GET /repos/{o}/{r}/commits/{sha}→.commit.committer.date), or the PR'sheadRefOidcommit time, or the latestpull_requesttimelinepushedAt. Keep the cherry-pick guard by anchoring quiescence to the later of head-time and latest-submission (already done at lines 206-211). - And/or only require bots that have ever participated on the PR (treat Codex/SonarCloud as optional unless they've actually posted), instead of a hard 4/4.
- Decouple the quiescence fallback from
head_time_rawso it can still fire fromlatest_sub_atalone when head-time is unavailable.
A scheduled re-trigger for stranded PRs (see #573) would also let the (repaired) timeout fire without waiting for a pull_request_review event that never comes.
Related
- pr-review: PRs skipped as ci-pending are never re-reviewed after CI goes green #573 — re-trigger gap (skipped PRs not re-reviewed after state changes)
- pr-review: PRs with >300 changed files hard-fail the cascade (gh pr diff 406); define org standard for oversized PRs #574 — >300-file diff hard failure
Filed from an investigation into "pr-review agent not working — many PRs pending review."
Activity
don-petry commentedon Jun 11, 2026
Dev-Lead Implementation Plan
Issue: #577 — advisory-bot gate strands PRs forever: pushedDate=null disables both absent-bot timeout fallbacks
Scope
Replace the deprecated
pushedDateGraphQL field (now returnsnull) with the head commit's committer date from the REST API (GET /repos/{owner}/{repo}/commits/{sha}→.commit.committer.date), and decouple the quiescence fallback fromhead_time_rawso it can fire fromlatest_sub_atalone when head time is unavailable.Implementation Checklist
scripts/lib/advisory-review-gate.sh— Add_get_head_committer_date()helper that fetches the PR's head commit SHA viagh pr view --json headRefOidthen retrieves.commit.committer.datevia REST APIscripts/lib/advisory-review-gate.sh— Replace thepushedDateGraphQL query block with a call to_get_head_committer_date()scripts/lib/advisory-review-gate.sh— Decouple quiescence fallback fromhead_time_rawguard sotime_since_last_subis computed fromlatest_sub_ateven whenhead_time_rawis emptytests/dev-lead/unit/test_advisory_review_gate.bats— Add_make_mock_gh_dir_null_pushed_datemock (graphql=empty, REST=old timestamp)tests/dev-lead/unit/test_advisory_review_gate.bats— Add_make_mock_gh_dir_no_head_timemock (head time unavailable, old submissions)tests/dev-lead/unit/test_advisory_review_gate.bats— Add failing test: recovers when pushedDate=null via committer date (REST)tests/dev-lead/unit/test_advisory_review_gate.bats— Add failing test: quiescence fires when head time unavailable and submissions are oldtests/dev-lead/unit/test_advisory_review_gate.bats— Update existing mock helpers to use REST pattern (headRefOid + /commits/)Tests to Write
Gate runtime: recovers when pushedDate is null — uses committer date (REST) for head age— expects return 0 when committer date is old (>20 min)Gate runtime: quiescence fallback fires when head time unavailable and submissions are old— expects return 0 when submissions are >10 min old and head time is unknownTest Command
bats tests/dev-lead/unit/test_advisory_review_gate.bats --formatter tapdon-petry commentedon Jun 11, 2026
Dev-Lead: Implementation Complete
Plan Execution
scripts/lib/advisory-review-gate.sh— Added_get_head_committer_date()helper that fetchesheadRefOidviagh pr view --json headRefOidthen retrieves.commit.committer.datefromGET /repos/{owner}/{repo}/commits/{sha}scripts/lib/advisory-review-gate.sh— Replaced thepushedDateGraphQL query block with a call to_get_head_committer_date()scripts/lib/advisory-review-gate.sh— Decoupled quiescence fallback fromhead_time_rawguard;time_since_last_subis now computed fromlatest_sub_ateven whenhead_time_rawis emptytests/dev-lead/unit/test_advisory_review_gate.bats— Added_make_mock_gh_dir_null_pushed_datemock (graphql=empty, REST=old committer date)tests/dev-lead/unit/test_advisory_review_gate.bats— Added_make_mock_gh_dir_no_head_timemock (both graphql and REST unavailable, old submissions present)tests/dev-lead/unit/test_advisory_review_gate.bats— Added failing-then-passing test: "Gate runtime: recovers when pushedDate is null — uses committer date (REST) for head age"tests/dev-lead/unit/test_advisory_review_gate.bats— Added failing-then-passing test: "Gate runtime: quiescence fallback fires when head time unavailable and submissions are old"tests/dev-lead/unit/test_advisory_review_gate.bats— Updated_make_mock_gh_dir,_make_mock_gh_dir_recent, and_make_mock_gh_dir_old_commit_recent_pushto use REST pattern (headRefOid + /commits/) instead of GraphQLTest Results
Files Changed
scripts/lib/advisory-review-gate.sh: Replaced deprecatedpushedDateGraphQL query with_get_head_committer_date()REST helper; decoupled quiescence fallback fromhead_time_rawguardtests/dev-lead/unit/test_advisory_review_gate.bats: Added 2 new regression tests, 2 new mock helpers, updated 3 existing mock helpers to REST patternNotes
committer.datereflects whengit cherry-pickran (≈push time), not the original author date — so recently cherry-picked old commits still have smallhead_age_secand don't bypass the gatelatest_sub_atalone (no cherry-pick protection for that fallback). The issue explicitly accepted this trade-off to avoid indefinite strandingfeat: implement issue #577 — advisory-bot gate strands PRs forever: p…
feat: implement issue #577 — advisory-bot gate strands PRs forever: p…
feat: implement issue #577 — advisory-bot gate strands PRs forever: p…
feat: implement issue #577 — advisory-bot gate strands PRs forever: p…
feat: implement issue #577 — advisory-bot gate strands PRs forever: p…
feat: implement issue #577 — advisory-bot gate strands PRs forever: p…