Skip to content

Read CodeRabbit's Command-Reply Rate Limit in pr_review.py - #3128

Merged
ptr727 merged 6 commits into
developfrom
feature/auto-1425
Oct 16, 2026
Merged

ptr727 merged 6 commits into
developfrom
feature/auto-1425

Conversation

@ptr727

@ptr727 ptr727 commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

scripts/pr_review.py read CodeRabbit's rate limit only from the auto-review notice's auto-generated comment: rate limited by <service> --> marker. An explicit @coderabbitai review that CodeRabbit cannot run comes back in a second shape, an auto-generated reply marker over an Action not completed block saying Review rate limited.. That shape never matched. On a repository where CodeRabbit never auto-reviews, it is the only rate limit the digest can meet, so other_rate_limited read the same for "asked and limited" as for "never asked".

  • RATE_LIMITED_REPLY reads the reply shape from its markers and the block's fixed text alone, never the prose around them.

  • rate_limited_by checks the existing marker first, then the reply shape. The reply's marker says CodeRabbit rather than coderabbit.ai, so RATE_LIMIT_SERVICE names the service by login. That gives the same other_rate_limited=coderabbitai:coderabbit.ai reading as the auto-review notice. A login missing from that map stays unread.

  • Tests in tests/test_pr_review.py cover these cases, all built from constructed comment bodies:

    • the reply shape reading as rate limited, both through rate_limited_by and through the digest field
    • the auto-review marker reading as before
    • an ordinary CodeRabbit summary marker, and two near misses, reading as not rate limited
    • an unmapped login's reply staying unread

    With the reply branch disabled, the new tests fail.

The issue's side question, whether a limit with no stated retry time should read differently from one with a countdown, is out of scope here, and that reading is unchanged.

Closes on promotion: #1425

Local review findings from the opening push

The pre-push pass's edit budget was spent on the opening push. It left these introduced findings open. Each is fixed in 243f674, and the pass over that push raised none:

  • introduced: scripts/pr_review.py, three # comments near RATE_LIMITED and in digest still describe one marker shape and service names taken from the marker.
  • introduced: scripts/pr_review.py, in the rate_limited_by docstring, "both observed shapes ride a plain PR comment" is given as the reason for reading both connections, which it does not support.
  • introduced: tests/test_pr_review.py, a test docstring says the reply "names no service", which contradicts the code docstring.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Rate-limit notices in CodeRabbit’s automatic review replies are now recognized alongside existing notices.
    • Digest comments now reflect the latest rate-limit notices from tracked reviewers, including supported automatic replies. Replies from unrecognized reviewer accounts are not attributed to a service.

ptr727 and others added 3 commits October 16, 2026 00:20
An explicit `@coderabbitai review` that CodeRabbit cannot run gets back an
`auto-generated reply` marker over an `Action not completed` block saying
`Review rate limited.`, a shape RATE_LIMITED never matched. On a repository
where CodeRabbit never auto-reviews, that was the only rate limit the digest
could meet, so `other_rate_limited` read the same for "asked and limited" as
for "never asked".

rate_limited_by now reads that shape from its markers and fixed block text,
naming the service by login since the marker names none, and surfaces it in
the same `other_rate_limited` field. The auto-review marker reads as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the login fallback for an unmapped reviewer, which no input reaches,
so a reply-shape notice from a login with no known service stays unread
as the auto-review marker's own comment says. Correct the docstrings that
said the reply marker names no service, and split the sentences the
sentence-length check flagged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the reply pattern's comment spans from running past a closing
"-->", say the reply lands in the same field by a pattern of its own,
move the not-head-scoped reason into the reader's docstring, and test
that a reply from a login with no known service stays unread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings October 16, 2026 07:30
@ptr727

ptr727 commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 1b9668372f20d3af031659167627972b5c2f184a, the content this pull request carries at that commit against develop, and it recorded 3 findings.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 767fb185-6b79-4fa8-bc58-108c20cf485e
📥 Commits

Reviewing files that changed from the base of the PR and between 40a131c and c2ac919.

📒 Files selected for processing: 2
  • scripts/pr_review.py
  • tests/test_pr_review.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The review script now recognizes CodeRabbit’s automatic rate-limit replies as well as existing structural markers. It identifies the service from the reviewer login and updates digest descriptions to refer to newest rate-limit notices.

Changes: Rate-limit detection

Layer / File(s) Summary
Reply recognition and digest updates
scripts/pr_review.py, tests/test_pr_review.py
The script recognizes replies containing “Action not completed” and “Review rate limited.” It maps the coderabbitai login to coderabbit.ai; unmatched reply formats and unmapped logins return no service name. Digest descriptions and tests cover the updated behavior.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to c2ac9

