Skip to content

feat: raise scheduled review throughput - #940

Merged
steipete merged 2 commits into
mainfrom
feat/scheduler-throughput
Jul 29, 2026
Merged

steipete merged 2 commits into
mainfrom
feat/scheduler-throughput

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • route automated hot-intake and normal-backfill selections through the durable exact-review queue instead of direct one-item matrix workers
  • raise each scheduled target plan from one candidate to 20 and pace total new review admission at 200/hour, with organic work consuming the budget before scheduled backfill
  • preserve oldest-first selection, expose per-cycle selection age plus selected/enqueued/deduped/shed/deferred counters, and attribute scheduled claims/completions to their real lanes
  • bound overload with a 50-item burst, the existing 300-pending soft limit, semantic dedupe for untouched items, and the existing 128-global/120-per-target claim caps
  • fix live capacity accounting to count actual exact/scheduled review workers instead of short legacy ingress wrappers

Measured bottleneck

The six-hour window from 2026-07-29 08:45–14:45 UTC contained 121 completed broad scheduler cycles: 44 core cycles and 77 fleet target cycles. They planned only 51 items total (8.5/hour). Just 43 cycles selected anything; 78 cycles were empty. Fleet hot and normal cycles never selected more than one item because target fanout hard-coded both batch_size=1 and shard_count=1. Scheduled work then bypassed the Durable Object, so scheduled queue enqueues and claims were both zero even while the public queue showed 122 of 128 review slots available.

Stage Before After configuration
Completed broad planner cycles, sampled 6h 121 cadence unchanged
Candidates selected 51 total; 8.5/hour up to 20 per target cycle
Nonempty / empty cycles 43 / 78 measured in every run summary
Scheduled queue enqueues 0 fills the residual of a 200/hour total target
Scheduled queue claims 0 one exact workflow per admitted item
Review concurrency needed at 4.1-minute mean n/a about 13.7 workers
Durable claim ceiling unused by scheduled work 128 global / 120 per target

This identifies the feed as the cap: not shard claim capacity, claim pacing, or the lease recycler. The post-#938 worker windows also demonstrated that exact-review execution can exceed 200 completions/hour while backlog is available.

Selection-age finding

The retained pre-selection artifacts covered 39 completed scheduled items from those 51 plans. The selected reference age was p50 223.3 hours (9.3 days), p90 493.9 hours (20.6 days), and max 759.8 hours (31.7 days):

Reference age Selected items
Under 1 hour 0
1–6 hours 2
6–24 hours 4
1–6 days 9
At least 6 days 24

Only one item was reselected across hot and normal lanes, and both selections were about 20.6 days old. The oldest-first coverage comparator from #937 is working; the problem was one-item feed capacity and overlapping planners. The queue now collapses such overlap without advancing a revision or revoking a lease.

Rate and spend math

The Worker target is 200 new reviews/hour. Organic work is never shed and debits the global token balance first; scheduled hot/normal work fills the remainder with a 35/65 lane split. At the conservative 30 calls/review estimate:

200 reviews/hour * 30 calls/review = 6,000 calls/hour

That is about 50% of the roughly 12,000-call or 400-review/hour App-token ceiling, leaving comparable headroom for planning, retries, publication, and variance. At 4.1 minutes/review, the target needs 200 * 4.1 / 60 = 13.7 concurrent workers. Model use is still roughly five times a 40-review/hour baseline; EXACT_REVIEW_TARGET_RATE_PER_HOUR is the spend dial.

Backpressure and lease behavior

  • scheduled offers stop at the 200/hour organic-first token budget and 50-item burst
  • new scheduled/recovery work sheds at 300 pending; webhook, command, and publication work retains priority
  • an untouched pending, dispatching, or leased item is a semantic dedupe, not a superseding revision
  • the six-minute lease remains unchanged because it covers only dispatch-to-claim handoff; claimed workers use the 130-minute execution lease and one-minute heartbeat/20-minute grace, so it cannot race a normal four-minute review
  • producers fail closed until the deployed Worker advertises scheduled_feed, preventing a workflow-first rollout from bypassing pacing

Proof

  • focused scheduler, fanout, queue, telemetry, enqueue-helper, and workflow-shape tests: pass
  • pnpm run check:static: pass
  • pnpm run build:all: pass on Node 26.5.0
  • pnpm run lint: pass
  • full coverage thresholds: pass (77.70% lines, 72.64% branches, 85.43% functions)
  • full pnpm run check: only the five known macOS Linux-containment harness failures remain because Apple libc does not export capset; this branch does not touch that subsystem
  • /Users/steipete/.claude/skills/autoreview/scripts/autoreview --mode local: clean for the full change, then clean again for the rollout-capability delta; no accepted/actionable findings
  • git diff --check

Rollout risks

  • model spend rises materially if organic demand stays below the target and scheduled backlog is deep
  • organic bursts can create token debt and temporarily suppress scheduled coverage by design
  • the 50-item initial burst may briefly raise runner demand, but remains below both claim caps
  • deploy the Worker capability before expecting the new scheduled feed; the producer intentionally fails closed against the old public status shape

This PR does not change review/close policy, protected-label handling, snapshot guards, or apply eligibility.

@steipete
steipete requested a review from a team as a code owner July 29, 2026 15:19
@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, 11:23 AM ET / 15:23 UTC.

ClawSweeper review

What this changes

Routes scheduled hot-intake and normal-backfill selections through the durable exact-review queue, raises scheduled target plans to 20 candidates, and adds rate, backpressure, selection-age, and lane-attribution telemetry.

Merge readiness

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

Keep this PR open for real after-fix queue evidence and a maintainer rollout decision. The supplied diff and focused tests present a coherent way to remove the scheduled-feed bottleneck, but the 200-review/hour target changes operational spend and runner demand and has no inspectable live proof yet.

Priority: P2
Reviewed head: 5edc064594ef4491a112a2c99c21ebffacc77cc2
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has coherent scope and focused coverage, but real behavior proof is still missing for a production scheduling and capacity change.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body reports focused tests, static checks, builds, lint, and coverage, but it provides no inspectable after-fix live queue/workflow proof; post redacted queue and Actions output showing scheduled admission through completion 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 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports focused tests, static checks, builds, lint, and coverage, but it provides no inspectable after-fix live queue/workflow proof; post redacted queue and Actions output showing scheduled admission through completion 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 4 items Scheduled queue implementation: The branch adds scheduled-hot and scheduled-normal source actions, a 200/hour target and 50-item burst, and queue-side deduplication for untouched scheduled items.
Workflow handoff: The workflow introduces distinct scheduled run names and queue-feed handling so admitted scheduled items run through the exact-review execution path rather than broad planner matrices.
Focused coverage: The supplied diff adds queue-admission, enqueue-summary, workflow-shape, target-fanout, and run-telemetry tests for the new scheduled feed.
Findings None None.
Security None None.

How this fits together

Scheduled fleet planners select due issues and pull requests, then offer them to the durable exact-review queue instead of launching one-item review matrices directly. The queue applies global/lane admission, backlog, deduplication, and lease controls before each accepted item launches an exact-review workflow and reports its result in operational telemetry.

flowchart LR
  A[Scheduled target planners] --> B[Due-item selection]
  B --> C[Durable exact-review queue]
  C --> D{Rate backlog and lease controls}
  D --> E[Exact review workflow]
  E --> F[Review record publication]
  C --> G[Queue and lane telemetry]
Loading

Decision needed

Question Recommendation
Should maintainers enable the full 200-review/hour scheduled admission target immediately, or stage the new queue feed at a lower rate while observing production queue and runner headroom? Stage the scheduled rate: Merge with a conservative initial admission setting and raise it after live telemetry confirms scheduled items complete without exhausting queue or runner capacity.

Why: The patch changes an operational throughput and spend control rather than only correcting a local code path; the supplied material does not prove the requested production target is safe for the deployed Worker and runner environment.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports focused tests, static checks, builds, lint, and coverage, but it provides no inspectable after-fix live queue/workflow proof; post redacted queue and Actions output showing scheduled admission through completion 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.
  • Resolve merge risk (P1) - At 200 scheduled admissions per hour, an underutilized organic lane can materially increase model usage and GitHub Actions runner demand; tests do not establish production headroom.
  • Resolve merge risk (P1) - The producer now fails closed until the deployed Worker advertises scheduled-feed support, so the Worker capability rollout must precede enabling or relying on the scheduled feed.
  • Resolve merge risk (P1) - The provided evidence is test and static-check oriented; it does not visibly demonstrate scheduled items being accepted, claimed, completed, and attributed correctly in a real queue/workflow setup.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Change surface 17 files; 830 added, 74 removed The PR spans durable queue behavior, workflow dispatch, telemetry, configuration, documentation, and focused tests.
Scheduled admission 200 reviews/hour target; 50-item burst; 20 candidates per target plan These values define the main operational throughput, spend, and runner-demand change.

Merge-risk options

Maintainer options:

  1. Prove and stage the new feed (recommended)
    Before merge, post redacted live queue and workflow output showing scheduled items are admitted, claimed, completed, and attributed correctly at a conservative rollout rate.
  2. Accept the operational target
    Merge at 200 reviews/hour only if maintainers explicitly accept the modeled increase in model spend and possible runner pressure.
  3. Pause pending capacity evidence
    Keep the PR open if a staging or production-like queue run cannot establish safe capacity for the new admission path.

Technical review

Best possible solution:

Deploy Worker support first, capture redacted live evidence of scheduled enqueue-to-completion behavior at a conservative rate, then raise the admission target toward 200/hour while monitoring queue depth, claim counts, runner availability, and organic-work priority.

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

Not applicable: this PR changes internal review scheduling capacity rather than repairing a reported user-facing bug. Its central claim needs live operational validation, not a failing-bug reproduction.

Is this the best way to solve the issue?

Unclear: routing scheduled work through the existing durable queue is a focused design supported by the supplied tests, but production evidence is still needed to validate the target rate and Worker-first rollout boundary.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a normal-priority operational throughput feature with broad internal reach but no evidence of an active emergency regression.
  • add merge-risk: 🚨 availability: Higher scheduled admission and burst behavior can increase queue depth and Actions runner demand if real capacity is lower than the modeled target.
  • add merge-risk: 🚨 automation: The PR changes the workflow-to-queue dispatch path and requires deployed Worker capability support before scheduled admission can operate.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • 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 reports focused tests, static checks, builds, lint, and coverage, but it provides no inspectable after-fix live queue/workflow proof; post redacted queue and Actions output showing scheduled admission through completion 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 normal-priority operational throughput feature with broad internal reach but no evidence of an active emergency regression.
  • merge-risk: 🚨 availability: Higher scheduled admission and burst behavior can increase queue depth and Actions runner demand if real capacity is lower than the modeled target.
  • merge-risk: 🚨 automation: The PR changes the workflow-to-queue dispatch path and requires deployed Worker capability support before scheduled admission can operate.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • 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 reports focused tests, static checks, builds, lint, and coverage, but it provides no inspectable after-fix live queue/workflow proof; post redacted queue and Actions output showing scheduled admission through completion 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:

  • Scheduled queue implementation: The branch adds scheduled-hot and scheduled-normal source actions, a 200/hour target and 50-item burst, and queue-side deduplication for untouched scheduled items. (dashboard/exact-review-queue.ts:412, 5edc064594ef)
  • Workflow handoff: The workflow introduces distinct scheduled run names and queue-feed handling so admitted scheduled items run through the exact-review execution path rather than broad planner matrices. (.github/workflows/sweep.yml:16, 5edc064594ef)
  • Focused coverage: The supplied diff adds queue-admission, enqueue-summary, workflow-shape, target-fanout, and run-telemetry tests for the new scheduled feed. (test/dashboard-worker.test.ts:1889, 5edc064594ef)
  • Adjacent feature history: The earlier merged throughput work increased queue claim capacity and fleet fanout; this branch addresses the distinct problem that scheduled planners were still feeding only one candidate and bypassing queue admission. (dashboard/exact-review-queue.ts:412, 81c4ab6a7a5f)

Likely related people:

  • steipete: The supplied history shows steipete authored the merged capacity and exact-review hydration work that this PR extends, including the current-main predecessor path. (role: recent feature owner; confidence: high; commits: 81c4ab6a7a5f, e27b57429e48; files: dashboard/exact-review-queue.ts, .github/workflows/sweep.yml, src/repair/target-fanout.ts)

Rank-up moves

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

  • Post redacted live evidence showing scheduled items are enqueued, claimed, completed, and classified in the intended lanes.
  • Show a conservative staged run with queue depth, claim, and runner-capacity observations before enabling the full target.

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 6b3a2ce into main Jul 29, 2026
23 checks passed
@steipete
steipete deleted the feat/scheduler-throughput branch July 29, 2026 16:32
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
* feat: raise scheduled review throughput

* fix: gate scheduled feed on worker support

---------

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