Repository navigation
fix(apply): close-mode apply yields on GitHub rate limit instead of failing mid-scan - #1166
Conversation
…ailing mid-scan Production runs after #1160 showed close-mode apply still losing entire 600-record scan windows to mid-run 403s (e.g. run 31780550963 died 17 minutes in during per-item comment pagination). Quota exhaustion now takes the same runtime-budget yield in every apply mode: closes are per-item verified and checkpointed, the cursor trace returns the interrupted item to the next window, and apply events finalize as a clean yield.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 14, 2026, 4:19 AM ET / 08:19 UTC. ClawSweeper reviewWhat this changesThe PR makes close-mode apply treat a GitHub rate limit as a resumable yield, updates the focused regression test, and adds release-note context. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain Keep open: the focused automation change appears correct, but it still lacks required after-fix real-behavior proof and the previously requested OpenClaw Bay impact statement. Priority: P2 Review scores
Verification
How this fits togetherThe apply lane reads reviewed records and live GitHub item/comment state before syncing comments or closing eligible items. Its runtime-budget handler records a resumable yield for workflow finalization and the next scheduled scan. flowchart LR
A[Scheduled apply job] --> B[Reviewed records]
B --> C[Live GitHub reads]
C --> D{Rate limited?}
D -- Yes --> E[Checkpointed yield]
E --> F[Cursor and next scan]
D -- No --> G[Comment sync or close]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Add a redacted Crabbox local-container trace at this head showing a production apply runner and real gh client handling an injected close-mode live-read throttle, yielding without unintended mutation and resuming on the next scan; state that Bay is unaffected because no observer contract changes. Do we have a high-confidence way to reproduce the issue? Yes for a controlled source reproduction: the focused fixture drives a close-mode live-read rate limit into the new yield path. A real after-fix apply-run trace has not yet been supplied. Is this the best way to solve the issue? Yes, conditionally: routing a rejected live read through the existing resumable-yield rail is the narrowest repair, provided production-boundary recovery proof confirms the claimed workflow behavior. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 746cb858bf00. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
What Problem This Solves
After #1158 and #1160, close-mode apply runs start reliably and comment sync yields cleanly — but the close-mode scan itself still fails loudly on a mid-run throttle. Run 31780550963 scanned for 17 minutes, then lost the rest of its 600-record window to an uncaught
GitHubRateLimitErrorduring per-item comment pagination (LiveReadGeneration.read→ghPagedContextWindow). Under sustained installation-quota pressure this repeats every cycle, which is why real closes were running at ~4/hour despite ~1,500 policy-eligible candidates.Why This Change Was Made
#1160 deliberately scoped the yield to
--sync-comments-onlyand kept close mode loud. Production evidence says that split was wrong:GitHubRuntimeBudgetErroralready yields gracefully in every apply mode, and quota exhaustion is the same "out of resource, resume next cycle" situation. Nothing about close mode makes a loud failure safer — closes are per-item live-verified and checkpointed, the cursor trace advances only through examined records and returns the interrupted item to the next window, and apply events finalize as a clean yield either way. The only effect of the loud failure was discarding the remaining scan window and recordingworkflow_failuretelemetry for routine quota weather.This drops the
sync_comments_onlygate soGitHubRateLimitErrortakes the same yield rail in all apply modes.Evidence
skipped_runtime_budgetresults (apply resumes next cycle) and byte-identical record files; 259/259 apply+reconcile tests pass.pnpm run lintandpnpm run check:staticclean.patch is correct, 0.98).