Skip to content

fix: keep branchless reviews durable during GitHub limits - #1105

Merged
brokemac79 merged 2 commits into
mainfrom
codex/csw-review-branch-authority
Aug 10, 2026
Merged

brokemac79 merged 2 commits into
mainfrom
codex/csw-review-branch-authority

Conversation

@brokemac79

@brokemac79 brokemac79 commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Remove the legacy Actions-token default-branch lookup that can fail before durable review admission.
  • Carry a valid target_branch directly to the existing enqueue/source-authority routes; durably reserve genuinely branchless intake for control-plane resolution.
  • Resolve missing branches with the target-owner GitHub App credential and reuse the existing target_app:<owner> reset-aware circuit for branch and source-head authority.
  • Expose branch/source authority depth in review status without changing the 300/hour, burst-30 admission contract.

Companion producer change: openclaw/openclaw#121674.

Problem

Run 31409599011 shows the legacy workflow calling repos/openclaw/openclaw with the workflow repository's Actions token to discover default_branch. The installation-quota 403 happened before /internal/exact-review/enqueue or /source-authority, so the durable control plane could not preserve the event, observe the failure, or collapse same-credential retries.

The merged quota controls already protect repository_actions publication and target_app:<owner> review admission. This pre-enqueue workflow lookup was outside both boundaries.

Implementation

  • .github/workflows/sweep.yml no longer performs an inline gh api branch lookup or exposes GH_TOKEN to legacy intake.
  • A syntactically valid carried branch follows the zero-lookup path. Missing branch authority is sent to the signed /internal/exact-review/branch-authority route.
  • ExactReviewQueue durably stores branch/source reservations, resolves the repository default branch with the target installation's App credential, and never guesses main.
  • Edited pull requests still pass source-head authority before admission.
  • The first reset-aware 403/429 opens the existing target_app:<owner> circuit. Later same-owner reservations defer to the persisted reset without another request or attempt charge; unrelated owners continue.
  • Status reports lanes.review.authority_pending; the existing circuit's affected_pending includes the reservations it blocks. Bay remains observer-only and uses its existing generic circuit renderer.

Validation

Current head: 236238166735dd670bc05f55e778a40a01deaf87
Current base: e13791786799f6a51a39806938847bbc48948e5e

  • pnpm run build:all — passed.
  • pnpm run lint:dashboard — passed.
  • pnpm run lint:scripts — passed.
  • pnpm run check:docs — passed.
  • pnpm run check:limits — passed; 300/hour and burst 30 are unchanged.
  • Focused test/dashboard-worker.test.ts contracts — 3 passed: signed branchless intake, quota circuit/request collapse/reset recovery, and Bay route/rendering.
  • Focused test/sweep-workflow.test.ts contracts — 2 passed: branchless serializer behavior and storm-amplification prevention.
  • node --test test/clawsweeper.test.ts — 77 passed.
  • git diff --check origin/main...HEAD — clean.

The full workflow test file retains unrelated native-Windows /bin/bash fixture failures; the changed workflow contracts pass on Windows and in the Linux proof environment.

Codex review

  • Dirty review initially found that the proof did not assert resolved decision fields; the harness now reads the stopped local Durable Object's SQLite records and asserts branch, state, and source-head verification.
  • A repeat dirty review found Windows process-tree cleanup and an overly short reset window; both were fixed, and the proof passed on native Windows and Linux.
  • Final codex review --uncommitted — no actionable correctness issue.
  • Final codex review --base origin/main at this head/base — no discrete actionable regression.

Real Behavior Proof

  • Claim: Signed branchless intake survives a target-owner quota reset durably; repeated same-owner requests collapse; another owner progresses; authoritative branches and a matching pull-request head are admitted after reset and a Worker restart.
  • Exercised surface: Real wrangler dev --local Worker routing and signature validation; real SQLite-backed ExactReviewQueue Durable Object storage, alarms, and restart persistence; production GitHub App JWT/installation-token/repository-read client; unmodified HTTP transport through the loopback-only GITHUB_API_URL seam; public queue/circuit/Bay status.
  • Scenario: A controlled loopback GitHub endpoint returns a reset-aware 403 for the first openclaw/openclaw repository read, then trunk; other/repo returns stable; pull request 903 returns the reserved synthetic head. Two branch reservations and one source reservation share the OpenClaw owner; one branch reservation uses the other owner.
  • Command/environment: crabbox run --provider local-container --local-container-image node:24-bookworm --fresh-pr openclaw/clawsweeper#1105 --timing-json --script C:\clawsweeper-work\notes\csw-review-branch-authority-local-container-proof.sh.
  • Provider / lease: local-container, lease cbx_9754eb3bbc80, slug coral-crab, target linux, node_24-bookworm; fresh-PR checkout asserted exact head 236238166735dd670bc05f55e778a40a01deaf87. Local-container does not emit a separate remote run ID.
  • Observed before reset: exactly one OpenClaw token/repository request; three authority reservations; target_app:openclaw active with affected_pending=3; two same-owner follow-ups skipped by circuit; no pull read; other/repo admitted as stable.
  • Observed after restart/reset: authority pending reached zero; circuit became inactive with affected_pending=0; durable records showed items 900/901 as trunk, item 902 as stable, and pull request 903 as trunk with sourceHeadVerified=true and the reserved head.
  • Result: Exit 0. Fresh-PR sync 9.965s, command 119.568s, total 129.533s. The lease stopped automatically.
  • Artifact/trace: The committed docs/proof/review-branch-authority/ harness writes redacted queue snapshots, resolved durable records, GitHub method/path/auth-scheme/status trace, Worker logs, and proof-summary.json. Exact proof source-tree hash: dddfb330a9b64f9040d5dc88b5d30f80555add18a033a9f43813af1aaddbd659.
  • Limits: GitHub is a controlled HTTP fault endpoint, not production. The proof mutates only its disposable local queue and performs no GitHub write, workflow dispatch, production queue action, deployment, or gate change.

