Repository navigation
[3727 by Claude Opus 5.5] PR status line: stop spending the App installation rate limit on unchanged or bursty edits - #3734
Conversation
…. ProPR already sent no edit when the rendered status was unchanged, and already held check-count edits to at most one per pull request every 30 seconds, using Redis. The missing piece was the rate-limit check, and I've added it. What it does now - Where the budget comes from: a new file, `pullRequestStatusRateBudget.ts`, wraps the GitHub client for each status update. It reads `x-ratelimit-remaining` and `x-ratelimit-reset` from the update's own responses. Each update reads the pull request right before deciding, so every worker sees a fresh value and nothing needs to be shared between processes. - Threshold: fewer than 500 requests left (10% of the smallest installation limit). Below that, `decideStatusBodyEdit` in `pullRequestStatusEditPacing.ts` skips any edit that would only change check progress. It tries again when the limit resets, but no sooner than 60 seconds and no later than 10 minutes. - What is never delayed: status changes a person waits on (run started or finished, review score, ready to merge, suspended), title renames, and every write outside the status line: opening the PR, summaries, review comments, labels. - Logging: each skip writes one log warning with the repository, PR number, requests remaining, threshold and reset time. Nothing is posted on the pull request. - Status text: unchanged. - Docs: `docs/docs/features/pr-status.md` now says check progress can lag by up to 30 seconds, and describes the low-budget rule. Tests (in `packages/core/test/pullRequestStatusSync.test.ts`; the fake GitHub client can now report a remaining budget): - Identical status: five updates with nothing new send no write requests. - 20 check completions in the window: one or two edits in total, and the last one shows "20 passed, 1 pending". - Low budget (40 left): check-count edits are skipped and logged once each. The run finishing still writes "✅ Ready", a completion summary written to the PR body still goes out, and check-count edits resume once the budget recovers. - Negative check: with the budget skip turned off, the low-budget test fails. - Overall: all 255 status tests pass, and core's typecheck and lint are clean. The fix saves edits, not reads. Each check completion still triggers the reads needed to work out the status, and those count against the same rate limit. Cutting those reads would mean changing how check-completion updates are scheduled, which I left out of this change. I didn't make a visual preview, since nothing in the UI changes.
|
/ultrafix goal=8 max=3 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 3) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThis PR adds a narrowly scoped rate-budget guard for check-progress edits while preserving immediate status transitions and unrelated writes. It is merge-ready within the reviewed scope, conditional on the four pending test shards passing. ✅ Selective suppression — The budget guard runs after unchanged-status detection and the bypass for title renames and substantive status changes. ✅ Fresh budget observation — The request wrapper observes response headers, including the final pull-request read before the edit decision. ✅ Focused coverage — Added tests cover suppressed check-progress writes, logging, completion transitions, summary preservation, and recovery after the budget improves. Review conclusions are based on static inspection of the supplied diff and surrounding code. No commands or tests were run. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Cover scheduled budget recoveryThe low-budget test exercises recovery through explicit sync calls. An additional scheduler test could verify that a suppressed edit automatically schedules another read and eventually publishes the latest counts without a new webhook. Boundary tests for the 60-second minimum, 10-minute maximum, and missing reset header would also help protect the retry policy. These are optional coverage improvements; the supplied control flow passes the retry delay into the existing scheduler. ScoreThe implementation is focused, preserves the relevant write boundaries, and has useful behavioral coverage. No merge blockers were verified; the authoritative check summary reports no failures, with four test shards still pending. Score: 9/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
AI Implementation Summary
Closes #3727
Branch:
3727/claude-opus-5-5-pr-status-line-stop-spend-20261119-0926-bz6Commits: ✅ Changes committed (c8aa34e)
AI Processing Completed
Execution Details:
Summary:
Most of what the issue asks for was already in place before I started. ProPR already sent no edit when the rendered status was unchanged, and already held check-count edits to at most one per pull request every 30 seconds, using Redis. The missing piece was the rate-limit check, and I've added it.
What it does now
pullRequestStatusRateBudget.ts, wraps the GitHub client for each status update. It readsx-ratelimit-remainingandx-ratelimit-resetfrom the update's own responses. Each update reads the pull request right before deciding, so every worker sees a fresh value and nothing needs to be shared between processes.decideStatusBodyEditinpullRequestStatusEditPacing.tsskips any edit that would only change check progress. It tries again when the limit resets, but no sooner than 60 seconds and no later than 10 minutes.docs/docs/features/pr-status.mdnow says check progress can lag by up to 30 seconds, and describes the low-budget rule.Tests (in
packages/core/test/pullRequestStatusSync.test.ts; the fake GitHub client can now report a remaining budget):The fix saves edits, not reads. Each check completion still triggers the reads needed to work out the status, and those count against the same rate limit. Cutting those reads would mean changing how check-completion updates are scheduled, which I left out of this change.
I didn't make a visual preview, since nothing in the UI changes.
Review digest
Risk-tiered paths
packages/core/src/services/pullRequestStatus/pullRequestStatusEditPacing.ts(+10/−2)packages/core/src/services/pullRequestStatus/pullRequestStatusRateBudget.ts(added, +87/−0)packages/core/src/services/pullRequestStatus/pullRequestStatusSync.ts(+7/−4)docs/docs/features/pr-status.md(+2/−1)packages/core/test/pullRequestStatusSync.test.ts(+93/−0)Diff size: 5 files changed, +199/−7 lines
View task for the run's logs and conversation.
This PR was created automatically by ProPR after processing issue #3727.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!