Skip to content

perf(queue): charge organic executions and let scheduled backfill use its review budget - #1710

Merged
steipete merged 12 commits into
mainfrom
perf/scheduled-backfill-budget
Oct 1, 2026
Merged

steipete merged 12 commits into
mainfrom
perf/scheduled-backfill-budget

Conversation

@steipete

@steipete steipete commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem and status

Normal backfill was reported at roughly 4 reviews/hour against the roughly 56/hour needed for seven-day coverage. The scheduled admission bucket discarded organic debt on reads and missed some successor admissions, so its accounting did not describe the work being admitted.

Operating-policy decision: approved on 2026-10-01 (see "Maintainer decision" below). This branch still contains the proposed 220/hour target, 24-item burst, 30/hour hot-lane rate, and 20-minute normal planner cadence. Those production settings are not approved by this proof. The accounting corrections can be retained with the existing 60/hour, six-item-burst settings and current cadence; that conservative variant will not by itself meet the proposed coverage goal.

Accounting and proof fixes

  • Carry global debt down to minus one burst; organic admission remains unconditional. Scheduled admission spends only positive credit. This bounds scheduled admission, not total executions or spend: debt beyond the floor is forgotten, sustained organic load can exceed the target, and scheduled work may resume while an earlier spike remains in the hour.
  • Charge new organic admissions and active-owner replacements. Both direct completion and workflow reconciliation now charge a qualifying new-input successor exactly once. The shared predicate is captured before finishing clears lease identity; publication recovery, scheduled successors, coalescing, replay, and same-input retries remain excluded.
  • Remove proof-output deletion and its ownership-marker machinery. The harness creates a fresh output directory exclusively and refuses existing directories, files and symlinks. Its regression executes the real CLI against synthetic sentinel files, including . and parent-directory cases.
  • Report admissions/new-input successors separately from actual dispatches. Preserve the changing-load scenario added by the author and add sustained above-target load, a concentrated spike, and real queue reconciliation/replay controls.

Behavior proof

Claim and surface: the production ExactReviewQueue in workerd/SQLite retains bounded organic debt, admits organic overload without pretending it is a hard total cap, preserves throttle behavior, and charges a new-input successor recovered by reconciliation once. The filesystem control verifies that the actual proof CLI preserves existing operator files.

Scenario and environment: current main c1a83a00a73a800f45ff67ef5c7677ba4f17a8da versus the candidate source identified by recorded hashes, through real enqueue, alarm, claim, completion, requeue, reconciliation and replay calls. The full combined simulation includes normal load, superseding/requeued input, changing hourly load, sustained 400/hour organic traffic, a 400-item spike, and throttle feedback. GitHub, credentials, clock and workload are synthetic. No live inference, production state, or GitHub mutation is involved.

Current combined proof: https://crabbox.openclaw.ai/portal/runs/run_4d793e62c284e7a30488619c875b7dbc. Full check: https://crabbox.openclaw.ai/portal/runs/run_a14a6d8392e7fb1ae21d98056daca775.
Provider aws, lease cbx_3cb5de4e8f4c, image ami-0461d919be7deb53c, Node 24.18.1, workerd 1.20260701.1, Miniflare 4.20260701.0. Runtime source hashes are recorded in the result; the post-commit files at 4c1feb68dfd108d752c4a842a8c29ff563b80551 match the tested source. The earlier isolated receipt and reproducible commands are in the proof document.

node scripts/proof-scheduled-budget.mjs c1a83a00a73a800f45ff67ef5c7677ba4f17a8da /tmp/clawsweeper-proof-tools .artifacts/budget-combined-proof-2
Observation Current main Candidate
Reconciled new-input successor balance 6 → 6 balance 24 → 23
Replayed reconciliation zero extra debits zero extra debits
Sustained 400/hour organic: largest rolling hour 417 admissions 418 admissions
Concentrated 400-item spike: largest rolling hour 427 admissions 514 admissions
First scheduled admission after minute-20 spike minute 23.5 minute 28.5
Scheduled admissions during throttle cooldown zero zero

Both variants admit all 31 organic arrivals during the throttle cooldown. Candidate scheduled concurrency remains at or below 32. The preserved 130→300→130 scenario admits 226, 331 and 192 items across its three hours, while separately recording actual dispatches. The spike and sustained-load results demonstrate that 244 is not a total-admission ceiling.

The combined runtime harness passed. That job then stopped on the docs check because the validation checkout had not indexed the new linked receipt; indexing it and rerunning the full check passed. The earlier independent fixes also passed a full check before the author/main integration. No failing application assertion was waived.

The candidate runtime input SHA-256 values match the published files:

  • dashboard/exact-review-queue.ts: e06feaec95029a7f2c1810e11ccf5c754a953be1626bc77718ccf17226b45f0b
  • dashboard/wrangler.toml: 90db5d9b3093c7edc647b3329ffde989603d1c8b9fe68d76058336b6289ed673
  • .github/workflows/sweep.yml: 33ca5969022cf5b268e7a405db2f535056a2de64c3baa5c81941a44c4e0ebd2e

Limits: seeded simulation and unlimited candidate supply do not establish live GitHub quota headroom, inference cost, or Actions scheduling behavior. This proof does not approve a production rate increase. The advertised budget is an admission target with bounded organic debt, not a total-work ceiling.

Persisted upgrade and rollback proof

The additional review request is addressed with eight real workerd/SQLite restart cases. Each begins on the deployed 60/hour, burst-six implementation, then reopens the same Durable Object with the candidate and finally the baseline. Both retaining 60/6 and proposing 220/24 are covered, each with a partially spent balance, exhausted balance, legacy persisted -1, and populated hot/normal lane buckets.

Upgrade preserves all bucket, item and delivery records exactly and does not mint a fresh burst. Candidate organic admissions reach the appropriate debt floor. Rollback preserves the same records but restores the old debt-forgiving interpretation: it displays negative credit as zero, sheds an immediate scheduled offer, and admits a different item one minute later. This proves storage compatibility, not preservation of the new debt-repayment delay during rollback.

All eight cases passed, along with the throttle and reconciliation controls, on AWS lease cbx_36bc5d811d57, image ami-0461d919be7deb53c, Node 24.18.1. Run: https://crabbox.openclaw.ai/portal/runs/run_e83abfd93218638403762c9fb6d856af. The checked-in docs/proof/scheduled-budget/upgrade-and-rollback.json records runtime and harness hashes, row digests and limits. Runtime files match 4c1feb68dfd108d752c4a842a8c29ff563b80551; the proof harness was an uncommitted overlay on that head. The proof-only follow-up is d26aeb7774e7dd8531cf4ddf4382f47bb679366e and changes only the harness, documentation and receipt.

PROOF_SCENARIOS=throttle_organic_130 node scripts/proof-scheduled-budget.mjs c1a83a00a73a800f45ff67ef5c7677ba4f17a8da /tmp/clawsweeper-proof-tools .artifacts/budget-upgrade-proof-3

Validation and finding disposition

  • The new output-preservation and reconciliation regressions failed on the original branch and pass with the fixes. Existing debt, dedupe, retry and lane tests also pass.
  • pnpm run check at the runtime-source head 4c1feb68df: 7,057 tests: 7,038 passed, 19 skipped, zero failures, plus 13 changed-coverage tests.
  • pnpm run check:docs and formatting checks pass. The reproduction command now uses the documented tool path directly.
  • Independent Codex review through P3: the accounting changes and full committed branch at 4c1feb68df are clean. The additional persistence harness and receipt also passed a fresh isolated local review with no accepted/actionable findings.
  • The persistence follow-up passed all eight restart cases and the throttle/reconciliation controls. A fresh Crabbox full-check dispatch was blocked by two coordinator timeouts before execution; current-commit GitHub CI supplies the full-check gate.
  • Accepted output-cleanup and total-rate findings are addressed. The additional reconciliation undercharge is fixed and covered through the actual queue runtime.

OpenClaw Bay and rollout

Bay's schema and observer-only role are unchanged. If the proposed settings are approved, scheduled_feed.target_rate_per_hour changes value. The higher target and extra planner offers can increase GitHub and inference demand; live quota headroom remains an operator decision. Keep this PR unmerged until that scope is chosen. Restoring the current rate/burst/hot defaults and crons is a configuration rollback; the accounting fixes require no new store or schema.

Maintainer decision

On 2026-10-01, in the maintainer's agent session, Peter Steinberger instructed: "land 1710". That approves the proposed scope as written: a 220/hour target, a 24-item burst, a 30/hour hot-lane rate, and normal backfill every 20 minutes. It also accepts the documented rollback pacing, where rollback forgives negative credit.

Context at the time of the decision: seven-day coverage on openclaw/openclaw was 32.2%, with 3,880 stale, 1,509 unreviewed and 1,248 expired records, and normal backfill ran 61 reviews in 24 hours.

Rollout watch for the first 2 hours after deploy, then daily:

  • /api/exact-review-queue: scheduled_feed, lanes.review.backoff_reasons.throttle_retry, shed reasons;
  • /api/github-egress-observability: 403/429 on the target_app pool;
  • /api/review-coverage.

Roll back if throttle_retry stays above 0 for 15 minutes, or if target_app 403/429 exceeds 1% of wire attempts in a 30-minute window. Rollback means EXACT_REVIEW_TARGET_RATE_PER_HOUR = "60", EXACT_REVIEW_TARGET_BURST = "6" and unsetting the hot rate. That is a Worker var redeploy; the accounting stays.

This head merges current main (b67d265eae); the CHANGELOG diff against main is exactly this PR's one entry. Codex /review (autoreview, branch mode against origin/main) runs on this head before merge.

… its review budget

Scheduled normal backfill delivered ~4 reviews/hour against the ~56/hour
needed to hold 7-day coverage on openclaw/openclaw. The organic-first
admission bucket did not actually account for organic work: stored debt was
clamped to zero on every read, and only brand-new queue keys were charged,
so supersedes and source-drift requeues ran uncounted. The 35/65 lane split
applied to the total rather than the remainder, letting hot intake (offered
every 5 minutes) take what little budget was left.

- Carry organic debt on the global scheduled bucket down to -burst; lane
  buckets stay non-negative.
- Debit the global bucket for every organic execution: a new key, a
  superseding revision that revokes a dispatching/leased owner, and a
  completion requeue for new review input (requeue_latest or a changed
  desired revision). Pending coalesces, dedupes, publications and
  same-revision retries are not charged.
- Production budget 60/h -> 220/h, burst 6 -> 24; new optional
  EXACT_REVIEW_HOT_INTAKE_RATE_PER_HOUR (production 30; unset keeps 35%),
  normal backfill receives total minus hot.
- Offer openclaw/openclaw normal backfill every 20 minutes: direct planner
  1 * * * * -> 9/20 * * * *, fleet normal fanout 41 * * * * -> 14/20 * * * *.
  Hot containment and the 32-slot scheduled cap are unchanged.
- Update limits/scheduler/README docs, documentation-sync claims, tests.
Drives the real ExactReviewQueue in workerd with a fake clock: organic new items, supersedes and requeue_latest completions, scheduled hot/normal offers at each revision's sweep.yml cadence, dispatch, claim, completion and a GitHub throttle signal, comparing a base ref with the working tree.
Pins the simulated-hour proof to 15fcdf6 with the harness and result sha256, the restated organic-debt gate, and the per-hour organic/hot/normal table for origin/main versus this branch.
@steipete
steipete requested a review from a team as a code owner September 28, 2026 05:04
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. 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. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 30, 2026, 11:25 PM ET / October 1, 2026, 03:25 UTC (Revision 8).

ClawSweeper review

What this changes

The branch charges organic review admissions and successors against scheduled capacity, raises the scheduled budget, increases normal backfill frequency, and adds runtime proof and regression coverage.

Merge readiness

✅ Ready for maintainer review

The PR remains useful: current main lacks these accounting corrections and operating settings. No actionable patch defect remains, the runtime and persistence evidence is sufficient, and the recorded maintainer decision resolves the previous rollout blocker.

