Skip to content

Make comment router resilient to GitHub throttling - #1155

Merged
steipete merged 2 commits into
mainfrom
steipete/router-throttle-resilience
Aug 14, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/router-throttle-resilience

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • make installation-rate-limit, abuse-limit 403, and 429 failures a structured github_throttled defer instead of an uncaught router crash
  • persist an oldest-first per-repository scan cursor only after a complete successful cycle, while retaining throttled commands as waiting and completing already-routable work
  • bound repository-wide comment discovery from the saved watermark without weakening the full per-item histories used by source-revision and status guards

Production evidence: repair comment router run 31697514690 failed on the full comment-history read for openclaw/openclaw#120500 after the installation bucket was exhausted.

Behavior proof

  • Claim: GitHub installation/abuse throttles defer safely with exit 0, partial routing progress is durable, and the scheduled cursor never advances past unrouted comments; unrelated errors remain fatal.
  • Exercised surface: the production repair:comment-router wrapper, real child process, GitHub CLI boundary, router report/ledger, scheduled cursor artifact, and workflow publication contract.
  • Scenario/fixture: real loopback HTTP selected through GITHUB_API_URL, serving GitHub's production installation 403 body plus abuse 403, 429, recovered-success, same-timestamp-id, mixed routable/throttled, and non-throttle 422 cases.
  • Command/environment: Docker-backed Crabbox provider=local-container, lease cbx_6efbcfb3f874 (coral-barnacle-e30e), run run_4fe08202fe1b, Ubuntu 26.04 arm64, Node 24.19.0; bash docs/proof/router-throttle-resilience/run-proof.sh after pnpm run build:all.
  • Observable result: 15 focused tests passed, all eight runtime assertions passed, 32 loopback requests were observed, exit code was 0, and Crabbox stopped the lease.
  • Artifact/trace: docs/proof/router-throttle-resilience/ contains the contract, static jq recipe, Git rev-parse/cat-file cross-check, red/green result, behavior report, transcript, and receipt.
  • Limits: GitHub was a deterministic loopback fixture with synthetic credentials. No live GitHub mutation or production workflow dispatch was performed. The proof receipt commit contains no runtime changes after tested runtime commit 7d991891672e29f6f5d09961a7a34b205e2602cd.

OpenClaw Bay is unaffected: this changes an internal operator workflow and git-backed cursor, not Bay's public observer-only status contract.

Testing

  • pnpm run check
  • node --test test/repair/comment-router-throttle-resilience.test.ts test/repair/comment-router-action-ledger.test.ts test/repair/comment-router-core.test.ts test/repair/comment-router-utils.test.ts test/repair/github-cli.test.ts test/repair/workflow-sparse-checkout.smoke.ts test/clawsweeper-action-ledger.test.ts test/state-writer-workflow.test.ts
  • pnpm run review -- --local-range --target-repo openclaw/clawsweeper --base origin/main
  • Docker-backed Crabbox proof above

Read economy

Repository-wide discovery now uses bounded since=<cursor> pages with sort=updated&direction=asc. Per-item histories remain complete because they feed source-revision hashes, linked-PR discovery, historical command/status idempotency, review-lease checks, and close guards; applying the scan cursor to those reads would silently weaken safety semantics.

@steipete
steipete requested a review from a team as a code owner August 13, 2026 12:23
@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@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. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 13, 2026, 7:22 PM ET / 23:22 UTC.

ClawSweeper review

What this changes

The PR turns GitHub throttle failures into durable comment-router deferrals and adds a per-repository cursor for bounded scheduled comment discovery.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Needs maintainer review before merge - 2 items remain

Keep open: the supplied proof is strong, but this review environment could not execute even read-only checkout inspection, so the current-head source, full diff, history, and maintainer notes could not be independently audited. Likely related person: steipete (current implementation author; low-confidence routing only).

Priority: P2
Reviewed head: c83b08bc2cae83554c827f6a59915d8564c3c7ed

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The contributor proof is unusually concrete, but patch quality cannot be rated above C until a reviewer can inspect the complete current-head source and workflow diff.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The PR supplies after-fix Docker-backed Crabbox evidence through the production router wrapper, real child process, and loopback GitHub CLI boundary, with observable deferred and recovered outcomes.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR supplies after-fix Docker-backed Crabbox evidence through the production router wrapper, real child process, and loopback GitHub CLI boundary, with observable deferred and recovered outcomes.
Evidence reviewed 3 items Contributor real-behavior proof: The PR body describes a Docker-backed Crabbox loopback run through the production router wrapper and GitHub CLI boundary, covering installation 403, abuse 403, 429, recovery, same-timestamp cursor handling, and fatal 422 behavior; it records 15 focused tests and eight passing runtime assertions.
Declared production failure: The PR body links a failed production repair-comment-router run where full comment-history hydration encountered exhausted installation rate limit, establishing a concrete operational motivation for the change.
Local inspection infrastructure failure: Read-only commands in the target checkout failed before producing command output with bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted; therefore no current-main or PR-head source/history assertions were made from local inspection.
Findings None None.
Security None None.

How this fits together

The repair comment router turns repository comments into durable review and repair actions. It reads GitHub comment history, writes a ledger and scan cursor, then the scheduled workflow publishes that state for later processing.

flowchart LR
  A[GitHub comments] --> B[Comment router]
  B --> C[Throttle classification]
  C --> D[Routing ledger]
  D --> E[Scheduled scan cursor]
  E --> F[State publication workflow]
Loading

Before merge

  • Resolve merge risk (P1) - The PR changes durable router state and workflow publication, but the full current-head diff and upgrade behavior could not be independently inspected because the read-only checkout command sandbox failed.
  • Complete next step (P2) - No repair routing is appropriate: the supplied evidence indicates a coherent implementation, while this environment could not complete the independent source audit required for a merge verdict.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 15 files affected; +1,036 / -5 lines The change spans router runtime, workflow publication, tests, and committed proof, so a complete current-head audit matters before landing.

Merge-risk options

Maintainer options:

  1. Complete a current-head source audit (recommended)
    Before merge, independently inspect the router, runner, workflow publication paths, and cursor compatibility on the exact PR head.

Technical review

Best possible solution:

Preserve the bounded cursor and throttle-defer design if a fresh full current-head review confirms cursor persistence, retry behavior, and workflow publication remain safe across upgrades.

Do we have a high-confidence way to reproduce the issue?

Yes—the contributor provides a specific deterministic loopback reproduction and recorded after-fix output, but this reviewer could not independently run it because read-only checkout commands failed in the sandbox.

Is this the best way to solve the issue?

Unclear—the structured defer plus successful-cycle cursor advance is a plausible narrow solution, but the local source and complete diff could not be inspected to confirm all compatibility paths.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4d41d3df4baf.

Labels

Label changes:

  • add P2: This is a bounded reliability improvement to internal comment-routing automation with no demonstrated current user outage.
  • add merge-risk: 🚨 automation: The PR changes scheduled router execution, durable cursor publication, and throttle exit handling, so an error could affect automated review routing.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR supplies after-fix Docker-backed Crabbox evidence through the production router wrapper, real child process, and loopback GitHub CLI boundary, with observable deferred and recovered outcomes.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR supplies after-fix Docker-backed Crabbox evidence through the production router wrapper, real child process, and loopback GitHub CLI boundary, with observable deferred and recovered outcomes.

Label justifications:

  • P2: This is a bounded reliability improvement to internal comment-routing automation with no demonstrated current user outage.
  • merge-risk: 🚨 automation: The PR changes scheduled router execution, durable cursor publication, and throttle exit handling, so an error could affect automated review routing.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR supplies after-fix Docker-backed Crabbox evidence through the production router wrapper, real child process, and loopback GitHub CLI boundary, with observable deferred and recovered outcomes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR supplies after-fix Docker-backed Crabbox evidence through the production router wrapper, real child process, and loopback GitHub CLI boundary, with observable deferred and recovered outcomes.

Evidence

What I checked:

  • Contributor real-behavior proof: The PR body describes a Docker-backed Crabbox loopback run through the production router wrapper and GitHub CLI boundary, covering installation 403, abuse 403, 429, recovery, same-timestamp cursor handling, and fatal 422 behavior; it records 15 focused tests and eight passing runtime assertions. (docs/proof/router-throttle-resilience/container-receipt.json:1, c83b08bc2cae)
  • Declared production failure: The PR body links a failed production repair-comment-router run where full comment-history hydration encountered exhausted installation rate limit, establishing a concrete operational motivation for the change. (docs/proof/router-throttle-resilience/README.md:1, 7d991891672e)
  • Local inspection infrastructure failure: Read-only commands in the target checkout failed before producing command output with bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted; therefore no current-main or PR-head source/history assertions were made from local inspection.

Likely related people:

  • steipete: Authored the two commits supplied for this PR, including the runtime change and the proof-artifact commit; no broader current-main ownership trail could be inspected. (role: current implementation author; confidence: low; commits: 7d991891672e, c83b08bc2cae; files: src/repair/comment-router.ts, scripts/comment-router-runner.mjs, .github/workflows/repair-comment-router.yml)

Rank-up moves

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

  • Obtain a fresh complete current-head review once checkout inspection is available.

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.

@steipete
steipete merged commit dc738b3 into main Aug 14, 2026
20 checks passed
@steipete
steipete deleted the steipete/router-throttle-resilience branch August 14, 2026 00:33
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. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant