Skip to content

fix: unthrottle exact review admission - #953

Merged
steipete merged 1 commit into
mainfrom
fix/queue-admission-unthrottle
Jul 30, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/queue-admission-unthrottle

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • isolate review admission, handoff health, queue pressure, and backpressure from the independently-capacitated publication lane
  • prevent terminal or blocked publication keys from delaying review admission, and prove a review backlog can fill all 128 global claim slots
  • split shed telemetry into backpressure and scheduled_rate, retaining pre-migration history as unattributed

Root causes

The production status surface combined two lanes that do not share admission capacity. At 2026-07-30 09:12 UTC, the public API reported 20 top-level pending items and named openclaw/openclaw#114855@publish:30522572065:1 as the oldest handoff key, while lanes.review.pending was only 1 and lanes.publication.pending was 19. Likewise, ready_pending and admissible_pending were aggregate fields even though publication batching intentionally excludes publication rows from the legacy dispatcher. That made an independently-owned publication backlog look like review head-of-line blocking.

There were two real coupling bugs behind that misleading surface:

  1. Review backpressure used the combined pending count, so publication backlog could cross EXACT_REVIEW_PENDING_SOFT_LIMIT and shed new scheduled/recovery reviews while review capacity was empty.
  2. A terminal publication discovered during batch preflight returned from the alarm immediately. A stream of terminal publication keys could therefore consume successive alarms before ready reviews were considered.

Publication health was not derived from state_writer acquisitions or commits. The zero-commit state-writer sample after #936 was unrelated. Health was degraded by historical open dead letters and over-age publication rows; even an otherwise idle lane consulted dead letters before returning idle. Dead letters already have their own health signal, so current publication health now describes current pending/active/parked flow only. Publication health remains visible, but it no longer overrides review pressure or throttles review producers.

Finally, shed_since_reset combined true pending-limit backpressure with intentional 200/hour token pacing. The total 1,119 could not be attributed after the fact. New cumulative and 15-minute counters identify backpressure versus scheduled_rate; the already-persisted total is exposed as unattributed after migration.

Behavior after this change

  • top-level pending/ready/admissible, phase ages, oldest keys, handoff health, and pressure describe the review lane
  • publication backlog, health, retries, and DLQ remain under lanes.publication
  • review selection runs independently and first; publication keys cannot consume review slots or delay the same alarm after terminal cleanup
  • the pending soft limit counts review rows only
  • admission still respects 128 global and 120 per-target review caps, and a 200-item test backlog fills all 128 global slots

At the configured 200 reviews/hour and measured 4.1-minute mean service time, expected steady-state concurrency is about 200 * 4.1 / 60 = 13.7. The 50-item burst plus organic events can temporarily run higher; the production API already showed 23 active reviews later in the investigation. This change removes false publication coupling without changing the spend target or lowering the 128 claim ceiling.

Proof

  • node --test test/exact-review-health.test.ts test/queue-pressure.test.ts test/dashboard-worker.test.ts test/exact-review-publication-batches.test.ts — 342 passed
  • pnpm run build:dashboard — passed
  • pnpm run build — passed
  • pnpm run format:check — passed
  • pnpm run lint — passed
  • pnpm run check — static/build/lint/changed coverage passed; full suite had 2,778 passes and only the five documented unrelated macOS failures in process-tree-containment.test.ts because Apple libc does not export Linux capset
  • /Users/steipete/.claude/skills/autoreview/scripts/autoreview --mode local — TruffleHog clean; one complete pass; no accepted/actionable findings; correctness 0.97
  • /Users/steipete/.claude/skills/autoreview/scripts/autoreview --mode branch --base origin/main — TruffleHog clean; one complete pass; no accepted/actionable findings; correctness 0.98

Rollout

A Worker redeploy is required. Until then, the production API will continue to expose aggregate top-level queue fields and publication_degraded review pressure, and it will not expose shed reasons.

This PR does not deploy the Worker, run live apply/close commands, or merge itself.

@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: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Jul 30, 2026
@clawsweeper

clawsweeper Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 30, 2026, 5:18 AM ET / 09:18 UTC.

ClawSweeper review

What this changes

This PR makes exact-review admission, pressure, and backpressure review-lane-specific, keeps publication health separate, and records shed telemetry by backpressure versus scheduled-rate pacing.

Merge readiness

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

Keep this PR open for maintainer review. The review/publication decoupling is targeted and well-covered by focused tests, but the patch also removes published queue-pressure reason values and redefines top-level queue fields without a compatibility transition; it also needs after-fix Worker behavior proof beyond tests and checks. Likely related people: steipete (medium confidence).

