Skip to content

fix(apply): close-mode apply yields on GitHub rate limit instead of failing mid-scan - #1166

Merged
steipete merged 1 commit into
mainfrom
steipete/close-mode-throttle-yield
Aug 14, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/close-mode-throttle-yield

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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 GitHubRateLimitError during 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-only and kept close mode loud. Production evidence says that split was wrong: GitHubRuntimeBudgetError already 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 recording workflow_failure telemetry for routine quota weather.

This drops the sync_comments_only gate so GitHubRateLimitError takes the same yield rail in all apply modes.

Evidence

  • Updated regression tests: both comment-sync and close-mode rate-limited runs now exit 0 with skipped_runtime_budget results (apply resumes next cycle) and byte-identical record files; 259/259 apply+reconcile tests pass.
  • pnpm run lint and pnpm run check:static clean.
  • Codex-backed autoreview: clean, no accepted/actionable findings (patch is correct, 0.98).

…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.
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 14, 2026, 4:19 AM ET / 08:19 UTC.

ClawSweeper review

What this changes

The 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 provenance

Possible 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
Reviewed head: 008c8651a70f18072dd21c7fdfc32677ab9844db

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and source-supported, but mock-only proof remains a merge gate.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body reports mocked regression tests and static checks, but no after-fix production-boundary trace of a throttled close-mode apply yielding and resuming; add redacted runtime evidence. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports mocked regression tests and static checks, but no after-fix production-boundary trace of a throttled close-mode apply yielding and resuming; add redacted runtime evidence. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Current main behavior: Current main still limits rate-limit yielding to comment-only sync, so the central close-mode behavior is not already implemented.
Proposed implementation: The PR removes the comment-only gate and routes the rate-limit error through the existing yield callback.
Focused fixture is mock-only: The updated test simulates a rate-limited gh response and checks yielded results plus unchanged record files; it does not provide an after-fix production-boundary trace.
Findings 1 actionable finding [P3] State the OpenClaw Bay impact
Security None None.

How this fits together

The 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]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports mocked regression tests and static checks, but no after-fix production-boundary trace of a throttled close-mode apply yielding and resuming; add redacted runtime evidence. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • State the OpenClaw Bay impact (P3) - This changes apply workflow finalization behavior. The repository policy requires the PR body or handoff to state whether OpenClaw Bay is affected; the body still lacks that declaration despite the prior review finding. Add a concise no-impact statement or the required Bay update and proof.
  • Resolve merge risk (P1) - Without an after-fix production-boundary trace, the changed close-mode yield, cursor recovery, and clean workflow finalization are demonstrated only by a mocked gh fixture.
  • Complete next step (P2) - Human-only merge blocker: the contributor must add real behavior proof and resolve the Bay declaration; a repair worker cannot substitute for that evidence.

Findings

  • [P3] State the OpenClaw Bay impact — src/clawsweeper-command-operations.ts:595-603
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 3 files affected: production -2 net lines, tests +8 net lines, changelog +1 line The behavioral change is narrowly localized to apply error handling and its focused regression coverage.

Merge-risk options

Maintainer options:

  1. Add production-boundary recovery proof (recommended)
    Capture the throttled close-mode apply yield and next-cycle recovery at the PR head, then record the OpenClaw Bay no-impact statement before merge.

Technical review

Best 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:

  • [P3] State the OpenClaw Bay impact — src/clawsweeper-command-operations.ts:595-603
    This changes apply workflow finalization behavior. The repository policy requires the PR body or handoff to state whether OpenClaw Bay is affected; the body still lacks that declaration despite the prior review finding. Add a concise no-impact statement or the required Bay update and proof.
    Confidence: 0.99

Overall correctness: patch is correct
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 746cb858bf00.

Labels

Label justifications:

  • P2: Rate-limit handling affects scheduled close-mode throughput but is a bounded automation reliability improvement.
  • merge-risk: 🚨 automation: The PR changes how the apply workflow finalizes and resumes after GitHub throttling.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports mocked regression tests and static checks, but no after-fix production-boundary trace of a throttled close-mode apply yielding and resuming; add redacted runtime evidence. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Current main behavior: Current main still limits rate-limit yielding to comment-only sync, so the central close-mode behavior is not already implemented. (src/clawsweeper-command-operations.ts:596, 746cb858bf00)
  • Proposed implementation: The PR removes the comment-only gate and routes the rate-limit error through the existing yield callback. (src/clawsweeper-command-operations.ts:595, 008c8651a70f)
  • Focused fixture is mock-only: The updated test simulates a rate-limited gh response and checks yielded results plus unchanged record files; it does not provide an after-fix production-boundary trace. (test/apply-live-state.test.ts:2932, 008c8651a70f)
  • Feature history: The prior merged comment-only rate-limit yield was introduced by the same area contributor, and a later apply-read refactor maintained the surrounding path. (src/clawsweeper-command-operations.ts:595, 82d9ba983abd)
  • Not on main or a release: The PR head is not an ancestor of current main, and no local release tag contains it. (008c8651a70f)
  • Repository proof and Bay policy: The applicable policy requires current real-behavior proof for code-bearing changes and a PR or handoff statement explaining whether OpenClaw Bay is affected. (AGENTS.md:74, 746cb858bf00)

Likely related people:

  • steipete: Peter Steinberger authored the merged comment-only rate-limit yield and the subsequent apply-read refactor surrounding this catch path. (role: introduced related behavior and recent area contributor; confidence: high; commits: 82d9ba983abd, c9eda83c29d2; files: src/clawsweeper-command-operations.ts, test/apply-live-state.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a redacted production-boundary rate-limit recovery trace at the current head.
  • State the OpenClaw Bay no-impact conclusion in the PR body.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-14T08:09:35.964Z sha 008c865 :: needs real behavior proof before merge. :: [P3] State the OpenClaw Bay impact

@steipete steipete closed this Aug 14, 2026
@steipete steipete reopened this Aug 14, 2026
@steipete
steipete merged commit 386730f into main Aug 14, 2026
18 checks passed
@steipete
steipete deleted the steipete/close-mode-throttle-yield branch August 14, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant