Skip to content

fix(queue): reconcile parked review items - #1111

Merged
steipete merged 5 commits into
mainfrom
steipete/parked-review-item-reconcile
Aug 11, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/parked-review-item-reconcile

Conversation

@steipete

@steipete steipete commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add a bounded, operator-signed inventory and reconciliation path for terminal or still-open reviews parked after the automatic recovery budget is exhausted
  • resolve terminal parked rows and re-enqueue open rows as fresh pending reviews with revision-fenced, idempotent mutations
  • keep command-context records visible but excluded from operator inspection, terminal resolution, and fresh recovery
  • run the guarded reconciliation from the existing scheduled dead-letter workflow and retain a sanitized artifact

Command-context route diagnosis

Command-context review items can genuinely reach parked through real routes; this exclusion is not only defense-in-depth. The legacy command dispatcher emits a clawsweeper_item with a command status marker and optional status comment id in src/repair/comment-router.ts. The legacy intake in .github/workflows/sweep.yml turns that event into a signed queue enqueue. A permanent per-item repository-dispatch rejection reaches parkRecoverableExactReviewItem(..., "dispatch_rejected") in dashboard/exact-review-queue.ts, without excluding command context. Claimed non-publication command reviews can likewise reach review_retry_exhausted through the normal completion retry ceiling.

The command-specific exception is a terminal-finalization acknowledgement driver: dispatch failure keeps that driver pending with publication retry backoff rather than parking it. That separate branch does not apply to the initial command review exercised here.

Off-by-one diagnosis

Diagnosis: (c) rebase/integration drift, not intended admission semantics and not a reconcile counting bug.

The post-rebase integration commit 64ac9773bb accidentally changed test/dashboard-worker.test.ts:3345 from six leased fixture rows to seven. The fixture helper marks every row state: "leased" at test/dashboard-worker.test.ts:28245. Lane stats count dispatchingItems.length + leasedItems.length as active at dashboard/exact-review-queue.ts:12070 and calculate available_slots as capacity - active at dashboard/exact-review-queue.ts:12109. The test config sets the queue cap to 128 at test/dashboard-worker.test.ts:3355, so the accidental fixture produced 128 - 7 = 121.

This is independent of parked recovery: parked rows are collected separately and are not included in active; the operator endpoints are not invoked by this test. The isolated Node 24 run at 64ac9773bb reproduced 121 !== 122. Commit 0f5c8d3b71 restored the mainline fixture to six leased rows, making 128 - 6 = 122; the same isolated test then passed without changing the expectation or runtime admission semantics.

pr-behavior-proof

Claim: after the unchanged three-rung parked recovery ladder genuinely exhausts, the real local Worker and Durable Object expose eligible parked rows through signed operator inventory; reconciliation resolves a terminal ordinary target and re-enqueues an open ordinary target as fresh pending work, while a real command-context target remains flagged and unchanged and both mutation routes refuse it.

Exercised surface: real wrangler dev --local Worker, ExactReviewQueue Durable Object, signed enqueue/operator HTTP routes, persisted 5/10/20-minute recovery alarms with production jitter, built dead-letter operator CLI, Worker restart against the same disposable persistence, and a loopback GitHub behavioral stub.

Scenario and environment: two ordinary issues and one realistic legacy command review enter through the signed Worker route. The command uses the pull-request/legacy-dispatch event shape with a command status marker, status comment id, and additional prompt. The GitHub stub returns the production-classified single-field HTTP 422 rejection until all three rows exhaust. Reconciliation then skips the flagged command row before inspection; direct signed resolve and fresh-recover requests also return one skipped mutation.

Local proof: bash docs/proof/parked-review-reconcile/run-proof.sh on the uncommitted final patch over 0ded7ef34b7a62ee51daf67190ed4e0a68b9163b completed at 2026-08-11T00:00:34.302Z with all assertions true.

PROOF_RC=0

Fresh-PR container proof: pushed head 2f2d4fc8d5ec0b2a628f227c8c6c7bf228d3cf8d, Crabbox --fresh-pr openclaw/clawsweeper#1111, provider=local-container, lease cbx_3d30da7d1f76, image/type node:24-bookworm. Corepack and checksum-verified jq 1.8.1 were installed into $HOME/.local/bin. The proof completed at 2026-08-11T00:46:59.402Z.

PROOF_RC=0

Crabbox reported exitCode=0, runStatus=succeeded, and leaseStopped=true after 44m34.718s of command time (44m45.231s end-to-end).

Observable result: all three rows reached parked_recovery_attempts: 3; inventory flagged the command row with excluded_reason: "command_context"; the operator inspected only the two ordinary targets, resolved one terminal row, recovered one open row to pending, and counted the command row as skipped. Direct resolve and fresh-recover requests both refused the command row, which remained parked and unchanged.

Artifact/trace: each harness run generated the exhaustion inventory, operator inventory, final inventory, command mutation refusal responses, proof summary, Worker/stub logs, and reconciliation transcript under its disposable checkout. The container summary binds the proof to source SHA 2f2d4fc8d5ec0b2a628f227c8c6c7bf228d3cf8d.

Limits: GitHub was a loopback behavioral stub. No production GitHub repository, Worker, secret, comment, workflow, or queue was contacted or mutated. The proof covers the real Worker/DO state machine, signing, alarms, operator process, and persistence boundary, not GitHub's hosted implementation. It covers the initial command-review dispatch-rejection route, not the separate terminal-finalization acknowledgement retry path.

Validation

  • pnpm run build:all — pass
  • pnpm run test:no-build — pass: 3,291 tests; 3,282 passed, 0 failed, 9 skipped
  • pnpm run lint — pass
  • pnpm run format:check — pass
  • pnpm run check:dashboard-queue-boundary — pass
  • pnpm run check:active-surface — pass
  • pnpm run check:limits — pass
  • pnpm run check — pass
  • pre-commit Codex autoreview of the uncommitted patch — clean, no accepted/actionable findings
  • committed Codex autoreview against current origin/main — clean, no accepted/actionable findings

OpenClaw Bay

OpenClaw Bay is unaffected. It remains public and observer-only and gains no recovery, DLQ, queue, workflow, GitHub, deploy, or rollback action.

@steipete
steipete requested a review from a team as a code owner August 10, 2026 19:30
@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P1 Urgent regression or broken agent/channel workflow affecting real users now. 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 Aug 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 10, 2026, 8:52 PM ET / August 11, 2026, 00:52 UTC.

ClawSweeper review

What this changes

This PR adds signed, bounded reconciliation of exhausted parked exact-review records, resolving terminal targets and re-queuing eligible open targets while excluding command-context records.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for normal maintainer review: current main handles terminal parked records but not fresh recovery of exhausted open records, and the PR supplies current-head Worker/DO proof. The exact PR commit could not be hydrated locally because the promisor remote DNS lookup failed, so the no-finding verdict is medium-confidence.

Priority: P1
Reviewed head: 2f2d4fc8d5ec0b2a628f227c8c6c7bf228d3cf8d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong current-head behavioral proof and focused coverage support a useful queue-recovery change, with medium review confidence because the exact-head objects were unavailable locally.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The PR body documents a successful exact-head Crabbox local-container run through the real local Worker and Durable Object, with signed routes, alarms, persistence, and observed command-context refusal.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The PR body documents a successful exact-head Crabbox local-container run through the real local Worker and Durable Object, with signed routes, alarms, persistence, and observed command-context refusal.
Evidence reviewed 5 items Current parked-record boundary: Current main only selects parked terminal checks after three recoveries and excludes command-context records; the PR's fresh recovery is therefore a distinct remaining capability.
Existing automation precedent: Current main's parked terminal cleanup was introduced by the merged parked-reconciliation work, establishing Martin Cleary as a recent owner of this queue boundary.
Operator authentication pattern: The adjacent current-main operator endpoints validate the dedicated operator secret before forwarding a POST to the Durable Object; the supplied PR diff adds its parked routes through that same helper.
Findings None None.
Security None None.

How this fits together

Exact-review jobs are persisted in a Durable Object and dispatched to review workflows. After the existing retry ladder exhausts, this adds an operator-only path that either finalizes obsolete work or returns eligible work to pending review.

flowchart LR
A[Review event] --> B[Durable exact-review queue]
B --> C[Automatic recovery ladder]
C --> D[Exhausted parked record]
D --> E[Signed reconciliation]
E --> F[Resolve terminal target]
E --> G[Fresh pending review]
Loading

Before merge

  • Resolve merge risk (P1) - Merging enables the scheduled operator workflow to re-enqueue up to five exhausted open records per run; monitor post-deploy behavior so permanent GitHub rejections do not become recurring review work.
  • Complete next step (P2) - No concrete repair finding is supported; this PR needs ordinary maintainer review of its queue-automation rollout risk.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Changed surface 12 files, +2,134/-32 lines The change spans queue state, Worker routing, scheduled automation, proof harnesses, and focused tests.
Runtime versus test growth runtime/workflow +713, tests +726, proof/docs +695 The sizeable operational addition is paired with comparable regression coverage and an explicit runtime proof harness.

Merge-risk options

Maintainer options:

  1. Land with recovery monitoring (recommended)
    Accept the bounded recovery behavior after reviewing the current proof, then monitor parked counts and recurring rejection reasons after deployment.

Technical review

Best possible solution:

Retain the bounded, signed post-exhaustion recovery path, preserve command-context exclusion, and monitor recovery volume and repeated rejection reasons after deployment.

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

Not applicable as a standalone issue report: the PR supplies an exact-head Worker/Durable Object runtime scenario for the claimed recovery behavior.

Is this the best way to solve the issue?

Yes: a signed, bounded path after the existing automatic ladder is a narrower solution than changing ordinary retry admission; current main only performs terminal cleanup for exhausted parked records.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body documents a successful exact-head Crabbox local-container run through the real local Worker and Durable Object, with signed routes, alarms, persistence, and observed command-context refusal.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body documents a successful exact-head Crabbox local-container run through the real local Worker and Durable Object, with signed routes, alarms, persistence, and observed command-context refusal.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: This changes recovery behavior for the active exact-review queue and can affect review throughput.
  • merge-risk: 🚨 automation: The PR changes scheduled reconciliation, Durable Object mutations, and signed operator routes.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body documents a successful exact-head Crabbox local-container run through the real local Worker and Durable Object, with signed routes, alarms, persistence, and observed command-context refusal.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body documents a successful exact-head Crabbox local-container run through the real local Worker and Durable Object, with signed routes, alarms, persistence, and observed command-context refusal.

Evidence

What I checked:

  • Current parked-record boundary: Current main only selects parked terminal checks after three recoveries and excludes command-context records; the PR's fresh recovery is therefore a distinct remaining capability. (dashboard/exact-review-queue.ts:11251, 51ac499c741b)
  • Existing automation precedent: Current main's parked terminal cleanup was introduced by the merged parked-reconciliation work, establishing Martin Cleary as a recent owner of this queue boundary. (dashboard/exact-review-queue.ts:3635, 3a38d3622a9b)
  • Operator authentication pattern: The adjacent current-main operator endpoints validate the dedicated operator secret before forwarding a POST to the Durable Object; the supplied PR diff adds its parked routes through that same helper. (dashboard/worker.ts:2227, 51ac499c741b)
  • Current-head runtime proof: The PR body records a successful fresh-PR Crabbox local-container run on 2f2d4fc, exercising the real Worker, Durable Object, signed routes, persisted alarms, restart, and command-context refusal. (2f2d4fc8d5ec)
  • Inspection limitation: The local checkout has the PR commit metadata but not its promised objects; git attempted to fetch 2f2d4fc and failed because github.com DNS was unavailable. Current-main source and hydrated PR context were inspected, but the full exact-head diff was not locally readable. (2f2d4fc8d5ec)

Likely related people:

  • Martin Cleary: Authored merged parked-terminal reconciliation and the subsequent branchless-review durability work on the same queue file. (role: introduced parked reconciliation and recent queue contributor; confidence: high; commits: 3a38d3622a9b, 91272a65e6ff; files: dashboard/exact-review-queue.ts)
  • Peter Steinberger: Authored the nearby merged operational-health change that shares the exact-review workflow surface. (role: adjacent workflow and operational-health contributor; confidence: medium; commits: 35b5f622c968; files: dashboard/exact-review-queue.ts)

Rank-up moves

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

  • Monitor repeated parked recovery and permanent-rejection counts after deployment.

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 (5 earlier review cycles)
  • reviewed 2026-08-10T19:34:32.830Z sha 891b014 :: needs changes before merge. :: [P1] Gate parked mutations on exhausted recovery state | [P2] Bound target checks to the workflow deadline
  • reviewed 2026-08-10T20:13:14.008Z sha 891b014 :: needs changes before merge. :: [P1] Gate parked mutations on exhausted recovery state | [P2] Bound target checks to the workflow deadline
  • reviewed 2026-08-10T20:38:42.888Z sha 0ded7ef :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-10T21:56:50.453Z sha 0ded7ef :: found issues before merge. :: [P1] Exclude command-context records from parked reconciliation
  • reviewed 2026-08-11T00:07:11.212Z sha 2f2d4fc :: needs real behavior proof before merge. :: none

@brokemac79

brokemac79 commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

@steipete maybe your item is different, but i did a PR with similar name earlier. see #1103

@steipete
steipete force-pushed the steipete/parked-review-item-reconcile branch from 891b014 to 0ded7ef Compare August 10, 2026 20:34
@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. proof: sufficient Contributor real behavior proof is sufficient. labels Aug 10, 2026
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 10, 2026
@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: sufficient Contributor real behavior proof is sufficient. 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. proof: sufficient Contributor real behavior proof is sufficient. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 11, 2026
@clawsweeper clawsweeper Bot removed the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Aug 11, 2026
@steipete
steipete merged commit 7656448 into main Aug 11, 2026
26 checks passed
@steipete
steipete deleted the steipete/parked-review-item-reconcile branch August 11, 2026 00:55
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. P1 Urgent regression or broken agent/channel workflow affecting real users now. proof: sufficient Contributor real behavior proof is sufficient. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants