Skip to content

fix(queue): preserve review budget for temporary deferrals - #1028

Merged
vincentkoc merged 2 commits into
mainfrom
fix/clawsweeper-systemic-review-recovery
Aug 4, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
fix/clawsweeper-systemic-review-recovery

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where exact reviews delayed by an active same-head review or GitHub throttling consumed normal review failure attempts. Repeated temporary deferrals could therefore park valid review work as review_retry_exhausted without a content or model failure.

Why This Change Was Made

The regular-review completion contract now accepts an explicit retry_kind of coordination or throttle, paired with a bounded retry_at. Same-revision typed deferrals retain their existing attempt counters and wait until the requested deadline; newer revisions discard the stale deadline. Untyped review failures keep the existing failure-budget behavior.

The workflow propagates the typed reason only for known lease coordination and GitHub throttle paths. Publication completions and invalid type/outcome/deadline combinations are rejected. Systemic outage recovery, parked-item revival, lease expiry, and unrelated review noise remain out of scope.

User Impact

Temporary coordination and rate-limit delays no longer consume the eight-attempt review failure budget. Actual review failures still back off, spend attempts, and park at the existing limit.

OpenClaw Bay can display the new coordination retry and throttle retry backoff reasons through its existing generic reason renderer. No Bay mutation or control surface changes are needed; Bay remains observer-only.

Evidence

  • node --test --test-name-pattern='exact-review queue (defers coordination|defers throttle|spends|does not carry|rejects invalid retry|rejects regular-review retry)' test/dashboard-worker.test.ts - 6/6 passed.
  • node --test test/sweep-workflow.test.ts - 113/113 passed.
  • Direct equivalents of pnpm run check passed with the existing linked toolchain: active-surface, dashboard queue-boundary, limits, full format check, dashboard/test lint, and all three TypeScript builds.
  • GitHub CI pnpm check, CodeQL, workflow analysis, JavaScript/TypeScript analysis, sparse repair smoke, and Windows Codex launcher all passed on 0e3ad79a538767c92f85a4214391cff7d754f5ab.
  • Direct AWS Crabbox fresh-PR proof passed: provider aws, run run_238ea8cc8d52, lease cbx_f52b2ff84eca, image-backed machine c7a.8xlarge, exact head 0e3ad79a538767c92f85a4214391cff7d754f5ab, artifact .artifacts/retry-deferral-crabbox-proof.md.
  • Pre-commit structured autoreview: clean, no accepted/actionable findings.
  • git diff --check - passed.

pnpm run check itself could not start locally because this shared worktree's linked node_modules was installed by a different pnpm state and pnpm attempted a destructive module purge. The same commands were run directly from the existing linked binaries instead.

Real Behavior Proof

  • Claim: completing a regular exact-review lease with a typed coordination or throttle deferral keeps attempts and reviewFailureAttempts unchanged, persists the requested deadline/backoff reason, and returns { ok: true, requeued: true }; an untyped failure still increments both counters.
  • Exercised surface: the real ExactReviewQueue /complete HTTP handler and durable queue transition, plus the event-review workflow payload builder.
  • Fixture: claimed protocol-v2 regular-review items at the same revision, with existing nonzero counters; coordination and throttle callbacks; an untyped callback; a newer-revision callback; invalid contract and publication-item callbacks.
  • Command/environment: a clean --fresh-pr openclaw/clawsweeper#1028 checkout on direct AWS Crabbox, Node 24+, corepack pnpm install --frozen-lockfile, all three TypeScript builds, the six focused queue cases, and the complete 113-case workflow suite.
  • Observed result: typed same-revision deferrals preserved counters and set coordination_retry / throttle_retry; the untyped failure incremented both counters; the newer revision reset counters and ignored the old deadline; invalid combinations returned HTTP 400.
  • Trace: run portal https://crabbox.openclaw.ai/portal/runs/run_238ea8cc8d52; proof artifact .artifacts/retry-deferral-crabbox-proof.md; test names and assertions are in test/dashboard-worker.test.ts; workflow propagation assertions are in test/sweep-workflow.test.ts.
  • Limits: no production Worker was deployed and no live GitHub throttle was induced. The isolated run exercised the actual queue handler with deterministic Durable Object storage and the shipped workflow payload contract.