No merge-blocking issue is identified; the change is ready for normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main change: adding support for CodeRabbit command-reply rate-limit detection in pr_review.py.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (1 skipped: 1 …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (1 skipped: 1 too large.)

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Oct 16, 2026
The comments near RATE_LIMITED and in digest still described one marker
shape and a service name taken from the marker. The rate_limited_by
docstring gave the plain-comment observation as the reason for reading
both connections, and a test docstring said the reply names no service.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ptr727

ptr727 commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 243f67483035719477a465b45d34cffb17108284, the content this pull request carries at that commit against develop, and it recorded 0 findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation and tests cover the new behavior; remaining findings are documentation nits.

2 open findings
What changed in this PR

Adds CodeRabbit command-reply rate-limit detection and related test coverage.

Changes:

  • Parses reply-shaped rate-limit messages.
  • Maps logins to service names in digest output.
  • Adds positive, near-miss, and unmapped-login tests.
  • Updates related documentation.
File Summary
tests/​test_pr_review.py Tests reply detection and attribution edge cases.
scripts/​pr_review.py Detects and reports CodeRabbit reply rate limits.

🧠 Review effort: Lite


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/pr_review.py
Comment thread tests/test_pr_review.py Outdated
@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@40a131c). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #3128   +/-   ##
==========================================
  Coverage           ?   63.97%           
==========================================
  Files              ?       17           
  Lines              ?     9151           
  Branches           ?        0           
==========================================
  Hits               ?     5854           
  Misses             ?     3297           
  Partials           ?        0           
Flag Coverage Δ
python-3.13 63.97% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ptr727 and others added 2 commits October 16, 2026 00:46
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ptr727

ptr727 commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head c2ac919936b107f65fd92787fcb3f43d8aad5e0a, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@ptr727

ptr727 commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit ddd7ddb into develop Oct 16, 2026
13 checks passed
@ptr727
ptr727 deleted the feature/auto-1425 branch October 16, 2026 08:00
ptr727 added a commit that referenced this pull request Oct 16, 2026
… Fixes to Main (#3146)

- #3135 makes `gh-write-guard` read a gh write's subcommand and target
the way gh parses them: the subcommand is found past flags before the
command and before the subcommand, an `R` inside a short-option cluster
is read as a target, `GH_REPO` is read as a target, a run-time
repository owner on a write fails closed, and a run-time word where `pr`
or `merge` goes fails closed beside `--admin` or where word splitting
may split it
- #3139 releases the bootstrap lock when a `bootstrap.ps1` run ends
rather than when its process does, so a second run typed at the same
pwsh prompt is no longer refused the lock
- #3130 matches tool names and the `all` keyword by case in the Windows
agents loaders, as the Linux loaders already do
- #3128 reads CodeRabbit's rate limit on a reply to an explicit review
command in `pr_review.py`
- #3126 reconciles VSCode-Server-DotNetCore in the hub after its resync
- #3124 logs the Docker task's build-base leg in to Docker Hub
- #3122 names the carried skill and the skipped review correctly
- #3120 states the subprocess encoding rule in `CODESTYLE.md`, where
carriers read Python style
- #3118 and #3111 move the release-guard tests' workflow-command checks
onto `runner_commands`, and test the alternatives wiring at the
`audit_repo` and `fidelity_pass` call sites
- #3116 stops the doc gates' printed names forging workflow commands
- #3113 adds a catalog snippet for the release-with-smoke caller
- #3109 moves the `workflow_reuse` fetch onto `audit.contents_text`
- #3105 accepts `.codecov.yml` as an alternative to `codecov.yml`
- #3103 adds a pip ecosystem to the carried Dependabot snippet
- #3100 prefers the venv's ruff and pyright for a declared pip directory
- #3098 tracks composite action pins in Dependabot
- #3096 reads an uppercase Markdown suffix as Markdown at every prose
gate branch

After this merges, the host-safety installer payload changes, so the
maintainer runs the installer after promotion.

Closes #1416
Closes #1425
Closes #1578
Closes #1874
Closes #1892
Closes #1899
Closes #2804
Closes #2850
Closes #2852
Closes #2854
Closes #2996
Closes #3065
Closes #3067
Closes #3069
Closes #3079
Closes #3080
Closes #3089
Closes #3093
Closes #3101
Closes #3106
Closes #3107
Closes #3137

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Added a pull-request smoke build that runs when relevant release files
change and reports the combined validation and build status.
* Repository audits now recognize `.codecov.yml` as an alternative to
`codecov.yml`.

* **Improvements**
* Python linting and type checks use tools from declared project
environments when available, with fallbacks for missing tools.
* Workflow and lint reports safely display unusual filenames and
command-like text.
* GitHub write-target checks now account for additional command forms
and fail closed when targets cannot be verified.
* Rate-limit detection now recognizes another CodeRabbit response
format.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants