Skip to content

feat(review): make re-review command intake durable - #1143

Merged
steipete merged 8 commits into
mainfrom
steipete/durable-command-intake
Aug 12, 2026
Merged

steipete merged 8 commits into
mainfrom
steipete/durable-command-intake

Conversation

@steipete

@steipete steipete commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

What this fixes

An eligible @clawsweeper re-review command currently becomes durable only after a GitHub Actions comment-router run claims it. The hosted webhook first creates an optimistic acknowledgement and then dispatches that run. When the target GitHub App bucket is throttled, both the exact router run and its five-minute fallback can fail before the action ledger owns the command.

That happened in production on August 12: openclaw/openclaw#116562's command received only “Command router queued”; the exact router run and the scheduled fallback both failed on installation rate limiting, and no sweep run for that item existed at investigation time.

This PR moves only re-review command intake ahead of acknowledgement and Actions dispatch. The Worker records an immutable comment-version identity in the ExactReviewQueue Durable Object, verifies the live source comment and PR head, enqueues once, and then converges the acknowledgement and reaction. The scheduled comment router remains a recovery producer, but it posts into the same receipt instead of creating a second dispatch path.

Snapshot and supersession analysis

The source was abandoned WIP snapshot 4cad8dea21 (codex/fix-command-review-publication), based 58 commits behind main with 59 changed files. It was treated as design evidence, not applied as a patch.

Kept and rewritten:

  • the four command/version tables, idempotent schema creation, 16-item intake bound, 15-second-to-15-minute retry ladder, and 30-day terminal-receipt horizon;
  • exact comment-version identity, live source verification, PR-head authority, monotonic command revisions, and acknowledgement/reaction convergence;
  • hosted-webhook fast intake plus comment-router recovery intake.

Dropped as already landed or structurally superseded:

The old 1,400-line dashboard/exact-review-queue.ts splice was not ported. The command tables and state transitions live in a new strict module, with narrow hooks into the current decision, lifecycle, Worker, and queue owners.

Migration and behavior

The new SQLite tables are created idempotently during ExactReviewQueue initialization. No backfill is required: existing GitHub comments remain discoverable through the scheduled router, and new exact versions receive durable receipts on first observation. Detailed terminal receipts expire with resolved dead letters; per-comment watermarks remain to prevent an old version from restarting after compaction.

The processing fence is deliberately three-stage: verify, enqueue, effects. A crash after enqueue reuses the delivery receipt without rebinding authority; a crash during acknowledgement/reaction retries only idempotent effects.

OpenClaw Bay is unaffected. This changes no Bay field, data contract, control, or action surface; Bay remains observer-only.

Review finding disposition

The first ClawSweeper review identified three actionable findings; all are resolved on the current head:

  • P1 signing contract: the scheduled router and local receiver now sign only with CLAWSWEEPER_WEBHOOK_SECRET, exactly matching the Worker endpoint. The unsupported distinct-secret preference was removed from code and workflow environments.
  • P1 acknowledgement trust: acknowledgement candidates are now restricted to the configured trusted ClawSweeper bot logins before any PATCH, retention, or duplicate cleanup decision.
  • P2 complete lookup: the queue performs a bounded five-page marker search and independently fetches/verifies the persisted status-comment ID, including author, marker, and target-item ownership.

Focused regressions cover the signing source, a contributor-forged exact marker, and a trusted exact receipt on page two. The forged human comment remains untouched.

The second and final allowed ClawSweeper review identified one late P1 finding: same-timestamp edited comment bodies could both pass a timestamp-only currentness check. The final correction lets same-timestamp contenders reach live verification, atomically promotes only the full version identity whose digest matches GitHub, supersedes sibling intakes, and rechecks that identity before enqueue and acknowledgement effects. Its regression advances the older receipt beyond verification before the edited version wins.

Proof

Claim: throttling before Actions dispatch can no longer lose or duplicate an eligible re-review command.

Exercised surface: real wrangler dev --local Worker boots, signed webhook HTTP, loopback GITHUB_API_URL, ExactReviewQueue DO SQLite, alarm retry, and full Wrangler process-tree shutdown.

Scenario: the pinned-main Worker and candidate received the same signed PR command. The loopback GitHub API accepted acknowledgement writes but throttled baseline repository dispatch and candidate source verification.

Observed result:

  • baseline returned HTTP 500 after one optimistic acknowledgement/reaction and one throttled dispatch; no command schema or intake existed;
  • candidate returned HTTP 202 before acknowledgement, attempted one deferred source read, and retained one pending intake/receipt across shutdown;
  • all four command tables were present, proving DO instantiation;
  • both Wrangler process groups confirmed SIGTERM completion between boots.

Crabbox proof was renewed after every code head. The committed receipt records final code head ee949363f5c4cf755a431020b738f1bf06ae49b5 on AWS lease cbx_6b30d164d7dc, run run_7cfa46ca99f9. A second successful comparison exercised the exact final receipt head 9eb957ea6ae034d8aba003c47664b6bac2864e6e: provider=aws, lease cbx_72a05adbf287, run run_d2eb04c505d7, comparison_pass=true, exit 0, leaseStopped=true. Receipt: docs/proof/durable-command-intake/receipt.md.

Provider note: crabbox config show resolves provider=aws for this repository and host. The applicable Crabbox workflow forbids silently overriding that resolved backend when the user did not request one. This host is macOS; the repository's local-container-only sentence is explicitly scoped to a Windows host. The proof therefore preserves the resolved AWS backend while running real wrangler dev --local Workers with isolated persistence.

Limits: the GitHub API was synthetic loopback; no live credentials or production mutations were used. Executor completion and final public review publication were not exercised by this proof.

Validation

  • pnpm run check: 7,056 passed, 13 skipped; coverage 81.34% lines, 73.93% branches, 87.25% functions
  • pnpm run check:dashboard-strict
  • focused queue/runtime/publication suite: 259 passed
  • loopback command regression: red main-equivalent old path, green durable path
  • pre-commit and committed-branch Codex reviews: clean
  • source-blind behavior contract: 6 passed, 0 failed/blocked

@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 12, 2026 17:11
@steipete
steipete requested a review from a team as a code owner August 12, 2026 17:11
@clawsweeper clawsweeper Bot added 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. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. 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. labels Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 2:08 PM ET / 18:08 UTC.

ClawSweeper review

What this changes

This PR stores each eligible re-review comment version in the Durable Object queue before acknowledgement or Actions dispatch, then verifies and processes it idempotently.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open: current main still has the pre-durable re-review intake path, while this PR adds receipt-first intake and resolves the prior same-timestamp edit race. Likely related people: Peter Steinberger (high confidence) and Martin Cleary (medium confidence).

Priority: P1
Reviewed head: 9eb957ea6ae034d8aba003c47664b6bac2864e6e

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) The patch has focused race coverage and strong real Worker/DO proof, with only coordinated deployment observation remaining.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The PR body and committed receipt show an after-fix real Wrangler Worker and Durable Object comparison with durable throttled recovery, while clearly limiting GitHub to a loopback API.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR body and committed receipt show an after-fix real Wrangler Worker and Durable Object comparison with durable throttled recovery, while clearly limiting GitHub to a loopback API.
Evidence reviewed 5 items Current-main gap: The current-main paths used by the supplied failing baseline have not changed since baseline bd86954, so the dispatch-before-durability failure remains relevant on main.
Durable intake implementation: The new command store persists versioned receipts, watermarks, pending intake records, and per-item revisions before processing can acknowledge or enqueue work.
Prior race regression covered: The focused regression advances an older same-timestamp receipt beyond verification, admits the edited version, and confirms the older receipt is superseded before enqueue effects.
Findings None None.
Security None None.

How this fits together

GitHub comment webhooks and scheduled router scans feed ClawSweeper’s exact-review queue. The queue verifies the live comment and PR head, then launches review work and converges the visible acknowledgement.

flowchart LR
A[GitHub re-review comment] --> B[Webhook or router intake]
B --> C[Durable command receipt]
C --> D[Live comment and PR-head verification]
D --> E[Exact review queue]
E --> F[Acknowledgement and reaction]
E --> G[Review automation]
Loading

Before merge

  • Resolve merge risk (P1) - The Worker route, Durable Object schema, and router caller deploy across a service boundary; first production receipts should be observed because the supplied proof uses a loopback GitHub API.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch footprint 27 files, +3,110/-136 The change spans the Worker endpoint, Durable Object queue, recovery workflow, focused tests, and runtime proof.

Merge-risk options

Maintainer options:

  1. Verify coordinated rollout (recommended)
    Confirm the deployed Worker accepts durable command intake before relying on router callers, then observe the first production receipt.

Technical review

Best possible solution:

Deploy the Worker and router change together, then confirm the first production re-review creates one durable receipt and retains scheduled routing as recovery.

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

Yes. The supplied real Worker/DO comparison reproduces the throttled baseline failure, and the relevant current-main paths are unchanged from that baseline.

Is this the best way to solve the issue?

Yes. Recording an immutable command version before any acknowledgement removes the dispatch-rate-limit loss window while preserving the router as a recovery producer.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 04cd80977237.

Labels

Label justifications:

  • P1: A throttled re-review command can currently be acknowledged yet never reach review automation.
  • merge-risk: 🚨 automation: The patch changes webhook intake, the scheduled comment router, queue dispatch, and acknowledgement convergence.
  • merge-risk: 🚨 availability: The new receipt and retry state determine whether re-review commands survive GitHub throttling.
  • 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 PR body and committed receipt show an after-fix real Wrangler Worker and Durable Object comparison with durable throttled recovery, while clearly limiting GitHub to a loopback API.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body and committed receipt show an after-fix real Wrangler Worker and Durable Object comparison with durable throttled recovery, while clearly limiting GitHub to a loopback API.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Recent current-main work extracted exact-review policy, established the app-auth stack, and typed webhook ingress; the submitted branch extends those same ownership seams. (role: recent queue and webhook contributor; confidence: high; commits: d8471a64e56b, a1795973a9e6, 5a964dadc813; files: dashboard/exact-review-queue.ts, dashboard/worker.ts, dashboard/exact-review-decision.ts)
  • Martin Cleary: Recent main history includes queue durability and GitHub-egress work adjacent to the intake and throttling behavior. (role: recent adjacent queue contributor; confidence: medium; commits: 91272a65e6ff, ac340908bf69; files: dashboard/exact-review-queue.ts, dashboard/worker.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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-12T17:16:37.919Z sha 6851466 :: needs real behavior proof before merge. :: [P1] Sign recovery intake with the secret the Worker verifies | [P1] Restrict acknowledgement convergence to trusted bot comments | [P2] Find the existing acknowledgement beyond page one
  • reviewed 2026-08-12T17:46:29.197Z sha 6c1c97e :: needs changes before merge. :: [P1] Fence equal-timestamp command edits by full version identity

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

All three actionable findings from the first review are resolved on the current head. The PR body now contains the finding disposition, refreshed full-gate results, and successful exact-current-head real Worker/DO proof.

@clawsweeper

clawsweeper Bot commented Aug 12, 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 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. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 12, 2026
@clawsweeper clawsweeper Bot added 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. 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. labels Aug 12, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 12, 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 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: feat(review): make re-review command intake durable This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete merged commit e0dc544 into main Aug 12, 2026
19 checks passed
@steipete
steipete deleted the steipete/durable-command-intake branch August 12, 2026 18:14
steipete added a commit that referenced this pull request Aug 13, 2026
…sede proven-stale tuple rows (#1152)

Root-causes and fixes the tuple_protocol_invalid dead-letter class (30 rows), closing the DLQ's last unexplained residue.

Fingerprint archaeology: the dominant 21-row class hashed to a generic invalid_direct_publication_plan opacity bucket - 19 rows are debris of the mixed-case slug bug already fixed in #1100 (steipete/CodexBar targets), two lost their pre-#1091 detail and stay honestly unclassified. The live 4-row class is "conflicting direct publication retry": guarded apply refreshes current_item_*/apply_checked_at after canonical acceptance, so publication retries see byte-conflicts against their own accepted plan (hit both pre- and post-#1143 items, including re_review command results - NOT a protocol-v2 command bug).

Live fix: an actively owned batch resumes from its terminal canonical receipt instead of conflicting with itself; strict direct-publication conflict and fence checks preserved. Stale tuple rows now pass through the #1148 six-way evidence-gated supersede (newer-head completed record required); current-head rows stay recoverable so they republish after this fix; workflow_cancelled remains excluded.

Proof: red reproduced the HTTP 400 conflict and the supersede exclusion; green 176/176 focused scenarios; full gate 3396/0; Crabbox local-container receipt at this head (docs/proof/tuple-protocol-rootcause/). Verdict clean (Findings: None, Security: None) on 5b67ae2.
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. 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