Repository navigation
Hold pr_review.py merge for a Hosted Review Not Registered Yet - #4306
Conversation
A CodeRabbit or Qodo reviewer asked by comment registers its check only after the ask, so a head whose other checks have passed read ready to merge in that window. wait and merge now hold for a 90-second registration grace from the latest of the head's push, its last non-hosted check settling, and its newest trusted review ask. The grace ends early once a CodeRabbit or Qodo check that did not skip is on the head, and a wait returning 0 reports a grace that released with none. The grace and the CHECKS_PENDING line live in a new reader, pr_review_hold.py, with the pure ask and arrival helpers moved there from pr_review_side.py, so every review module stays under its ceiling. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A review finished before a re-ask answers the earlier request, so it no longer ends the grace while the re-asked check is still to register. The merge refusal names when to run merge again, and the README states the grace and its modules exactly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
An older hosted check can stand on the head while the grace waits for the one answering a re-ask, so the open-grace note and the merge refusal now say no check answering the newest push or ask has registered. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
A recorded local strict-review pass covers head |
There was a problem hiding this comment.
🟡 Changes recommended
An active critical issue can let the merge proceed before the trusted ask’s 90-second grace window expires, and a secondary message inaccurately describes the SKIPPED hosted-check state.
2 open issues
What changed in this PR
This pull request prevents pr_review.py merge from landing a pull request before a requested hosted review check registers by adding a bounded 90-second registration grace.
Changes:
- Records settlement timestamps for CheckRuns and StatusContexts.
- Anchors hosted-review grace to the latest push, check settlement, or trusted review request.
- Integrates grace handling into
waitandmergedecisions. - Extracts shared hold helpers, updates documentation and size contracts, and expands test coverage.
| File | Description |
|---|---|
| tests/test_pr_review.py | Adds coverage for registration-grace anchors, hosted-check handling, polling, output, and merge refusal. |
| tests/test_pr_review_size.py | Adds size-ceiling coverage for the new hold reader module. |
| scripts/README.md | Documents registration-grace behavior, wait handling, and related exit-code implications. |
| scripts/pr_review.py | Integrates settlement timestamps and hosted-review grace evaluation into polling and final wait decisions. |
| scripts/pr_review_side.py | Reuses the centralized review-hold helpers and reports whether a review request was sent. |
| scripts/pr_review_hold.py | Implements hosted-review grace calculation, hosted-check detection, review-request parsing, and pending-status rendering. |
| scripts/pr_review_checks.py | Normalizes settlement timestamps for CheckRuns and StatusContexts. |
| scripts/pr_review_answers.py | Refuses merges while the hosted-review registration grace remains open. |
Review effort: Lite
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4306 +/- ##
===========================================
+ Coverage 79.03% 79.05% +0.02%
===========================================
Files 42 43 +1
Lines 15631 15733 +102
===========================================
+ Hits 12354 12438 +84
- Misses 3277 3295 +18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
|
/review |
Action not completed
|
CodeRabbit posts a SKIPPED check on every head when automatic review is off, and the grace stays open over it. The notes now speak of a review check and name each skipped placeholder, so a released grace does not read as a reviewer that never registered. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |
… an On-Open Ask (#4321) ## Summary Fixes three findings that promotion PR #4315 drew on the registration grace #4306 added. - **A hosted check whose start is unread no longer ends an asked grace** (#4315 thread `PRRT_kwDOQ5caqM6517DJ`). `CheckRun.startedAt` is nullable. `since_ask` read a null start as "at or after the newest ask", so such a CodeRabbit or Qodo check ended the window. That contradicted the docstring, which ends the window only for a check that began at or after the ask. Now a null start ends nothing while an ask is on record. With no ask on record, any hosted check still ends the window, as before. - **The push log dates a head pushed again** (#4315 thread `PRRT_kwDOQ5caqM651p5Y`). `head_arrived` read only the earliest suite or check on the head. So a push back to a commit checked before read as that commit's first push. It now takes the later of two stamps. One is the push-log stamp `pr_review_side.pushed` already reads. The other is the earliest suite, so the anchor is never earlier than before. `full_read` attaches the stamp, which covers `wait`'s final read and `merge`'s gate read. The held poll's registration test attaches it through `pr_review_side.push_log`. That reader keeps a found stamp per head for one `wait`, and asks again after a failed or empty read. `PUSHED_KEY` moves to `pr_review_hold.py`, and `pr_review_side.py` imports it from there. - **An on-open ask is read back before the grace is judged** (#4315 thread `PRRT_kwDOQ5caqM651p5b`). `wait` dropped `ask("on-open")`'s result. Take an attested head whose poll never slept, where the after-checks phase sent nothing. The grace was then judged on the snapshot read before the on-open ask. So `wait` could return 0 and say the grace released the merge. Now a request from either phase forces the re-read. Each fix has a test that fails without it. Closes on promotion: none ## Open findings from the local pass - `introduced`, `scripts/pr_review_hold.py` `grace_note`: say a hosted check concluded after an ask with a null `startedAt`. Then the ended-grace note says no hosted reviewer's check registered, though a concluded one is in the rollup. This depends on GitHub returning a concluded check run with no start, which is not shown to occur. The open-grace line and `merge`'s refusal already say "answering the head's newest push or review ask". Outcome: declined, since no observed payload produces the shape. ## Test plan - `python -m unittest discover -s tests` with `tests/requirements.txt` (4611 tests, OK) - `mypy`, `ruff check`, `ruff format --check` - `scripts/prose_lint.py --diff` against the merge base 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Review timing now better accounts for when commits are pushed and review requests are sent, reducing the chance that earlier checks are treated as responses to a newer request. * Side reviewers may be asked when a pull request opens, with a later check to avoid sending the same request twice. * When timing information is unavailable or unreadable, the review process uses a fallback instead of relying on an invalid timestamp. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
…d, and Hub Pin Drift (#4315) ## Summary Promotes `develop` to `main`. It carries these changes: - [#4303](#4303) orders the STANDUP.md seed push, carry commits, and secret hand-over. - [#4304](#4304) forbids state-changing probes and routes observed secrets to revocation. - [#4305](#4305) routes SIGINT and SIGTERM through one handler, bounds the child wait, and states two stop paths. - [#4306](#4306) holds `pr_review.py merge` for a hosted review not registered yet. - [#4309](#4309) reads the branch before the tree so an empty root commit resolves its secrets. - [#4310](#4310) watches the merge bot's auto-merge and re-arms a disable GitHub makes. - [#4311](#4311) counts untracked files in the dirty stamp and states the session tree bound. - [#4314](#4314) reports each caller's hub pin behind the newest release as drift past a 30-day bound. Related issues #4308, #4312, and #4313 stay open. Fixes #1418 Fixes #4137 Fixes #4063 Fixes #4147 Fixes #2598 Fixes #4128 Fixes #4240 Fixes #4229 Fixes #3806 Fixes #4146 Fixes #4100 Fixes #4218 Fixes #4223 Fixes #4228 Fixes #4224 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Repository audits now report outdated reusable-workflow pins as advisories or drift, with advisory findings kept separate from blocking issues. * Merge automation can retry enabling auto-merge after the base branch settles; unsupported target branches and refused merges are reported as failures. * Pull-request checks now account for a brief hosted-review registration window before reporting checks as pending. * **Bug Fixes** * Empty repositories and empty root commits are handled correctly when resolving repository secrets. * Long-running tools improve cleanup and signal handling when interrupted. * **Documentation** * Updated guidance for repository setup, review handling, workflow automation, and safe verification practices. <!-- end of auto-generated comment: release notes by coderabbit.ai -->


Summary
pr_review.py mergecould land a pull request in the gap after a hosted reviewer was asked and before its check registered. Until the check registers the rollup holds nothing of the review, so a head whose other checks have passed reads ready. This adds the registration grace the maintainer chose on #3814 and refined on #3806: option 1, anchored on the head's push, its last check settling, and its newest review ask, with G = 90s.check_nodesnow records when each check settled. For a CheckRun that iscompletedAt, which the held query now reads. For a StatusContext it iscreatedAtonce the context is no longer pending.pr_review_hold.hosted_graceanchors on the latest of three things: the head's push (its earliest suite or check), its last non-hosted check settling, and its newest trusted review ask (@coderabbitai review,@coderabbitai full review, or/reviewfrom an owner, member, or collaborator). It runsHOSTED_GRACE= 90 seconds from that anchor.SKIPPEDand that began at or after the newest ask is on the head. From then on, that check's existing hold decides. A check older than the ask answered an earlier request, so a re-ask still waits for its own check. ASKIPPEDcheck is CodeRabbit's "automatic reviews are disabled" placeholder, which every head here carries about 10s after the push.waitsends its after-checks asks. Where it sent one, it reads the pull request again, because the ask moves the anchor. TheCHECKS_PENDINGline adds(registration grace until: <time>). Awaitthat returns0with no hosted check on the head prints a note. The note says either that the grace released the merge without a hosted check, or, on a head no local pass covers, that the grace still holds andmergerefuses until it ends.unmetrefuses an open grace asCHECKS_PENDING, on a line of its own that names when the grace ends. This is separate from the "a hosted review of the head is running" line.pr_review.pywas at 2198 of its 2200-line ceiling,pr_review_checks.pyat 449 of 450, andpr_review_side.pyat 347 of 350. So the grace, its note, and theCHECKS_PENDINGline builder (with_unmet_note) live in a new pure reader,scripts/pr_review_hold.py, which has a 200-line ceiling.side_command,side_asks,head_arrived, andhosted_checkmoved there frompr_review_side.py, which imports them back.held_checks_open's stuck-check read. So on an attested head, aBLOCKEDmerge with a required check stuck reports30for at most the grace's 90 seconds before44.scripts/README.mdsays so in thewaitparagraph and on the44exit row.Measurement
Read-only reads of the 150 most recently updated merged pull requests in this repository (#4038 to #4300):
SKIPPED"Review skipped: automatic reviews are disabled" check on every head, about 10s after the push (p90 30s). Its check for an actual review appears only after an ask. 89 heads carried such a run: 26 finished, 50 rate limited (an instant neutral), and 13 cancelled. Qodo posts no check in this repository.waitsent the ask minutes after the checks settled. That is why the anchor includes the ask.HOSTED_GRACE= 90s, about 2.7 times the largest measured delay from ask to registration. On a head nobody asks a hosted reviewer to review, the fixed cost is 90s after the checks settle.Verification
python -m unittest discover -s tests: see the CI run. Locally,tests/test_pr_*.py(979 tests) andtests/test_backlog*.pypass, the size ceiling test included.TestRegistrationGracecover:SKIPPEDcheck versus any other hosted conclusion;CHECKS_PENDINGline;merge's separate refusal line.TestClicases cover the hold and its release on a held head, and the extra read after a sent ask, which happens only when an ask was sent. Three existingwaitfixtures now date their head past the grace.unittest discover -s testsrun passed locally on the first commit (4559 tests).Local review
There were three recorded
local-strict-reviewpasses. The first raised seven findings and the second raised two, and both rounds' fixes are in this branch. The third raised none. The declined findings are these:Grace ignores the review policy (
introduced, declined). On Decide: Which Signal Should Hold pr_review.py merge for a Hosted Review Whose Status Has Not Registered Yet #3814 the maintainer chose a grace that reads no reviewer configuration, with its fixed, bounded delay accepted. A policy can also understate a reviewer that is installed, and reading it would then drop the hold.ASK_BODIESrepeatspr_review_policy.COMMANDS(introduced, declined).pr_review_policyimportssubprocess, which the reader contract test forbids a pure reader to load.stamp()repeats the formatter insecrets_sync.py(introduced, declined). The same reader contract rules that import out.Skill drift (
introduced, reported to the backlog-burndown orchestrator, outside this pull request's files). Two skills still describe the old refusal:.agents/skills/pr-review-conduct/SKILL.md"Merge Gate" item 2 names only a running hosted check as aCHECKS_PENDINGrefusal..agents/skills/drive-pr/SKILL.mdstep 4next=redrivesays aCHECKS_PENDINGrefusal clears bygh pr checks --watch, which returns at once for a grace refusal.The refusal line itself now names the time to run
mergeagain.Closes on promotion: #3806
🤖 Generated with Claude Code