Priority: P1
Reviewed head: 7d04d7363c2abd95df00395ca65e9e1ee01ede1b
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has useful focused coverage, but public API compatibility remains unresolved and real after-fix Worker behavior proof is not yet present.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body reports focused tests, builds, lint, and checks, but no after-fix run of the deployed Worker or equivalent real queue setup demonstrating that publication backlog cannot delay review admission; attach redacted live output or runtime logs after the required redeploy. 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) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports focused tests, builds, lint, and checks, but no after-fix run of the deployed Worker or equivalent real queue setup demonstrating that publication backlog cannot delay review admission; attach redacted live output or runtime logs after the required redeploy. 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 Review admission isolation: The proposed queue admission check changes the soft-limit comparison from all pending rows to review-only pending rows, which directly addresses publication backlog consuming review admission capacity.
Published API compatibility concern: The patch removes the public pressure reasons publication_degraded and publication_critical while documenting that top-level queue fields now describe only the review lane; existing consumers of the public queue endpoint may rely on the removed values or aggregate semantics.
Focused regression coverage: The PR adds and updates queue, dashboard, publication-batch, and pressure tests, including review-only soft-limit behavior and the independent publication-health path; the PR body reports 342 focused tests passing.
Findings 2 actionable findings [P1] Preserve the published queue-pressure reason contract
[P3] Leave the release-owned changelog to the release process
Security None None.

How this fits together

The exact-review queue receives scheduled, recovery, command, and publication work, then admits review jobs to bounded worker capacity and exposes queue health through the dashboard API. Publication performs a separate durable handoff path, while scheduler producers consume the queue API to decide how much review work to enqueue.

flowchart LR
  Producers[Scheduled and recovery producers] --> Queue[Exact-review durable queue]
  Queue --> Admission[Review admission and claim limits]
  Admission --> Workers[Review workers]
  Queue --> Status[Queue status API]
  Publication[Publication lane] --> PublicationHealth[Publication health telemetry]
  Status --> Producers
  PublicationHealth --> Status
Loading

Decision needed

Question Recommendation
Should the public exact-review queue API switch its existing top-level fields and pressure reasons to review-only semantics in this rollout, or should the old aggregate/publication signals remain available through a compatibility or versioned surface? Preserve a compatibility path: Keep or version the existing aggregate/publication-facing contract while exposing the new review-specific telemetry explicitly, then deprecate the old surface on a documented timeline.

Why: The internal decoupling is a clear repair, but the acceptable external API migration policy cannot be derived from the implementation alone.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports focused tests, builds, lint, and checks, but no after-fix run of the deployed Worker or equivalent real queue setup demonstrating that publication backlog cannot delay review admission; attach redacted live output or runtime logs after the required redeploy. 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.
  • Preserve the published queue-pressure reason contract (P1) - This removes publication_degraded and publication_critical from a public queue API while changing top-level fields from aggregate to review-only. Existing dashboard or scheduler consumers can silently lose their publication-health signal; retain a legacy/versioned surface or obtain explicit approval for the breaking migration before merging.
  • Leave the release-owned changelog to the release process (P3) - The repository policy treats CHANGELOG.md as release-owned for normal PR work. Remove this entry and keep the user-visible release context in the PR body or commit message instead.
  • Resolve merge risk (P1) - Merging changes the public queue endpoint’s top-level semantics and removes two pressure-reason values; dashboard or scheduler consumers that still interpret those values as aggregate health could silently change behavior unless the compatibility contract is explicitly preserved or versioned.

Findings

  • [P1] Preserve the published queue-pressure reason contract — dashboard/exact-review-health.ts:56
  • [P3] Leave the release-owned changelog to the release process — CHANGELOG.md:12
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 11 files affected; 324 added, 178 removed The change spans durable queue behavior, public dashboard telemetry, scheduler consumption, tests, and operator documentation.
Focused tests 4 focused test files; 342 passing claimed The reported tests cover the queue-pressure and publication-lane separation, but do not replace after-deploy behavior proof.

Merge-risk options

Maintainer options:

  1. Add a queue-API compatibility transition (recommended)
    Keep the old aggregate/publication semantics available through a legacy or versioned field while producers and dashboard consumers move to review-lane values.
  2. Approve the breaking contract intentionally
    Accept the removal of the old pressure reasons only after maintainers confirm that public queue API consumers are expected to migrate in this rollout.

Technical review

Best possible solution:

Keep review admission independent from publication, but preserve the existing public queue contract through an additive or versioned transition, then redeploy the Worker and attach redacted after-fix evidence showing publication backlog no longer delays review admission.

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

No high-confidence live reproduction was independently established in this review. The reported failure mechanism is source-reproducible from the proposed review-only soft-limit and terminal-publication scheduling paths, and the PR includes focused regression tests.

Is this the best way to solve the issue?

Unclear: separating internal review admission from publication is the narrow repair, but changing the already-published queue API semantics in place is not yet shown to be the best compatibility path.

Full review comments:

  • [P1] Preserve the published queue-pressure reason contract — dashboard/exact-review-health.ts:56
    This removes publication_degraded and publication_critical from a public queue API while changing top-level fields from aggregate to review-only. Existing dashboard or scheduler consumers can silently lose their publication-health signal; retain a legacy/versioned surface or obtain explicit approval for the breaking migration before merging.
    Confidence: 0.84
  • [P3] Leave the release-owned changelog to the release process — CHANGELOG.md:12
    The repository policy treats CHANGELOG.md as release-owned for normal PR work. Remove this entry and keep the user-visible release context in the PR body or commit message instead.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.79

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: This PR changes admission behavior for a real review workflow and can affect active scheduler/dashboard consumers immediately after a Worker redeploy.
  • add merge-risk: 🚨 compatibility: The diff changes documented public queue-field semantics and removes existing pressure-reason values without an explicit compatibility surface.
  • 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 reports focused tests, builds, lint, and checks, but no after-fix run of the deployed Worker or equivalent real queue setup demonstrating that publication backlog cannot delay review admission; attach redacted live output or runtime logs after the required redeploy. 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: This PR changes admission behavior for a real review workflow and can affect active scheduler/dashboard consumers immediately after a Worker redeploy.
  • merge-risk: 🚨 compatibility: The diff changes documented public queue-field semantics and removes existing pressure-reason values without an explicit compatibility surface.
  • 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 reports focused tests, builds, lint, and checks, but no after-fix run of the deployed Worker or equivalent real queue setup demonstrating that publication backlog cannot delay review admission; attach redacted live output or runtime logs after the required redeploy. 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:

  • Review admission isolation: The proposed queue admission check changes the soft-limit comparison from all pending rows to review-only pending rows, which directly addresses publication backlog consuming review admission capacity. (dashboard/exact-review-queue.ts:1400, 7d04d7363c2a)
  • Published API compatibility concern: The patch removes the public pressure reasons publication_degraded and publication_critical while documenting that top-level queue fields now describe only the review lane; existing consumers of the public queue endpoint may rely on the removed values or aggregate semantics. (dashboard/exact-review-health.ts:56, 7d04d7363c2a)
  • Focused regression coverage: The PR adds and updates queue, dashboard, publication-batch, and pressure tests, including review-only soft-limit behavior and the independent publication-health path; the PR body reports 342 focused tests passing. (test/dashboard-worker.test.ts:2006, 7d04d7363c2a)
  • Related history: The PR body distinguishes the state-writer observation after the already-merged state-projection removal from this queue-admission problem; the related PR is therefore adjacent context rather than the same root cause. (dashboard/exact-review-queue.ts:1400, 926a96b49381)
  • Repository policy applied: Repository guidance requires real-behavior proof for code-bearing PRs and treats CHANGELOG.md as release-owned; this branch includes a CHANGELOG entry and only test/check claims, not after-fix Worker proof. (CHANGELOG.md:12, 7d04d7363c2a)

Likely related people:

  • steipete: Authored the related merged state-lane refactor and the current queue-admission proposal; the PR discussion explicitly connects that recent operational-state work to the investigation while distinguishing its root cause. (role: recent area contributor; confidence: medium; commits: 926a96b49381; files: dashboard/exact-review-queue.ts, dashboard/exact-review-health.ts, src/queue-pressure.ts)

Rank-up moves

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

  • Resolve the public queue-API compatibility decision and update the patch accordingly.
  • After redeploying a non-production or approved Worker environment, attach redacted runtime evidence showing review admission proceeds while publication backlog is unhealthy.
  • Remove the release-owned CHANGELOG.md entry.

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 6ac2cce into main Jul 30, 2026
20 checks passed
@steipete
steipete deleted the fix/queue-admission-unthrottle branch July 30, 2026 09: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: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. 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