Skip to content

fix(router): fall back when public reads are throttled - #1054

Merged
giodl73-repo merged 2 commits into
openclaw:mainfrom
giodl73-repo:fix/comment-router-public-read-fallback
Aug 7, 2026
Merged

giodl73-repo merged 2 commits into
openclaw:mainfrom
giodl73-repo:fix/comment-router-public-read-fallback

Conversation

@giodl73-repo

@giodl73-repo giodl73-repo commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary - retry public OpenClaw read-only requests once with the target GitHub App token when the public-read installation is rate limited - preserve explicit credential, mutation, request-body, and non-GitHub-host boundaries - keep fail-closed GitHubRateLimitError behavior when the App credential is also throttled ## Validation - tsc -p tsconfig.repair.json - node --test test/repair/github-cli.test.ts - node --test test/repair/comment-router-action-ledger.test.ts - focused oxlint and oxfmt checks ## Live behavior proof - Before the fix, targeted router run 31146506671 failed with GitHubRateLimitError while reading openclaw/openclaw#115962 through the public-read installation. - At the PR head, targeted router run 31147295076 completed successfully and durably dispatched the pending exact-head re-review command for openclaw/openclaw#115962 (router-cad155ddf31271d5). - The immediate default-branch downstream worker run 31147323386 failed eleven seconds later with the same installation-level HTTP 403. This confirms the public installation remained throttled during the successful PR-head router run; quota recovery did not mask the result. - CI's router credential-boundary suite confirms mutations and explicit credentials remain on their configured token paths. If the fallback App credential is also throttled, the helper still raises GitHubRateLimitError immediately.

Bounded escalation policy

The fallback budget is process-wide and keyed by the target App credential: at most one eligible throttled public read can escalate during a router run. Every later public throttle fails closed with GitHubRateLimitError. The regression test now covers a successful sync fallback, a repeated throttled read failing closed, a successful async fallback under a separate credential boundary, and a subsequent privileged mutation retaining the App-token path.

Retry public OpenClaw reads once with the target GitHub App token when the public-read installation is rate limited. Explicit credentials, mutations, request bodies, and non-GitHub hosts keep their existing credential boundaries.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 3cdcdb00-ade8-4e61-85a7-8151b35f216a
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. labels Aug 7, 2026
@clawsweeper

clawsweeper Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 7, 2026, 12:37 AM ET / 04:37 UTC.

ClawSweeper review

What this changes

The PR retries an eligible throttled public OpenClaw read with the target App credential once, with tests for repeated throttles and credential boundaries.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: current main turns an eligible public-read throttle into a rate-limit error, while this PR adds a one-per-App-token recovery path and addresses the prior App-quota finding.

Priority: P1
Reviewed head: 5fb8989ebe4484b279698a68fbfe1182d1825f22

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with strong live proof, regression coverage, and the earlier quota-preservation blocker addressed.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides before-and-after real router Action evidence, including a downstream public-token 403 after the successful current-head fallback.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides before-and-after real router Action evidence, including a downstream public-token 403 after the successful current-head fallback.
Evidence reviewed 6 items Current-main behavior: Current main immediately raises GitHubRateLimitError for a throttled retryable read, so the requested recovery behavior is not already implemented.
Bounded fallback implementation: The PR retries only an eligible throttled read with explicit App-token options; a process-wide claim prevents a second escalation for that App credential.
Regression coverage: The new test proves one successful fallback, a repeated public throttle failing closed, async fallback under another credential, and a later mutation retaining its App token.
Findings None None.
Security None None.

How this fits together

The repair comment router reads public OpenClaw issue and PR state before dispatching review work. Public reads normally use a lower-privilege token, while privileged dispatches and mutations use the ClawSweeper App credential.

flowchart LR
  A[Router read request] --> B[Eligible public-read check]
  B --> C[Public GitHub credential]
  C --> D{Throttled?}
  D -->|No| E[Read result]
  D -->|Yes, first time| F[Bounded App-token fallback]
  F --> G[Dispatch decision]
  D -->|Later throttle| H[Fail closed and defer]
Loading

Before merge

  • Resolve merge risk (P1) - One eligible public-read throttle may consume App quota; the bounded claim and fail-closed subsequent throttle limit this, but maintainers should accept that availability tradeoff.
  • Complete next step (P2) - No mechanical repair remains after the current-head update resolved the prior finding; this PR now needs normal maintainer merge review.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and regression delta production +78 net (82 added, 4 removed); tests +52 The small two-file change adds a credential-routing circuit breaker with focused boundary coverage.

Merge-risk options

Maintainer options:

  1. Accept the bounded recovery policy (recommended)
    Merge with the one-per-App-token fallback because it restores a throttled router read while repeated throttles remain fail-closed.

Technical review

Best possible solution:

Land the bounded recovery policy once current-head checks complete, retaining the one-per-App-token circuit breaker and the explicit credential/mutation exclusions.

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

Yes. The PR records a pre-fix router Action failing on a public-installation rate limit and a current-head Action succeeding through the same throttled condition.

Is this the best way to solve the issue?

Yes. A single explicitly eligible fallback with a shared claim guard preserves the existing fail-closed behavior for further throttles and all non-read boundaries.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2eb1787e0d18.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides before-and-after real router Action evidence, including a downstream public-token 403 after the successful current-head fallback.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: A throttled public credential can prevent router dispatch for active OpenClaw review work.
  • merge-risk: 🚨 security-boundary: The patch conditionally routes a previously public-token read through the App credential.
  • merge-risk: 🚨 availability: The fallback changes whether router work proceeds or defers during an installation-level throttle.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides before-and-after real router Action evidence, including a downstream public-token 403 after the successful current-head fallback.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides before-and-after real router Action evidence, including a downstream public-token 403 after the successful current-head fallback.

Evidence

What I checked:

  • Current-main behavior: Current main immediately raises GitHubRateLimitError for a throttled retryable read, so the requested recovery behavior is not already implemented. (src/repair/github-cli.ts:176, 2eb1787e0d18)
  • Bounded fallback implementation: The PR retries only an eligible throttled read with explicit App-token options; a process-wide claim prevents a second escalation for that App credential. (src/repair/github-cli.ts:176, 5fb8989ebe44)
  • Regression coverage: The new test proves one successful fallback, a repeated public throttle failing closed, async fallback under another credential, and a later mutation retaining its App token. (test/repair/github-cli.test.ts:136, 5fb8989ebe44)
  • Prior finding resolved: The post-review commit adds the shared claim guard and test case that prevent every throttled public read from consuming App quota. (src/repair/github-cli.ts:188, 5fb8989ebe44)
  • Credential-boundary provenance: Recent main history introduced the public-read/App-token split and quota-reservation behavior that this PR preserves with a bounded exception. (src/repair/github-cli.ts:301, a47ccbacd24a)
  • After-fix live behavior: The PR body records a successful current-head router Action after an earlier public-installation 403, while the immediate downstream main run still saw the same 403; this supports that fallback, rather than quota recovery, produced the result. (5fb8989ebe44)

Likely related people:

  • Peter Steinberger: Recent history shows Peter authored the public-read isolation, App-quota reservation, and rate-limit deferral work in this helper. (role: introduced credential-boundary and quota-reservation behavior; confidence: high; commits: a47ccbacd24a, 2c3ad8f46c9a, 480d56953f38; files: src/repair/github-cli.ts, src/repair/comment-router.ts)
  • Martin Cleary: Feature history records Martin’s exact-review lifecycle telemetry work touching the same GitHub CLI helper. (role: recent adjacent contributor; confidence: medium; commits: 29937558515e; files: src/repair/github-cli.ts)

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 (2 earlier review cycles)
  • reviewed 2026-08-07T04:21:18.414Z sha d683b60 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-07T04:29:15.595Z sha d683b60 :: found issues before merge. :: [P1] Preserve the App quota during sustained public throttling

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 7, 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 repository_dispatch).
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 proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 Urgent regression or broken agent/channel workflow affecting real users now. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. labels Aug 7, 2026
Allow at most one public-read recovery for each target App credential in a process. Repeated public throttles fail closed while later privileged mutations retain their configured App-token path.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 3cdcdb00-ade8-4e61-85a7-8151b35f216a
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 7, 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 repository_dispatch).
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 rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 7, 2026
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Maintainer decision: accept the bounded availability tradeoff. One eligible public-read throttle may consume one App-backed read per target credential and process; later public throttles fail closed, and privileged mutations retain their configured App-token path.

@giodl73-repo
giodl73-repo merged commit f6f6bfc into openclaw:main Aug 7, 2026
20 checks passed
@giodl73-repo
giodl73-repo deleted the fix/comment-router-public-read-fallback branch August 7, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P1 Urgent regression or broken agent/channel workflow affecting real users now. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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