Skip to content

fix: harden scaled review scheduling - #943

Merged
steipete merged 1 commit into
mainfrom
fix/scale-failure-tail
Jul 29, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/scale-failure-tail

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • retry expected exact-review reservation races up to five times with jittered backoff, and finish green when a newer queue owner has superseded the run
  • treat queue-authority loss during review generation as a successful fenced no-op instead of a model/content failure
  • keep the existing bounded Codex transport retries, but emit a distinct provider_throttle classification when capacity errors survive them
  • publish signed live GitHub open-item inventory into the Worker so dashboard coverage includes never-reviewed items and separates expired, untracked, protected, and unmanaged cohorts
  • renew overdue canonical records before expanding the unseen backlog so the rolling coverage cohort cannot remain permanently stale

Failure classification

The scale tail is queue contention, not a model ceiling.

  • Runs 30472278499, 30472272826, 30472273778, and 30472964231 all fail Reserve exact review lease with exact-review queue authority changed ... retry required. Eleven of 16 sampled failed exact-review runs had this shape.
  • The requested generation failure 30472661385, plus 30471602542, 30469872057, 30469629021, and 30468471613, reached Codex and were then terminated only after Exact-review heartbeat lost its lease tuple; the resulting exit 143 was mislabeled as unsuccessful generation.
  • 30471565802 is the sampled genuine Codex failure: it wrote a fallback review artifact and exited 1. None of the sampled full logs contains a 429, TPM/RPM limit, quota, spend-cap, or overload signal.
  • setup-codex configures an isolated CLI and local Responses proxy but has no 128-call or provider-concurrency cap. The repository's 128 value is ClawSweeper worker admission. Existing review execution already performs bounded transient transport retries; this change makes surviving provider throttles observable without reducing throughput for a ceiling the evidence does not show.

Coverage root cause

At 2026-07-29 16:58 UTC the public endpoint reported 1,754 open_records, 1,317 recent reviews, and the unchanged 426 pending records. Live GitHub held 3,596 open issues plus 2,319 open pull requests: 5,915 open items.

reviewCoverageSync treated canonical items records as the entire open universe, but those records exist only after an item has reached publication. Its pending fallback also combined old review_status: complete records outside the seven-day window with records missing usable review metadata. Meanwhile the scheduler correctly selected older never-reviewed GitHub items, creating fresh canonical records outside the old denominator while the 426 tracked records remained behind that unseen backlog. The dashboard therefore showed rising verdict throughput with a flat pending cohort.

The fix reuses the existing authenticated six-hour fleet scan to publish live per-repository issue/PR totals to the Worker. Coverage now uses live reviewable open items as the denominator, exposes tracked/untracked and expired/unreviewed breakdowns, excludes protected canonical records, and reports canonical records from repositories no longer in the eligible fleet as unmanaged instead of degrading active-fleet coverage. The scheduler gives already-tracked six-day-overdue records first claim on coverage slots, then fills all remaining capacity from unseen items.

Proof

  • focused queue/Worker, scheduler, target-fanout, workflow, and Codex-runner suite: 385 passed, 0 failed
  • pnpm run format:check: passed
  • pnpm run lint: passed
  • pnpm run build:all: passed on Node 26.5.0
  • pnpm run check: static/build/lint gates and coverage thresholds passed; the full suite retains the five known macOS-only Linux-containment failures because Apple libc does not export capset, matching the documented feat: raise scheduled review throughput #940 baseline
  • /Users/steipete/.claude/skills/autoreview/scripts/autoreview --mode local: clean, no accepted/actionable findings
  • git diff --check: passed

Rollout

A Worker redeploy is required for the signed inventory endpoint and corrected coverage response. After deploy, the next 37 */6 * * * fleet coverage scan seeds the live inventory; until then the API explicitly reports inventory_status: missing and retains the canonical-record fallback. This PR does not deploy, merge, or run the live apply/close path.

@steipete
steipete requested a review from a team as a code owner July 29, 2026 17:13
@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. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Jul 29, 2026
@clawsweeper

clawsweeper Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 29, 2026, 1:19 PM ET / 17:19 UTC.

ClawSweeper review

What this changes

This PR retries expected exact-review lease races, treats superseded queue work as a fenced no-op, classifies surviving provider throttles, publishes signed live GitHub inventory for coverage, and refreshes overdue canonical records ahead of unseen backlog.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 6 items remain

Keep this PR open. The queue-contention and coverage fixes are a coherent follow-up to the merged scaled-scheduling rollout, but the branch changes a release-owned changelog and has only test/static results rather than inspectable after-fix Worker and workflow behavior proof.

Priority: P2
Reviewed head: 6eeb0284db5e47157a831149b795c0b79e56dbd2

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has focused tests and a coherent operational rationale, but the proof gate is unmet and the release-owned changelog edit needs removal.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body lists test, lint, build, and static-check results, but no inspectable after-fix runtime artifact demonstrates the Worker inventory endpoint, scheduled scan, or queue supersession behavior; post redacted live output or logs before merge. 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 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body lists test, lint, build, and static-check results, but no inspectable after-fix runtime artifact demonstrates the Worker inventory endpoint, scheduled scan, or queue supersession behavior; post redacted live output or logs before merge. 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 5 items Release-owned changelog policy: The target repository policy says CHANGELOG.md is release-owned and normal PRs must keep release-note context in the PR body or commit message; this branch adds a Changed entry.
Queue and workflow behavior: The branch adds bounded jittered retries for exact-review reservation contention and emits a superseded status after the fifth expected authority-race failure.
Coverage implementation: The Worker-side direct-publication store now accepts live inventory when calculating review coverage, rather than treating published canonical records as the full open-item universe.
Findings 1 actionable finding [P2] Remove the release-owned changelog entry
Security None None.

How this fits together

ClawSweeper selects open GitHub items for review, reserves an exact-review lease, runs Codex, and publishes canonical review records. The Worker-backed dashboard then combines those records with fleet inventory to show recent-review coverage and backlog cohorts.

flowchart LR
  A[GitHub open items] --> B[Target fanout scan]
  B --> C[Exact-review queue]
  C --> D[Lease reservation]
  D --> E[Codex review workflow]
  E --> F[Canonical review records]
  B --> G[Signed live inventory]
  F --> H[Coverage dashboard]
  G --> H
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body lists test, lint, build, and static-check results, but no inspectable after-fix runtime artifact demonstrates the Worker inventory endpoint, scheduled scan, or queue supersession behavior; post redacted live output or logs before merge. 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.
  • Remove the release-owned changelog entry (P2) - CHANGELOG.md is release-owned under this repository’s policy, and normal PRs must preserve release context in the PR body or commit message instead. Remove this entry so it does not compete with the release process.
  • Resolve merge risk (P1) - This changes queue and workflow completion semantics: an expected lease-authority race can now finish green as a superseded no-op, so a real queue run should confirm that no review remains stranded or silently skipped.
  • Resolve merge risk (P2) - Correct coverage requires a Worker redeploy and the subsequent six-hour fleet scan; until inventory is published, the dashboard intentionally uses a fallback and cannot prove the corrected denominator in production.
  • Resolve merge risk (P1) - The release-owned CHANGELOG.md edit creates release-process churn and conflicts with the repository policy for normal contributor PRs.
  • Complete next step (P2) - Hold for a contributor update: the required proof must come from an after-fix Worker/workflow run, so it is not a safe automated repair task.

Findings

  • [P2] Remove the release-owned changelog entry — CHANGELOG.md:12
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Change surface 13 files affected; 736 added, 74 removed The patch spans the Worker, dashboard, scheduler, workflow, and their tests, so a focused real integration proof matters beyond unit coverage.
Automation paths 1 workflow and 1 Worker ingress route changed The rollout coordinates GitHub Actions lease handling with authenticated Worker inventory publication.

Merge-risk options

Maintainer options:

  1. Remove release-owned churn and prove the deployed path (recommended)
    Drop the CHANGELOG.md edit and add redacted after-fix Worker/workflow evidence that shows inventory publication and the new supersession handling in a real run.
  2. Pause for rollout validation
    Hold this broad scheduling change until a Worker deployment and the next fleet scan can verify the intended queue and coverage behavior without leaving review work behind.

Technical review

Best possible solution:

Remove the CHANGELOG.md entry, retain the release context in the PR body, and attach redacted after-fix evidence showing a signed inventory publish plus a queue-authority-race or coverage response outcome before merging.

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

No high-confidence current-main reproduction was supplied in a repeatable form. The PR body identifies concrete failed workflow signatures and the changed paths support the diagnosis, but the after-fix behavior has not been demonstrated in a real Worker/workflow setup.

Is this the best way to solve the issue?

Unclear. The proposed queue and inventory direction is consistent with the reported scheduling and coverage failure modes, but removing the release-owned changelog edit and proving the integrated rollout are necessary before it is the best merge path.

Full review comments:

  • [P2] Remove the release-owned changelog entry — CHANGELOG.md:12
    CHANGELOG.md is release-owned under this repository’s policy, and normal PRs must preserve release context in the PR body or commit message instead. Remove this entry so it does not compete with the release process.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.86

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a bounded but production-facing review scheduling and coverage reliability repair.
  • add merge-risk: 🚨 availability: A mistaken supersession or inventory rollout can leave scheduled review coverage incomplete or stale.
  • add merge-risk: 🚨 automation: The patch changes GitHub Actions lease retry, completion, and failure classification behavior.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add 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 lists test, lint, build, and static-check results, but no inspectable after-fix runtime artifact demonstrates the Worker inventory endpoint, scheduled scan, or queue supersession behavior; post redacted live output or logs before merge. 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:

  • P2: This is a bounded but production-facing review scheduling and coverage reliability repair.
  • merge-risk: 🚨 automation: The patch changes GitHub Actions lease retry, completion, and failure classification behavior.
  • merge-risk: 🚨 availability: A mistaken supersession or inventory rollout can leave scheduled review coverage incomplete or stale.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • 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 lists test, lint, build, and static-check results, but no inspectable after-fix runtime artifact demonstrates the Worker inventory endpoint, scheduled scan, or queue supersession behavior; post redacted live output or logs before merge. 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:

  • Release-owned changelog policy: The target repository policy says CHANGELOG.md is release-owned and normal PRs must keep release-note context in the PR body or commit message; this branch adds a Changed entry. (CHANGELOG.md:12, 6eeb0284db5e)
  • Queue and workflow behavior: The branch adds bounded jittered retries for exact-review reservation contention and emits a superseded status after the fifth expected authority-race failure. (.github/workflows/sweep.yml:908, 6eeb0284db5e)
  • Coverage implementation: The Worker-side direct-publication store now accepts live inventory when calculating review coverage, rather than treating published canonical records as the full open-item universe. (dashboard/exact-review-direct-publication.ts:548, 6eeb0284db5e)
  • Related rollout provenance: The related merged PR feat: raise scheduled review throughput #940 introduced scaled scheduled review throughput and is the immediate shared scheduling/queue history this branch hardens. (src/scheduler-policy.ts:317, 6b3a2cef36f5)
  • Proof gap: The PR body reports focused tests, formatting, lint, build, and static checks, but does not provide an inspectable after-fix Worker deployment, queue run, or coverage-inventory publication artifact showing the new runtime behavior.

Likely related people:

  • steipete: Authored the merged scaled-throughput rollout in feat: raise scheduled review throughput #940, whose queue, scheduler, workflow, and coverage surfaces are directly extended here. (role: recent scheduling and queue contributor; confidence: medium; commits: 6b3a2cef36f5; files: src/scheduler-policy.ts, .github/workflows/sweep.yml, src/repair/target-fanout.ts)

Rank-up moves

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

  • Remove the CHANGELOG.md entry and keep its release context in the PR body.
  • Attach redacted after-fix Worker/workflow output proving signed inventory publication and the intended queue or coverage result.

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 970af34 into main Jul 29, 2026
21 checks passed
@steipete
steipete deleted the fix/scale-failure-tail branch July 29, 2026 17:21
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
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. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. 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