An earlier exact-head Crabbox attempt passed all build/lint/docs/tests but invoked the committed shell helper without bash, so it stopped with permission denied before runtime proof and is not counted as behavior evidence. The successful fresh lease above corrected only that local wrapper invocation.

Risks and rollout

  • Workflow and dashboard changes roll out through their existing paths. During the narrow interval where the workflow is live before the Worker endpoint deploys, a stale branchless producer could receive an old-Worker 404 and depend on producer redelivery. Current trusted dispatchers already carry a branch; fix(ci): prevent ClawSweeper dispatch branch lookups openclaw#121674 removes the remaining producer-side lookup.
  • Reservation keys are versioned Durable Object KV records; no SQLite schema migration is introduced.
  • The circuit taxonomy is reused rather than layered, avoiding double-circuiting. Other target-owner pools are unaffected.
  • No admission increase, live replay, workflow dispatch/rerun, gate change, or deployment is part of this PR.

@clawsweeper

clawsweeper Bot commented Aug 10, 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 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 10, 2026, 3:18 PM ET / 19:18 UTC.

ClawSweeper review

What this changes

The branch removes a workflow-side default-branch GitHub lookup and durably resolves missing branch authority through the dashboard queue’s target-owner rate-limit circuit.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

The PR addresses a real current-main intake gap and has credible controlled runtime proof; no concrete patch defect was found. It needs maintainer coordination of the Worker-before-workflow rollout because the new workflow route depends on the deployed Worker endpoint.

Priority: P2
Reviewed head: 236238166735dd670bc05f55e778a40a01deaf87
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has focused source coverage and credible real-runtime proof; the remaining material concern is coordinated deployment order.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body documents a successful fresh Crabbox local-container run through the real Worker and Durable Object with an injected target-owner rate-limit fault, restart, and observed recovery.
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 documents a successful fresh Crabbox local-container run through the real Worker and Durable Object with an injected target-owner rate-limit fault, restart, and observed recovery.
Evidence reviewed 6 items Current-main failure path: Current main resolves an absent target branch in the Actions runner with gh api, before the durable queue receives the event; the PR removes that pre-admission lookup.
Durable authority handling: The proposed queue endpoint persists a branch-authority reservation and the alarm processor resolves it through the target App, honors the owner circuit, and forwards only an authoritative branch.
Real behavior proof: The committed proof drives signed requests through a local Worker and SQLite Durable Object, injects a reset-aware 403, restarts the Worker, and asserts recovered durable branch and source-head decisions; the PR body records a successful fresh Crabbox lease.
Findings None None.
Security None None.

How this fits together

Legacy review events enter the sweep workflow and then the dashboard Worker’s durable exact-review queue. Before review work is admitted, the queue establishes target-branch and, where needed, pull-request source-head authority while exposing rate-limit state to observers.

flowchart LR
A[Legacy review event] --> B[Sweep workflow]
B --> C[Signed Worker route]
C --> D[Durable authority reservation]
D --> E[Target GitHub App read]
E --> F[Owner rate-limit circuit]
D --> G[Exact review queue]
G --> H[Observer status]
Loading

Decision needed

Question Recommendation
Can the dashboard Worker route be deployed before this workflow change is merged or otherwise made live? Deploy Worker first: Deploy the Worker containing /internal/exact-review/branch-authority, then land the workflow change so branchless events are accepted throughout rollout.

Why: The code intentionally introduces a new signed endpoint used by the workflow, so rollout order determines whether branchless legacy events have a temporary retry-only path.

Before merge

  • Resolve merge risk (P1) - If the workflow change becomes live before the Worker route is deployed, a branchless legacy event can receive a temporary 404 and must rely on producer redelivery.
  • Resolve merge risk (P1) - The partial checkout prevented a fully independent read of every historical PR object; the core queue path and supplied diff/proof context were reviewed, but this remains a maintainer-side inspection limitation.
  • Complete next step (P2) - A maintainer must coordinate the Worker-first deployment order; no narrow contributor-side code repair is identified.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Implementation and proof size runtime +486/-20; tests +303/-4; docs/proof +667/-1 The substantial queue change is paired with focused tests and a committed real-runtime proof harness.

Merge-risk options

Maintainer options:

  1. Stage the Worker endpoint first (recommended)
    Deploy the dashboard Worker route before merging the workflow change, then verify a branchless signed event reaches durable authority reservation.
  2. Pause for coordinated release
    Pause this PR if the independent Worker deployment cannot be ordered ahead of workflow activation.

Technical review

Best possible solution:

Make branchless intake durable behind the existing target-owner circuit, with the Worker endpoint available before legacy producers route events to it.

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

Yes for the pre-fix path at source level: current main calls gh api for an absent branch before durable queue admission, and the PR body supplies the matching rate-limit failure trace. I did not run a live GitHub reproduction in this read-only review.

Is this the best way to solve the issue?

Yes, conditionally: carrying a valid branch without a lookup and reserving only branchless intake in the durable control plane is the narrowest compatible repair, provided the Worker route is deployed first.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs a bounded review-admission reliability failure without evidence of current user-facing data loss or a core outage.
  • merge-risk: 🚨 automation: The PR changes the review workflow, signed Worker routing, queue retry behavior, and operational status output.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 documents a successful fresh Crabbox local-container run through the real Worker and Durable Object with an injected target-owner rate-limit fault, restart, and observed recovery.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body documents a successful fresh Crabbox local-container run through the real Worker and Durable Object with an injected target-owner rate-limit fault, restart, and observed recovery.

Evidence

What I checked:

  • Current-main failure path: Current main resolves an absent target branch in the Actions runner with gh api, before the durable queue receives the event; the PR removes that pre-admission lookup. (.github/workflows/sweep.yml:317, e13791786799)
  • Durable authority handling: The proposed queue endpoint persists a branch-authority reservation and the alarm processor resolves it through the target App, honors the owner circuit, and forwards only an authoritative branch. (dashboard/exact-review-queue.ts:711, 236238166735)
  • Real behavior proof: The committed proof drives signed requests through a local Worker and SQLite Durable Object, injects a reset-aware 403, restarts the Worker, and asserts recovered durable branch and source-head decisions; the PR body records a successful fresh Crabbox lease. (docs/proof/review-branch-authority/run-proof.mjs:40, 236238166735)
  • Existing authentication boundary: The new internal route uses the existing signed queue-request mechanism, which rejects invalid signatures before forwarding the body to the Durable Object. (dashboard/worker.ts:2100, e13791786799)
  • Adjacent feature history: Current queue history identifies Martin Cleary’s quota-circuit work as the closest prior behavior, while Peter Steinberger most recently changed the legacy workflow surface on main. (dashboard/exact-review-queue.ts:9157, cd4892391195)
  • Review infrastructure limitation: The checkout could read current main and the relevant PR-head queue/proof objects, but a full historical diff attempted to retrieve a missing promisor object and could not because github.com DNS resolution failed; this is not a contributor-proof blocker.

Likely related people:

  • Martin Cleary: Recent exact-review queue commits introduced the target-App quota circuit and related queue capacity protections that this change extends. (role: introduced adjacent quota-circuit behavior; confidence: high; commits: cd4892391195, 13f8ffdea32a; files: dashboard/exact-review-queue.ts)
  • Peter Steinberger: The current-main workflow history shows recent ownership of legacy dispatch and review-token routing around the changed intake step. (role: recent workflow contributor; confidence: medium; commits: e13791786799, 5d279ea784c6; files: .github/workflows/sweep.yml, dashboard/exact-review-queue.ts)

Rank-up moves

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

  • Record or execute a Worker-first rollout check before making the workflow route live.

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 (5 earlier review cycles)
  • reviewed 2026-08-10T18:14:18.123Z sha 6adf4cf :: needs real behavior proof before merge. :: [P3] State the OpenClaw Bay impact
  • reviewed 2026-08-10T18:23:03.325Z sha 6adf4cf :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-10T18:38:09.980Z sha bbfe702 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-10T19:09:18.999Z sha 2362381 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-10T19:13:00.291Z sha 2362381 :: needs maintainer review before merge. :: none

@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 10, 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:

@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 10, 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:

@brokemac79
brokemac79 force-pushed the codex/csw-review-branch-authority branch from bbfe702 to 2362381 Compare August 10, 2026 19:04
@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 10, 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: 🐚 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 status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 10, 2026
@brokemac79
brokemac79 marked this pull request as ready for review August 10, 2026 19:15
@brokemac79
brokemac79 requested a review from a team as a code owner August 10, 2026 19:15
@brokemac79
brokemac79 merged commit 91272a6 into main Aug 10, 2026
22 checks passed
@brokemac79
brokemac79 deleted the codex/csw-review-branch-authority branch August 10, 2026 21:05
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: 🐚 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