Skip to content

fix(recovery): rotate placeholder discovery cursors - #1077

Merged
steipete merged 1 commit into
mainfrom
steipete/adopt-1063-cursor-rotation
Aug 9, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/adopt-1063-cursor-rotation

Conversation

@steipete

@steipete steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Supersedes #1063 (adopted after the authoring session went quiet; original diagnosis and design preserved). Placeholder recovery restarted at GitHub Search page 1 every bounded live-validation window, so with a large match set (a run reported checked=120 cleaned=0 matched=718) the later pages were never examined — stale placeholders beyond the first pages could persist indefinitely.

The Fix

Persist independent open/closed placeholder-recovery offsets in the revision-CAS ExactReviewQueue cursor store and rotate across search pages after each bounded window, wrapping back to page 1 after a full rotation. The signed cursor client is extracted and shared between fanout and placeholder recovery. The two-hour activity guard and all destructive closed-comment rereads are preserved; cursor CAS conflicts repeat work safely instead of skipping.

Proof

  • Proof harness (docs/proof/review-placeholder-cursor-rotation) against a real local Wrangler Worker with HMAC-authenticated routing and persisted Durable Object storage (synthetic GitHub only): rotation windows advance 1001..1060 → 1061..1120 → 1121..1180 → wrap; cursor offsets 60 → 120 → 0 → 60; closed cleanup reaches rank 144; age guard holds until wrap; CAS 409 repeats the window safely. RESULT: PASS.
  • Cursor round-trip survives queue reconstruction (new test).
  • Dashboard worker 323/323; full pnpm test:unit 1,968 pass / 0 fail; pnpm run check green; coordinator autoreview clean (0.97).
  • Also stabilizes two retry-eligibility test fixtures (wall-clock race → deterministic timestamps), no runtime change.

Rebased over the retry-jitter merge (81c23be) with jitter semantics untouched.

@steipete
steipete requested a review from a team as a code owner August 9, 2026 03:09
@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. 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 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, 11:14 PM ET / August 9, 2026, 03:14 UTC.

ClawSweeper review

What this changes

This PR persists separate authenticated cursors for open and closed placeholder recovery so successive bounded scans reach later GitHub Search candidates.

Merge readiness

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

Keep open: current main still restarts bounded placeholder discovery from the first search pages. The cursor design appears correct, but merge needs inspectable, current-head Crabbox runtime proof.

Priority: P2
Reviewed head: c43ca6f7bae7f83c0451bc745b104b753d52552a

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The source patch is focused and well-covered, but current-head real-behavior proof remains a merge gate.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: The branch contains a credible local Worker/Durable Object harness, but the PR lacks inspectable current-head Crabbox output or an artifact showing the after-fix run. 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 branch contains a credible local Worker/Durable Object harness, but the PR lacks inspectable current-head Crabbox output or an artifact showing the after-fix run. 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 Current main still has the starvation path: Current recovery collects candidates from pages 1–2 on every run and has no persisted offset, so later search results are not selected when earlier candidates fill the budget.
Exact-head implementation: The PR head loads independent per-state cursors, advances them through examined slots, and retains the old cursor after a failed CAS write.
Cursor endpoint remains constrained and authenticated: The new Worker route accepts only existing fanout modes or hashed placeholder modes, then verifies the existing HMAC signature before forwarding to the queue.
Findings None None.
Security None None.

How this fits together

Scheduled placeholder recovery searches for stale review-start comments, validates them against GitHub, then queues recovery or removes stale closed-item comments. Durable cursor state selects the next bounded candidate window while the ExactReviewQueue Worker stores it with revision checks.

flowchart LR
  A[Scheduled recovery] --> B[Read durable cursor]
  B --> C[Search open and closed candidates]
  C --> D[Validate live comment and age]
  D --> E[Queue recovery or clean comment]
  E --> F[CAS update cursor]
  F --> G[Next recovery window]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The branch contains a credible local Worker/Durable Object harness, but the PR lacks inspectable current-head Crabbox output or an artifact showing the after-fix run. 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.
  • Resolve merge risk (P1) - This changes scheduled recovery and durable queue state; the reported local PASS is not accompanied by inspectable current-head Docker-backed Crabbox evidence required before merge.
  • Complete next step (P2) - This implementation PR needs contributor-owned current-head runtime proof, not a separate ClawSweeper repair dispatch.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Changed surface 14 files; +1,200 / -172 lines The patch spans recovery behavior, authenticated Worker routing, workflow wiring, tests, and a runnable proof harness.
Runtime and test delta runtime/workflow +345 / -159; tests +340 / -3 The durable-cursor implementation is accompanied by near-parity focused regression coverage.

Root-cause cluster

Relationship: canonical
Canonical: #1077
Summary: This PR explicitly adopts the same cursor-rotation work from the older open proposal and is the current candidate landing path.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Attach exact-head recovery proof (recommended)
    Run the committed proof through the required Docker-backed Crabbox local container on the current head and attach redacted runtime output before merge.

Technical review

Best possible solution:

Run the committed Worker-boundary harness on the current head in Docker-backed Crabbox and attach a redacted transcript/artifact identifying the head, provider, image, lease, observed cursor transitions, and limits.

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

Yes, from source: current main repeatedly begins its bounded search at page 1, while the reported large result set can leave later candidates unexamined. The committed regression scenario models that path, although it was not executed in this read-only review.

Is this the best way to solve the issue?

Yes. Per-state authenticated revision-CAS cursors reuse the existing fanout storage contract, retain the prior key prefix, and directly remove the repeated-first-window failure mode.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 81c23bede7a8.

Labels

Label changes:

  • add P2: The fix addresses bounded recovery fairness and stale review-comment cleanup without evidence of an immediate outage or data-loss event.
  • add merge-risk: 🚨 automation: The patch changes scheduled recovery, authenticated Worker routing, and durable cursor state used by ClawSweeper automation.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The branch contains a credible local Worker/Durable Object harness, but the PR lacks inspectable current-head Crabbox output or an artifact showing the after-fix run. 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:

  • P2: The fix addresses bounded recovery fairness and stale review-comment cleanup without evidence of an immediate outage or data-loss event.
  • merge-risk: 🚨 automation: The patch changes scheduled recovery, authenticated Worker routing, and durable cursor state used by ClawSweeper automation.
  • 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 branch contains a credible local Worker/Durable Object harness, but the PR lacks inspectable current-head Crabbox output or an artifact showing the after-fix run. 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 main still has the starvation path: Current recovery collects candidates from pages 1–2 on every run and has no persisted offset, so later search results are not selected when earlier candidates fill the budget. (src/review-placeholder-recovery.ts:408, 81c23bede7a8)
  • Exact-head implementation: The PR head loads independent per-state cursors, advances them through examined slots, and retains the old cursor after a failed CAS write. (src/review-placeholder-recovery.ts:445, c43ca6f7bae7)
  • Cursor endpoint remains constrained and authenticated: The new Worker route accepts only existing fanout modes or hashed placeholder modes, then verifies the existing HMAC signature before forwarding to the queue. (dashboard/worker.ts:554, c43ca6f7bae7)
  • Proof contract exists, but no current-head result is attached: The committed contract defines a local Worker/Durable Object run and expected artifacts, while the PR body provides only a summarized PASS claim without a linked current-head Crabbox transcript or artifact. (docs/proof/review-placeholder-cursor-rotation/README.md:49, c43ca6f7bae7)
  • Area history: Peter Steinberger introduced the current recovery surface in the recent main-branch recovery refactor; Vincent Koc also has recent queue and reconciliation history. (src/review-placeholder-recovery.ts:1, 4dc8d1d8c533)

Likely related people:

  • steipete: Introduced the current recovery implementation on main and authored the proposed cursor repair. (role: feature owner; confidence: high; commits: 4dc8d1d8c533; files: src/review-placeholder-recovery.ts, dashboard/exact-review-queue.ts)
  • Vincent Koc: Recent main history covers review reconciliation and ExactReviewQueue behavior adjacent to this durable cursor boundary. (role: recent area contributor; confidence: medium; commits: 6976512bc0fe, 2a61adcc1f06; files: src/review-placeholder-recovery.ts, dashboard/exact-review-queue.ts)

Rank-up moves

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

  • Attach a redacted Docker-backed Crabbox run for head c43ca6f, including provider, image, lease, transcript, and artifact.
  • Show the observed open/closed cursor rotation, rank-144 cleanup, age guard, and CAS-conflict retry in that run.

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 095f5c5 into main Aug 9, 2026
18 checks passed
@steipete
steipete deleted the steipete/adopt-1063-cursor-rotation branch August 9, 2026 03:18
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. 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