Skip to content

fix(tokens): keep review hydration on the App bucket to balance read pools - #1064

Merged
steipete merged 1 commit into
mainfrom
steipete/review-read-token-rebalance
Aug 8, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/review-read-token-rebalance

Conversation

@steipete

@steipete steipete commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

PR #1062 moved the exact-event review runtime's GitHub reads (~30 calls per review, the largest single read stream) from the App installation bucket onto the per-repo Actions GITHUB_TOKEN pool. That pool is already shared by the comment-router public reads (#1034), dashboard CI, and every support lane in this repository. Concentrating both major read streams on one bucket exhausted it: after the merge at 00:20Z, queue telemetry shows review successes collapsing (184/hr → 40/hr by 01:21Z), throttle-retry backoff climbing past 95 items, and active github_throttle alerts doubling — while the App installation bucket idles.

The Fix

One line: review hydration returns to the App read token. With apply-guard read memoization (#1060) and the router/public-read offload (#1034, #1062) in place, the two pools now each carry roughly half the read load instead of one carrying all of it:

  • App installation bucket: review hydration (memoized), writes, leases.
  • Actions pool: comment router, small read steps, dashboard CI, mixed-process public-read seams (each with the bounded App-token throttle fallback).

All other #1062 changes (runtime public-read seam, inspection-token hardening, small step flips) are unchanged.

Proof

  • Focused workflow test suites green: sweep-workflow 115/115, clawsweeper 77/77.
  • Production telemetry cited above from /api/exact-review-queue (reservation-claim throttle alerts, review-lane flow rates).

…pools

PR #1062 moved the exact-event review runtime's reads (~30 calls per
review, the largest single stream) onto the per-repo Actions token pool,
which the comment router, dashboard CI, and support lanes already share.
Concentrating both major read streams on one bucket exhausted it while
the App installation bucket idled. Review hydration returns to the App
read token; with apply-guard memoization and the router offload in
place, the two pools now each carry roughly half the read load.
@steipete
steipete requested a review from a team as a code owner August 8, 2026 02:07
@clawsweeper clawsweeper Bot added 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. P1 Urgent regression or broken agent/channel workflow affecting real users now. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 8, 2026
@clawsweeper

clawsweeper Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 7, 2026, 10:11 PM ET / August 8, 2026, 02:11 UTC.

ClawSweeper review

What this changes

This PR moves exact-event review hydration back to the scoped GitHub App read token and updates workflow tests to expect that routing.

Regression provenance

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

Merge readiness

⛔ Blocked until stronger real behavior proof is added - 5 items remain

Keep open: the intended quota rebalance is valid, but the new direct App-token selection removes the existing recovery path when the App read-token mint fails. The workflow deliberately continues after that mint, so an otherwise admissible exact review can now fail at hydration instead of using its repository workflow token.

Priority: P1
Reviewed head: 4109413c89d5a28f5c62394b058f7cfc3d17e9d5

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The reliability objective is well scoped, but an availability regression and missing after-fix boundary proof block merge readiness.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: The body cites pre-fix production telemetry and test totals, but it lacks current-head controlled evidence that the changed credential path works and that its mint-failure behavior remains safe. 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 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The body cites pre-fix production telemetry and test totals, but it lacks current-head controlled evidence that the changed credential path works and that its mint-failure behavior remains safe. 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 4 items App-token mint is fallible: The exact-event job marks the read-token creation step continue-on-error, so its output can be empty without stopping the job.
Current fallback is removed by the proposed line: Current main uses the repository workflow token for openclaw/openclaw exact-review hydration and otherwise uses the App read token; the proposed patch replaces that expression with the App token alone.
Regression provenance: The current credential-routing behavior dates to the merged public-read routing change, whose commit explicitly moved sweep public reads while preserving App credentials for privileged paths.
Findings 1 actionable finding [P1] Preserve recovery when the App read-token mint fails
Security None None.

How this fits together

The exact-event review workflow claims a queued item, hydrates its GitHub context for Codex, then publishes a review result. Its read credential selection affects both review-lane availability and the quota available to other repository automation.

flowchart LR
  A[Exact review queue] --> B[Claimed item]
  B --> C[App read-token mint]
  C --> D[Credential selection]
  D --> E[GitHub hydration]
  E --> F[Codex review]
  F --> G[Published review]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The body cites pre-fix production telemetry and test totals, but it lacks current-head controlled evidence that the changed credential path works and that its mint-failure behavior remains safe. 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.
  • Preserve recovery when the App read-token mint fails (P1) - target-read-token is explicitly continue-on-error, but this replacement makes GH_TOKEN empty whenever that mint fails. The review step then fails its non-empty-token guard even though the current openclaw/openclaw path can continue with github.token. Keep the App token as the normal route, but retain a tested fallback for that mint-failure case.
  • Complete next step (P2) - A narrow workflow-expression and test repair can restore the current mint-failure recovery path; contributor-supplied current-head runtime proof remains required before merge.
  • Improve patch quality - Restore and test the failed-mint fallback.
  • Improve patch quality - Add a redacted current-head controlled trace for App-token hydration and fallback selection.

Findings

  • [P1] Preserve recovery when the App read-token mint fails — .github/workflows/sweep.yml:1080
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 8 added, 11 removed across 1 workflow and 2 test files The proposed change is tightly focused on one exact-event credential selection and its expectations.

Technical review

Best possible solution:

Keep App-backed hydration as the normal path, but preserve a narrowly tested fallback for a failed App-token mint and add current-head controlled proof of both the normal and fallback paths.

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

Yes, source-reproducible: force the continue-on-error App-token mint to yield no token for an openclaw/openclaw exact review; current main has a workflow-token path, while this patch reaches test -n "$GH_TOKEN" with an empty value.

Is this the best way to solve the issue?

No: returning hydration to the App pool is appropriate, but the App-only expression unnecessarily removes the current availability fallback for a mint failure.

Full review comments:

  • [P1] Preserve recovery when the App read-token mint fails — .github/workflows/sweep.yml:1080
    target-read-token is explicitly continue-on-error, but this replacement makes GH_TOKEN empty whenever that mint fails. The review step then fails its non-empty-token guard even though the current openclaw/openclaw path can continue with github.token. Keep the App token as the normal route, but retain a tested fallback for that mint-failure case.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7a9d33bed755.

Labels

Label changes:

  • add P1: A failed App-token mint can stop exact-event review processing for an otherwise valid queued item.
  • add merge-risk: 🚨 availability: The changed credential expression removes a current recovery path in the high-volume review lane.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The body cites pre-fix production telemetry and test totals, but it lacks current-head controlled evidence that the changed credential path works and that its mint-failure behavior remains safe. 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.

Label justifications:

  • P1: A failed App-token mint can stop exact-event review processing for an otherwise valid queued item.
  • merge-risk: 🚨 availability: The changed credential expression removes a current recovery path in the high-volume review lane.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The body cites pre-fix production telemetry and test totals, but it lacks current-head controlled evidence that the changed credential path works and that its mint-failure behavior remains safe. 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

Acceptance criteria:

  • [P1] pnpm run check.
  • [P2] Run a Docker-backed controlled workflow-boundary harness showing App-token selection when minted and workflow-token fallback when the mint is unavailable.

What I checked:

  • App-token mint is fallible: The exact-event job marks the read-token creation step continue-on-error, so its output can be empty without stopping the job. (.github/workflows/sweep.yml:705, 7a9d33bed755)
  • Current fallback is removed by the proposed line: Current main uses the repository workflow token for openclaw/openclaw exact-review hydration and otherwise uses the App read token; the proposed patch replaces that expression with the App token alone. (.github/workflows/sweep.yml:1080, 4109413c89d5)
  • Regression provenance: The current credential-routing behavior dates to the merged public-read routing change, whose commit explicitly moved sweep public reads while preserving App credentials for privileged paths. (.github/workflows/sweep.yml:1080, d3810a047fa6)
  • Release/main check: The merged routing commit is on current main; no local release tag containing it was established during this read-only review. (d3810a047fa6)

Likely related people:

  • steipete: Authored the merged credential-routing change and is the dominant historical contributor to the sweep workflow. (role: recent area contributor; confidence: high; commits: d3810a047fa6, a47ccbacd24a; files: .github/workflows/sweep.yml)
  • Vincent Koc: Has recent history in the same sweep workflow around review throttling and queue behavior. (role: adjacent workflow contributor; confidence: medium; commits: 480d56953f38; files: .github/workflows/sweep.yml)

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 5d279ea into main Aug 8, 2026
17 checks passed
@steipete
steipete deleted the steipete/review-read-token-rebalance branch August 8, 2026 02:15
steipete added a commit that referenced this pull request Aug 8, 2026
The 450/h trim ducked App installation 403s at ~30 API calls per review.
Apply-guard memoization (#1060) cut that per-item cost and the read-pool
split (#1062/#1064) moved router and public reads onto the Actions token
pool, so the App bucket now carries only memoized hydration and writes.
Post-#1064 telemetry shows ~336 ok reviews/h with near-empty throttle
backoff at the 450 cap; restoring the historical 600/h uses the
recovered headroom.
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. P1 Urgent regression or broken agent/channel workflow affecting real users now. 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