Priority: P2
Reviewed head: b67d265eae5f0a520da986d17c9b969d5c46cd69

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused runtime changes have strong queue-boundary proof, persisted-state coverage, resolved prior findings, and an explicit operating-policy disposition.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The actual queue runs through enqueue, HTTP dispatch, claim, completion, reconciliation, replay, and throttle scenarios in workerd/SQLite on AWS. Current queue/configuration fingerprints match the tested inputs; subsequent workflow changes concern target checkout caching. Eight persisted restart cases verify upgrade and rollback compatibility, including the accepted rollback pacing. Synthetic GitHub and clocks do not establish live quota or spend headroom.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The actual queue runs through enqueue, HTTP dispatch, claim, completion, reconciliation, replay, and throttle scenarios in workerd/SQLite on AWS. Current queue/configuration fingerprints match the tested inputs; subsequent workflow changes concern target checkout caching. Eight persisted restart cases verify upgrade and rollback compatibility, including the accepted rollback pacing. Synthetic GitHub and clocks do not establish live quota or spend headroom.
Evidence reviewed 9 items Pinned introduced changes: The pinned main-to-head diff adds active-owner and successor debits, preserves bounded global debt, and adds a configurable hot-lane rate. Main retains the debt-forgiving implementation, 60/hour rate, six-item burst, and hourly normal planners.
Successor accounting and replay controls: Completion and reconciliation capture the same debit predicate before lease cleanup. Regression coverage distinguishes changed input, unchanged retries, scheduled successors, and repeated completion or reconciliation.
Real queue behavior proof: The inspected harness runs the production queue in workerd with SQLite and actual loopback HTTP dispatches. Recorded overload and throttle results show one reconciliation successor debit, no replay debit, zero scheduled admissions during cooldown, and unconditional organic admission. AWS provider, lease cbx_908d6c2293ca, image ami-0461d919be7deb53c, and synthetic-environment limits are recorded. This earlier receipt is explicitly identified as predating the combined proof described in the captured PR body.
Findings None None.
Security None None.

How this fits together

ClawSweeper’s durable review queue receives webhook requests and scheduled candidates, then admits and dispatches review workflows. Shared credit, lane limits, and throttle feedback control scheduled work while organic requests retain priority.

flowchart TD
  A[Organic requests] --> C[Durable review queue]
  B[Scheduled candidates] --> C
  C --> D[Shared credit and lane budgets]
  E[Throttle feedback] --> D
  D --> F[Review workflow dispatch]
  F --> G[Completion and reconciliation]
  G --> C
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Scheduled capacity 60 → 220/hour; burst 6 → 24; normal planners 1 → 3/hour These approved settings materially increase scheduled demand and make rollout telemetry important.
Code and coverage delta Production queue +35/-2; tests +333/-13; proof harness +985 The small runtime change has substantial, explicitly justified regression and production-path proof support.

Technical review

Best possible solution:

Keep accurate admission accounting and the approved operating settings, with the documented rollout monitoring and configuration rollback thresholds.

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

Yes: main’s bucket read discards negative credit and its successor paths omit the new debits; the supplied workerd receipts demonstrate the before/after behavior. This read-only review did not execute the harness.

Is this the best way to solve the issue?

Yes: the branch extends the existing shared admission budget, preserves organic priority and throttle handling, and verifies existing-state compatibility without introducing a parallel scheduler.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 65f9c3a30576.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded queue throughput and accounting improvement rather than an emergency runtime failure.
  • merge-risk: 🚨 automation: Higher scheduled rates and more planner offers increase GitHub and inference demand; the captured maintainer decision accepts that tradeoff with monitoring thresholds.
  • merge-risk: 🚨 compatibility: Persisted negative credit changes scheduled pacing, with verified upgrade compatibility and explicitly accepted debt-forgiving rollback behavior.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The actual queue runs through enqueue, HTTP dispatch, claim, completion, reconciliation, replay, and throttle scenarios in workerd/SQLite on AWS. Current queue/configuration fingerprints match the tested inputs; subsequent workflow changes concern target checkout caching. Eight persisted restart cases verify upgrade and rollback compatibility, including the accepted rollback pacing. Synthetic GitHub and clocks do not establish live quota or spend headroom.
  • proof: sufficient: Contributor real behavior proof is sufficient. The actual queue runs through enqueue, HTTP dispatch, claim, completion, reconciliation, replay, and throttle scenarios in workerd/SQLite on AWS. Current queue/configuration fingerprints match the tested inputs; subsequent workflow changes concern target checkout caching. Eight persisted restart cases verify upgrade and rollback compatibility, including the accepted rollback pacing. Synthetic GitHub and clocks do not establish live quota or spend headroom.

Evidence

What I checked:

  • Pinned introduced changes: The pinned main-to-head diff adds active-owner and successor debits, preserves bounded global debt, and adds a configurable hot-lane rate. Main retains the debt-forgiving implementation, 60/hour rate, six-item burst, and hourly normal planners. (dashboard/exact-review-queue.ts:12067, b67d265eae5f)
  • Successor accounting and replay controls: Completion and reconciliation capture the same debit predicate before lease cleanup. Regression coverage distinguishes changed input, unchanged retries, scheduled successors, and repeated completion or reconciliation. (test/dashboard-worker-queue-policy.test.ts:4050, b67d265eae5f)
  • Real queue behavior proof: The inspected harness runs the production queue in workerd with SQLite and actual loopback HTTP dispatches. Recorded overload and throttle results show one reconciliation successor debit, no replay debit, zero scheduled admissions during cooldown, and unconditional organic admission. AWS provider, lease cbx_908d6c2293ca, image ami-0461d919be7deb53c, and synthetic-environment limits are recorded. This earlier receipt is explicitly identified as predating the combined proof described in the captured PR body. (docs/proof/scheduled-budget/overload-and-reconciliation.json:1, b67d265eae5f)
  • Existing-state compatibility: Eight baseline-to-candidate-to-baseline workerd/SQLite restart cases cover retained 60/6 and proposed 220/24 settings, positive and exhausted credit, legacy negative credit, and populated lane buckets. Bucket, item, and delivery records survive reopening without a fresh burst. Rollback restores the explicitly documented debt-forgiving pacing. Provider aws, lease cbx_36bc5d811d57, and the runtime and harness fingerprints are recorded. (docs/proof/scheduled-budget/upgrade-and-rollback.json:1, b67d265eae5f)
  • Proof continuity at current head: Current queue and Worker configuration hashes exactly match the recorded runtime inputs, and the proof harness matches its persistence receipt. GitHub comparison from the tested runtime head shows only unrelated target-checkout cache changes in sweep.yml among these runtime inputs; the budget crons and routing remain intact. Local historical blob comparisons were unavailable, so the read-only GitHub comparison supplied that check. (dashboard/exact-review-queue.ts, b67d265eae5f)
  • Recorded acceptance of operating tradeoffs: The captured PR body’s Maintainer decision section records Peter Steinberger’s October 1 approval of 220/hour, burst 24, hot rate 30/hour, twenty-minute normal planners, and debt-forgiving rollback pacing. It supplies throttle and GitHub-egress rollback thresholds. The named decision owner is also identified by repository policy. These accepted limitations remain label context rather than unresolved blockers; the recorded decision is not merge authorization for this read-only review.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (7 earlier review cycles)
  • reviewed 2026-09-28T05:08:49.448Z sha d013ad8 :: blocked before merge. :: [P2] Guard the proof output path before recursive removal | [P2] Correct the total-rate guarantee under organic overload
  • reviewed 2026-09-28T07:29:54.684Z sha e1dd947 :: blocked before merge. :: none
  • reviewed 2026-09-28T08:40:39.248Z sha 4c1feb6 :: blocked before merge. :: none
  • reviewed 2026-09-28T08:53:56.173Z sha 4c1feb6 :: blocked before merge. :: none
  • reviewed 2026-09-28T09:42:21.862Z sha d26aeb7 :: blocked before merge. :: none
  • reviewed 2026-09-28T10:04:42.727Z sha d26aeb7 :: blocked before merge. :: none
  • reviewed 2026-09-30T00:27:33.099Z sha 69c174b :: blocked before merge. :: none

…ganic spike

The harness recursively replaces its output directory, so it now refuses any path that is not strictly inside the checkout's .artifacts/ directory and any existing non-empty directory without its own marker file, before loading tooling. Adds a 130/300/130 organic-per-hour scenario and per-hour minimum global balance, and asserts the balance never drops below -burst.
…organic

Organic work is always admitted and debt beyond -burst is dropped at the floor, so total executions stay within max(rate, organic rate) + burst over time and scheduled admission falls to nearly zero while organic runs at or above the rate. Adds a regression test for sustained above-rate organic load: scheduled stays shed, the balance floors at -burst, and scheduled resumes only after the debt is repaid.
… proof

Re-runs the scheduled budget proof on the clean head 85d38e6 against main 1b2c262: scheduled admission is bounded, organic work is unbounded, and total executions stay within max(rate, organic rate) + burst. Adds the 130/300/130 organic spike row: scheduled admission falls to 11 during the spike with the balance at the -24 floor, then recovers. Updates the head SHA and harness/result/source hashes.
@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 status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Sep 28, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. proof: sufficient Contributor real behavior proof is sufficient. and removed proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 28, 2026
@clawsweeper clawsweeper Bot removed the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Sep 28, 2026
@clawsweeper clawsweeper Bot added the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Sep 28, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 1, 2026
@steipete
steipete merged commit cac974b into main Oct 1, 2026
21 of 24 checks passed
@steipete
steipete deleted the perf/scheduled-backfill-budget branch October 1, 2026 04:40
@steipete

steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Post-merge rollout record (merge cac974b3e1, Worker deployment_sha confirmed via /api/health, scheduled_feed.target_rate_per_hour = 220). The watch ran 2 hours, 04:53–06:45 UTC, with 23 samples every 5 minutes:

  • Rollback thresholds: not tripped. lanes.review.backoff_reasons.throttle_retry stayed at 0. target_app 403/429 stayed at 0.0% of wire attempts, but /api/github-egress-observability lagged several hours behind (latest bucket 01:30Z at 06:45Z), so this signal is weak.
  • Scheduled concurrency: peaked at 10 of 32.
  • Scheduled sheds: grew by 174 during the window. Health-history counters show review enqueues of about 210–223/hour and completions of about 208/hour. Only about 111 exact-review workflow runs per hour actually started.

Finding: the organic charge is applied at admission. Roughly half of admitted organic items never run a review (superseded or coalesced before dispatch, or finished as a no-op), so charged organic work sits at or above the 220/hour budget and scheduled backfill stays mostly shed. A follow-up will charge the budget for reviews that actually run, so that 220/hour means executed reviews. No rollback was needed.

steipete added a commit that referenced this pull request Oct 1, 2026
…1736)

* fix(queue): charge the review budget when a review lease is claimed

Production after #1710 admitted ~215 organic items/hour and charged each one
at admission, but only ~111/hour ever started a review: the rest were closed
before the dispatch-time live check, superseded while still dispatching,
coalesced, or deduped. The charged organic rate sat at or above the 220/hour
budget, the global balance stayed at the -burst floor, and every scheduled
hot/normal offer was shed.

Meter executions instead of admissions. Every new claim generation of a
review lease (a workflow run that actually starts) debits one global token in
the same synchronous turn that grants the lease; same-attempt claim retries
take the idempotent early return and are not charged again. Organic
admission, superseding revisions, and completion/reconciliation requeues no
longer debit; their next claim does. Publications and acknowledgement-only
finalizers are never charged.

Scheduled admission still debits at admission, where it is gated, and marks
the new item reviewBudgetPrepaid so its first claim is not charged a second
time, including after an organic event coalesces into it or supersedes it
before claim. Later claims of the same item are charged like organic ones.

Organic is always admitted, scheduled spends only positive balance, the
debt floor stays -burst, throttle feedback still pauses scheduled
admission, and the hot cap and lane buckets are unchanged. The new item
field is additive; the base ignores and preserves it on rollback.

Extend scripts/proof-scheduled-budget.mjs with a production_2026_10_01
scenario (closed-before-dispatch items, supersede of dispatching owners),
per-hour claimed executions, a variant-neutral reconciliation proof, and an
upgrade/rollback proof against the #1710 accounting.

* docs(proof): record claim-time review budget charging proof

Runs scripts/proof-scheduled-budget.mjs on the clean head 3febf5e against
main cac974b (#1710) in workerd/SQLite. In the production_2026_10_01
scenario (~215 new organic items/hour, ~110/hour executed) the base sheds every
scheduled offer with the balance at -24, while the head admits 98-115
scheduled reviews/hour and runs 214-225 executions/hour (rolling max 236 of
244). The #1710 scenarios, throttle pause, reconciliation exactly-once and
persisted upgrade/rollback are recorded alongside. Marks the #1710 proof as
historical.
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: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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