@vincentkoc vincentkoc self-assigned this Aug 4, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@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. 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. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 10:16 AM ET / 14:16 UTC.

ClawSweeper review

What this changes

The PR classifies coordination and GitHub-throttle deferrals so the exact-review queue preserves review-failure attempts while scheduling the requested retry.

Regression provenance

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

Merge readiness

⛔ Blocked until stronger real behavior proof is added - 3 items remain

Keep open for maintainer review: the branch addresses a source-reproducible queue-budget defect, but this member-authored draft still needs a proof-sufficiency decision for its queue/workflow boundary evidence.

Priority: P2
Reviewed head: 0e3ad79a538767c92f85a4214391cff7d754f5ab
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and well-covered, but merge readiness is capped by unavailable deployment-equivalent behavior proof.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: The PR describes a fresh AWS handler run, but the independently inspectable evidence does not demonstrate the required deployment-equivalent workflow-to-queue handoff; attach a redacted current-head local-container trace. 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 stronger real behavior proof before merge: The PR describes a fresh AWS handler run, but the independently inspectable evidence does not demonstrate the required deployment-equivalent workflow-to-queue handoff; attach a redacted current-head local-container trace. 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 Current failure path: Current main treats every regular failed completion as a retry that increments both the general and review-failure counters; a typed temporary deferral is therefore needed to preserve the review budget.
Workflow boundary: Current main forwards only a retry deadline from held reservations and coordination artifacts, so the PR's proposed retry-kind propagation is the relevant workflow-to-queue contract change.
Recent area provenance: The current queue path was recently refactored by Peter Steinberger in the safe-publication retry work, following the earlier throttled live-item retry fix.
Findings None None.
Security None None.

How this fits together

The exact-review queue accepts completion callbacks from the sweep workflow and decides whether an item is retried, parked, or completed. Its retry counters prevent persistent review failures from looping indefinitely while workflow coordination handles temporary delays.

flowchart LR
  A[Sweep workflow] --> B[Completion callback]
  B --> C[Exact-review queue]
  C --> D{Retry classification}
  D -->|Temporary deferral| E[Keep review budget]
  D -->|Regular failure| F[Spend retry attempt]
  E --> G[Scheduled retry]
  F --> G
Loading

Decision needed

Question Recommendation
Does the reported isolated AWS Crabbox run satisfy the repository's required proof for this queue/workflow contract, or should a local-container boundary trace be required before merge? Require boundary proof: Keep the draft open until a current-head local-container artifact shows the queue completion endpoint receiving each typed workflow payload.

Why: The repository policy requires controlled runtime proof for queue and workflow changes, and the submitted evidence explicitly excludes a deployed Worker and live throttle while the independently inspectable artifact is unavailable.

Before merge

  • Resolve merge risk (P1) - The workflow and durable queue must agree on retry kind, outcome, and deadline; a mismatched completion could consume budget again or reject a valid temporary deferral.
  • Resolve merge risk (P1) - The supplied proof exercises an isolated handler with deterministic Durable Object storage and workflow assertions, not a deployment-equivalent queue/workflow handoff trace.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta production +51/-4, tests +120/-8 The branch adds a small typed queue/workflow contract with substantially more focused regression coverage.
Affected surfaces 4 files affected The change spans the durable queue, dispatch workflow, and their focused tests.

Merge-risk options

Maintainer options:

  1. Prove the handoff before merge (recommended)
    Add a current-head local-container trace covering the workflow payload and queue completion transition for both typed deferrals and an ordinary failure.
  2. Accept isolated-handler coverage
    Maintain the current implementation and explicitly accept that the supplied proof does not demonstrate the deployed-equivalent workflow-to-queue handoff.

Technical review

Best possible solution:

Retain the explicit typed retry contract, then attach a current-head Docker-backed local-container trace that exercises the completion HTTP boundary and workflow payload handoff for coordination, throttling, ordinary failure, and source drift.

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

Yes, from source: current main increments regular review-failure attempts for every failed lease, while held coordination and throttled workflow paths provide only a deadline. The exact operational failure still needs boundary proof rather than another unit-only reproduction.

Is this the best way to solve the issue?

Yes, with proof pending: an explicit retry discriminator is safer than inferring a temporary deferral from a generic failure or deadline, provided both workflow producers use the same constrained contract.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded reliability fix for review scheduling rather than an active user-facing outage.
  • merge-risk: 🚨 automation: The branch changes the workflow-to-queue completion payload and retry scheduling behavior.
  • 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 stronger real behavior proof before merge: The PR describes a fresh AWS handler run, but the independently inspectable evidence does not demonstrate the required deployment-equivalent workflow-to-queue handoff; attach a redacted current-head local-container trace. 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:

  • Current failure path: Current main treats every regular failed completion as a retry that increments both the general and review-failure counters; a typed temporary deferral is therefore needed to preserve the review budget. (dashboard/exact-review-queue.ts:10735, 3d4b45a19e50)
  • Workflow boundary: Current main forwards only a retry deadline from held reservations and coordination artifacts, so the PR's proposed retry-kind propagation is the relevant workflow-to-queue contract change. (.github/workflows/sweep.yml:1709, 3d4b45a19e50)
  • Recent area provenance: The current queue path was recently refactored by Peter Steinberger in the safe-publication retry work, following the earlier throttled live-item retry fix. (dashboard/exact-review-queue.ts:10713, 8558de58384a)
  • Current PR evidence: The PR body reports a fresh AWS Crabbox run and focused handler/workflow tests, but the linked run artifact was not available in the supplied scratch directory for independent inspection; its stated limits exclude a deployed Worker and live GitHub throttle. (0e3ad79a5387)

Likely related people:

  • Peter Steinberger: Recent main-history work covers both safe publication retries and throttled live-item retry handling. (role: recent queue and workflow contributor; confidence: high; commits: 8558de58384a, 66ee8bbffaed, 4d48e9918b9b; files: dashboard/exact-review-queue.ts, .github/workflows/sweep.yml)
  • Martin Cleary: Recent exact-review lifecycle, telemetry, and Bay work establishes the adjacent queue-observability contract. (role: lifecycle and telemetry contributor; confidence: medium; commits: 29937558515e, 746186da68f0; files: dashboard/exact-review-queue.ts)
  • Vincent Koc: Prior merged work on exact-review publication state appears in the affected workflow history, independently of this proposed branch. (role: recent adjacent queue contributor; confidence: medium; commits: bc813d39ec5f; files: dashboard/exact-review-queue.ts, .github/workflows/sweep.yml)

Rank-up moves

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

  • Attach a redacted current-head local-container trace covering coordination, throttling, ordinary failure, and newer-revision behavior at the workflow-to-queue boundary.

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 (2 earlier review cycles)
  • reviewed 2026-08-04T14:01:49.407Z sha 0e3ad79 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-04T14:06:17.061Z sha 0e3ad79 :: needs maintainer review before merge. :: none

@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. and removed 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. labels Aug 4, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@vincentkoc

Copy link
Copy Markdown
Member Author

Maintainer proof decision: accept the current-head isolated-handler evidence for this bounded queue/workflow contract. The fresh AWS Crabbox run exercised the real ExactReviewQueue /complete HTTP boundary with Durable Object state and the shipped workflow payload builder for coordination, throttle, ordinary failure, newer-revision, and invalid-contract cases. Exact-head CI is green. A live GitHub throttle or deployed Worker would add environment proof but would not exercise a different owner boundary, so the optional local-container rank-up move is intentionally deferred.

@vincentkoc
vincentkoc marked this pull request as ready for review August 4, 2026 14:22
@vincentkoc
vincentkoc requested a review from a team as a code owner August 4, 2026 14:22
@vincentkoc
vincentkoc merged commit 2a61adc into main Aug 4, 2026
29 checks passed
@vincentkoc
vincentkoc deleted the fix/clawsweeper-systemic-review-recovery branch August 4, 2026 14:24
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. 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