Skip to content

fix(review): jitter throttled retry eligibility to break herd oscillation - #1076

Merged
steipete merged 1 commit into
mainfrom
steipete/retry-jitter
Aug 9, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/retry-jitter

Conversation

@steipete

@steipete steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Production telemetry on 2026-08-08 showed the review lane oscillating with a ~45-minute period across every token-routing configuration: successful-review rate swinging 12↔632/hr while throttle_retry backoff swung 19↔193. The retry schedule, not pool capacity, drives it — when throttling parks a cohort, the fixed 5/10/20-minute recovery ladder and fixed throttle-redispatch delays make the whole cohort eligible again simultaneously, recreating the herd that re-exhausts the rate-limit bucket.

The Fix

Retry-eligibility timestamps for throttled/parked review items get per-item uniform jitter in a 0.75–1.5x band, sampled once at schedule time and persisted as parkedRecoveryAt. Randomness is injectable through the queue constructor (Math.random in production, seeded in tests). Legacy parked records honor their original fixed schedule for one final cycle. Coordination waits, ordinary failure retries, and the publication lane's separate (already-spread) retry machinery are untouched, as are token routing, feed rate, and leases.

Proof

  • Seeded-RNG tests: all ladder steps stay within the 0.75–1.5x band; a same-tick parked cohort receives spread timestamps; unjittered paths byte-identical.
  • Dashboard worker suite 322/322; full pnpm test:unit 1,964 pass / 0 fail; pnpm run check green.
  • Coordinator autoreview clean (0.98).

Deploys with the dashboard workflow on merge. Expected effect: flattened backoff peaks and shallower duty-cycle troughs at unchanged feed rate — measurable against the telemetry baseline recorded on 2026-08-08.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 Urgent regression or broken agent/channel workflow affecting real users now. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Aug 9, 2026
@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 8, 2026, 9:59 PM ET / August 9, 2026, 01:59 UTC.

ClawSweeper review

What this changes

The PR adds persisted per-item jitter to parked review retries and throttle retry eligibility so review work does not resume in a synchronized cohort.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

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

Keep this PR open: its throttle path can schedule retries before the workflow-provided cooldown, which risks repeated GitHub throttling rather than dispersing it.

Priority: P1
Reviewed head: b39d1fbf62074b294e99ce9e0a5e3adfead48835

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has a concrete cooldown regression and lacks real after-fix behavior proof.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The body cites seeded tests and checks, but no redacted after-fix trace exercises throttling through the real queue boundary; add a Docker-backed Crabbox local-container trace with head, provider, image, lease, artifact, and limits. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The body cites seeded tests and checks, but no redacted after-fix trace exercises throttling through the real queue boundary; add a Docker-backed Crabbox local-container trace with head, provider, image, lease, artifact, and limits. 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 Throttle deadline is moved earlier: The new throttle branch scales the entire remaining requested delay by 0.75–1.5x, so a low sample schedules before the supplied retry deadline.
Workflow treats retry_at as a cooldown: The existing workflow emits a 20-minute throttle retry time and explicitly says the queue is deferred until that timestamp.
Regression test reverses the prior deadline contract: Current main asserted throttle and coordination deferrals were no earlier than retry_at; this PR instead expects a 45-minute throttle deadline to become 33.75 minutes.
Findings 1 actionable finding [P1] Keep throttle retries at or after the requested deadline
Security None None.

How this fits together

The exact-review Durable Object queues review jobs and redispatches them through the GitHub workflow. Workflow throttle signals provide a retry deadline, and the queue persists the next eligible time before scheduling its alarm.

flowchart LR
  A[Review workflow] --> B[Exact-review queue]
  B --> C{Throttled?}
  C -->|yes| D[Persist retry eligibility]
  D --> E[Queue alarm]
  E --> F[Redispatch review]
  C -->|no| F
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The body cites seeded tests and checks, but no redacted after-fix trace exercises throttling through the real queue boundary; add a Docker-backed Crabbox local-container trace with head, provider, image, lease, artifact, and limits. 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.
  • Keep throttle retries at or after the requested deadline (P1) - retry_at is currently a cooldown floor: the workflow emits it after GitHub throttling, and current-main coverage requires nextAttemptAt >= retryAt. Multiplying the remaining delay by 0.75 lets a low sample retry a 20-minute throttle at 15 minutes, reissuing rate-limited work early. Preserve retry_at as the floor and jitter only after it.
  • Resolve merge risk (P1) - A random value below one releases a GitHub-throttled item before its requested cooldown, causing fresh rate-limit responses and possible review-lane stalls.
  • Resolve merge risk (P1) - The PR cites tests and checks but has no after-fix production-boundary queue trace; its body also does not state whether OpenClaw Bay is unaffected.
  • Complete next step (P2) - The PR owner needs to correct the cooldown-floor regression and provide real behavior proof; automation cannot supply contributor-environment proof.
  • Improve patch quality - Keep throttle retry_at as a hard lower bound and add deterministic minimum-sample coverage.
  • Improve patch quality - Attach a redacted Crabbox local-container trace showing a throttled cohort recovering through the Durable Object without retrying before its deadline.
  • Improve patch quality - State whether OpenClaw Bay is unaffected; updating the PR body after proof should trigger a fresh review.

Findings

  • [P1] Keep throttle retries at or after the requested deadline — dashboard/exact-review-queue.ts:10762-10765
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Changed surface 4 files: runtime +57/-16, tests +136/-41, docs +7/-2 The runtime change alters persisted queue scheduling, while most added coverage is concentrated in the exact-review worker suite.

Merge-risk options

Maintainer options:

  1. Preserve the throttle cooldown floor (recommended)
    Schedule throttle retries at or after retry_at, add deterministic boundary coverage, and attach current-head real queue recovery proof before merge.

Technical review

Best possible solution:

Keep each workflow-provided throttle deadline as a hard floor, jitter only afterward to spread retries, then add a redacted Docker-backed Crabbox queue trace and state the OpenClaw Bay impact explicitly.

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

Yes, source-reproducible: inject a random function returning zero into the PR's 45-minute throttle case; the changed test demonstrates it persists a 33.75-minute retry time before retry_at.

Is this the best way to solve the issue?

No. The workflow retry_at is an existing no-earlier-than cooldown; jitter must be applied after that deadline rather than scaling its remaining duration downward.

Full review comments:

  • [P1] Keep throttle retries at or after the requested deadline — dashboard/exact-review-queue.ts:10762-10765
    retry_at is currently a cooldown floor: the workflow emits it after GitHub throttling, and current-main coverage requires nextAttemptAt >= retryAt. Multiplying the remaining delay by 0.75 lets a low sample retry a 20-minute throttle at 15 minutes, reissuing rate-limited work early. Preserve retry_at as the floor and jitter only after it.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: The proposed change can make the review automation retry known throttles before their cooldown expires.
  • add merge-risk: 🚨 availability: Early retry eligibility can keep the review lane under rate-limit pressure and delay queued reviews.
  • add merge-risk: 🚨 automation: This changes Durable Object retry scheduling for the GitHub review workflow.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The body cites seeded tests and checks, but no redacted after-fix trace exercises throttling through the real queue boundary; add a Docker-backed Crabbox local-container trace with head, provider, image, lease, artifact, and limits. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P1: The proposed change can make the review automation retry known throttles before their cooldown expires.
  • merge-risk: 🚨 availability: Early retry eligibility can keep the review lane under rate-limit pressure and delay queued reviews.
  • merge-risk: 🚨 automation: This changes Durable Object retry scheduling for the GitHub review workflow.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The body cites seeded tests and checks, but no redacted after-fix trace exercises throttling through the real queue boundary; add a Docker-backed Crabbox local-container trace with head, provider, image, lease, artifact, and limits. 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:

  • Throttle deadline is moved earlier: The new throttle branch scales the entire remaining requested delay by 0.75–1.5x, so a low sample schedules before the supplied retry deadline. (dashboard/exact-review-queue.ts:10764, b39d1fbf6207)
  • Workflow treats retry_at as a cooldown: The existing workflow emits a 20-minute throttle retry time and explicitly says the queue is deferred until that timestamp. (.github/workflows/sweep.yml:790, 22c7ddcc3051)
  • Regression test reverses the prior deadline contract: Current main asserted throttle and coordination deferrals were no earlier than retry_at; this PR instead expects a 45-minute throttle deadline to become 33.75 minutes. (test/dashboard-worker.test.ts:19524, b39d1fbf6207)
  • Temporary-deferral provenance: The current typed coordination/throttle deferral behavior appears to originate with the commit that preserved review budget for temporary deferrals. (dashboard/exact-review-queue.ts:10731, 2a61adcc1f06)
  • Not on current main or a release: The PR head is not an ancestor of current main, and no local release tag contains it. (b39d1fbf6207)

Likely related people:

  • Vincent Koc: Authored the current-main change that introduced coordination and throttle deferrals without spending review budget. (role: introduced typed temporary-deferral behavior; confidence: high; commits: 2a61adcc1f06; files: dashboard/exact-review-queue.ts, test/dashboard-worker.test.ts)
  • Peter Steinberger: Authored a recent substantial exact-review queue refactor immediately preceding the typed-deferral work. (role: recent queue refactor contributor; confidence: medium; commits: 8558de58384a; files: dashboard/exact-review-queue.ts)

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 81c23be into main Aug 9, 2026
19 checks passed
@steipete
steipete deleted the steipete/retry-jitter branch August 9, 2026 02:02
steipete added a commit that referenced this pull request Aug 12, 2026
Ports the durable command-intake pipeline for the "@clawsweeper re-review" command from the abandoned Aug-8 WIP (snapshot 4cad8de on codex/fix-command-review-publication) onto current main.

Commands are now durably recorded pre-acknowledgement (intake/watermark/receipt/revision tables, 16-item intake, 15s-15m bounded retries, 30-day receipts), verified against the live comment and head, fenced through verify/enqueue/effects stages, and superseded by full version identity - including equal-timestamp edits (review-caught P1). Acknowledgement and reaction effects are idempotent; router runs that throttle mid-command now recover instead of stranding the command (live instance: openclaw/openclaw#116562 was acked then lost when both router runs throttled).

Superseded snapshot pieces were dropped, not ported: retry jitter (#1076/#1077), quota headroom (#1086), retry budgets (#1089), parked reconciliation (#1111), branch guard (#962); dashboard-monolith diffs were reworked around the #1116/#1124/#1132 splits.

Proof: committed receipt at this exact head (docs/proof/durable-command-intake/), real Wrangler Worker + DO comparison with durable throttled recovery, GitHub confined to loopback API; full gate 7056 passed / 0 failed; strict check green. Verdict clean (Findings: None) on 9eb957e.
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. P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant