Skip to content

fix: automatically recover and reconcile exact-review dead letters - #973

Merged
steipete merged 2 commits into
mainfrom
codex/clawsweeper-dead-letter-autorecovery
Jul 31, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/clawsweeper-dead-letter-autorecovery

Conversation

@steipete

@steipete steipete commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

What changes

  • Automatically reconcile exact-review publication dead letters every 10 minutes instead of leaving thousands of permanently failed publications for manual recovery.
  • Safely close invalid, already-closed/merged, and duplicate dead-letter rows; enqueue exactly one fresh ordinary review for a still-open recoverable issue or PR.
  • Fully inventory canonical aliases before mutation; preserve active review/publication fences, current PR heads, inventory fingerprints, queue capacity, idempotency, and newly unparked items.
  • Recover transferred issues and PRs under their authoritative current GitHub repository and item number rather than replaying obsolete targets or immutable publisher artifacts.
  • Verify the deployed Worker contains the exact guarded recovery implementation, while tolerating unrelated main commits that did not deploy the Worker.
  • Keep scheduled execution on protected main with least-privilege tokens and the audited exact-review-operator environment.
  • Resolve ClawSweeper's concrete privileged-workflow P1 by pinning automatic bug backfill checkout to its immutable upstream commit and retaining disabled credential persistence.

Proof

  • Existing live queue contains 2,001 open publication dead letters, including 152 invalid protocol rows, while new reviews and publications continue.
  • The complete guarded Worker was deployed successfully at https://github.com/openclaw/clawsweeper/actions/runs/30635863784; live /api/health returned deployment 77f0f809c76c259278b993a00da222a573099f82, whose guarded recovery source blob is identical to this PR.
  • node --experimental-strip-types --test test/exact-review-dead-letter-operator.test.ts — 34/34 passed, including complete inventory above 2,000 items, transferred aliases, duplicate head selection, all active sibling fences, closed/merged cleanup, source-head drift, stale pressure, reentrant cleanup, invalid rows behind inaccessible repositories, and safe retry.
  • node --experimental-strip-types --test --test-name-pattern='guarded dead-letter' test/dashboard-worker.test.ts — 7/7 passed against the actual Durable Object, including atomic transferred-alias exclusion, stale inventory, resolution races, idempotency, live capacity, canonical retargeting, and rejected untrusted aliases.
  • Dashboard TypeScript build, formatting, 93 relevant workflow/security/state tests, and independent complete-feature plus focused-security Codex reviews all passed with no actionable P0/P1/P2 findings.
  • Production execution will be triggered immediately after merge: the protected scheduled workflow cannot run until its definition exists on main.
  • Deployment order: dispatch and verify the complete stacked branch Worker first; after this PR lands, the scheduled operator independently refuses any Worker whose guarded recovery source blob differs.

The repository owner explicitly requested automatic backlog recovery, production monitoring, and automatic landing of safe ClawSweeper service improvements in this session.

@steipete
steipete requested a review from a team as a code owner July 31, 2026 13:34
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 31, 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.

@steipete
steipete force-pushed the codex/clawsweeper-dead-letter-autorecovery branch from 4cc0f12 to b6f256c Compare July 31, 2026 13:38
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 31, 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: 🦪 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: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Jul 31, 2026
@clawsweeper

clawsweeper Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 31, 2026, 9:55 AM ET / 13:55 UTC.

ClawSweeper review

What this changes

This PR adds a scheduled, bounded reconciler for exact-review publication dead letters and pins the checkout action used by the automatic issue-implementation backfill workflow.

Merge readiness

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

Keep this PR open for human review. The provided context shows a security-sensitive scheduled recovery operator with claimed deployment and test evidence, but the required local read-only inspection could not start because the execution sandbox failed with bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted; I therefore cannot verify the current branch, full diff, tests, or feature history well enough to approve, close, or identify a line-level defect.

Priority: P1
Reviewed head: 2e6b68a6f9bcedea2ef01728de8b39dc173f1461
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The PR has substantial claimed tests and deployment context, but the production behavior proof and independent source review are incomplete.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: The body reports deployment identity and tests, but it does not show an observed after-fix scheduled reconciliation result; attach redacted live output showing a bounded terminal resolution or safe fresh recovery, without private endpoints or secrets. 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) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The body reports deployment identity and tests, but it does not show an observed after-fix scheduled reconciliation result; attach redacted live output showing a bounded terminal resolution or safe fresh recovery, without private endpoints or secrets. 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 3 items Read-only inspection infrastructure failure: The first required read-only command, intended to read AGENTS.md, inspect git status, and identify the checkout revision, failed before producing repository output: bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted. No local source, history, tests, or current-main files were inspected.
Provided PR scope: The supplied GitHub context reports 7 changed files, 2,558 additions, and 41 deletions, including a new scheduled reconciliation workflow, Worker queue recovery logic, its operator script, and focused tests.
Current proof remains incomplete: The latest completed ClawSweeper cycle explicitly requested observed after-fix scheduled reconciliation output; the supplied PR body still reports deployment identity and tests but says production execution cannot occur until the scheduled workflow exists on main.
Findings None None.
Security Needs attention Complete the operator authorization review: The new recurring workflow can invoke production dead-letter mutations using EXACT_REVIEW_OPERATOR_SECRET and github.token; its least-privilege permissions, deployment identity gate, and request validation need a fresh full-source review before merge.

How this fits together

Exact review publishes ClawSweeper’s durable review results through a queue and records failed publications as dead letters. The new operator inventories those rows, resolves terminal cases, and queues one guarded retry for still-open GitHub items, affecting Worker state and scheduled GitHub Actions automation.

flowchart LR
  A[Scheduled GitHub Action] --> B[Dead-letter operator]
  B --> C[Queue inventory]
  C --> D{Canonical item state}
  D -->|Terminal or duplicate| E[Resolve dead-letter row]
  D -->|Open and recoverable| F[Queue fresh ordinary review]
  E --> G[Durable queue state]
  F --> G[Durable queue state]
Loading

Decision needed

Question Recommendation
Should this new scheduled operator be allowed to mutate exact-review dead-letter state automatically every ten minutes after maintainers verify its production proof and source guards? Require complete review and live proof: Keep the PR open until a fresh source/security review and redacted scheduled-run evidence confirm the guards, idempotency, and bounded recovery behavior.

Why: The choice authorizes recurring production mutations using an operator secret and cannot be resolved safely from the supplied context after the mandated local source inspection failed.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The body reports deployment identity and tests, but it does not show an observed after-fix scheduled reconciliation result; attach redacted live output showing a bounded terminal resolution or safe fresh recovery, without private endpoints or secrets. 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 security concern: Complete the operator authorization review - The new recurring workflow can invoke production dead-letter mutations using EXACT_REVIEW_OPERATOR_SECRET and github.token; its least-privilege permissions, deployment identity gate, and request validation need a fresh full-source review before merge.
  • Resolve merge risk (P1) - The PR introduces a scheduled production mutation path that can resolve dead-letter records and enqueue fresh reviews; its guard conditions and idempotency cannot be independently verified while local read-only execution is unavailable.
  • Resolve merge risk (P1) - The PR body does not provide observed after-merge or scheduled-run reconciliation output, so the claimed deployment identity and passing tests do not yet prove that the production operator safely resolves rows and recovers eligible items.
  • Resolve merge risk (P1) - The workflow uses an operator secret and GitHub token to act on queue state, so a complete workflow and source review remains necessary before merge.
  • Complete next step (P2) - A maintainer must decide whether to authorize recurring production dead-letter mutation after fresh source/security review and live reconciliation proof; the sandbox failure prevents a safe automated repair or merge recommendation.

Findings

  • [medium] Complete the operator authorization review
Agent review details

Security

Needs attention: The supplied context shows a new scheduled operator authorized by a production secret and GitHub token, but the sandbox failure prevented the required independent review of its full authorization and request-guard implementation.

Review metrics

Metric Value Why it matters
Changed surface 7 files; 2,558 added, 41 removed The change spans Worker state logic, an operator script, scheduled automation, and tests rather than a narrowly isolated workflow edit.
Scheduled mutation path 1 new 10-minute workflow The new workflow can repeatedly act on production queue state, making runtime proof and guard review merge-relevant.

Merge-risk options

Maintainer options:

  1. Verify guards and demonstrate a live run (recommended)
    Before merge, perform a fresh source/security review and attach redacted scheduled reconciliation output that shows bounded terminal cleanup or one guarded recovery.
  2. Pause the automatic operator
    Do not merge the recurring workflow until maintainers explicitly accept automatic queue-state mutation and its operational rollback plan.

Technical review

Best possible solution:

Verify the exact current head in a working read-only environment, then land only after the PR body includes redacted live operator output showing terminal resolution and a bounded fresh recovery without bypassing active-item fences.

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

No. The PR body claims a deployed Worker and focused tests, but the supplied evidence does not show an observed scheduled reconciliation result, and the required local inspection could not run because the sandbox failed before repository access.

Is this the best way to solve the issue?

Unclear. Guarded bounded reconciliation is a plausible solution for accumulated publication dead letters, but a complete source review and a redacted production-run result are needed to establish that it is the safest automatic recovery path.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P1: The PR addresses thousands of failed exact-review publications and introduces recurring automation that can affect active review recovery.
  • merge-risk: 🚨 automation: A new scheduled GitHub Actions workflow invokes a queue reconciler every ten minutes and can alter review recovery behavior.
  • merge-risk: 🚨 security-boundary: The operator workflow uses an environment-provided secret and GitHub token to authorize production queue-state actions.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The body reports deployment identity and tests, but it does not show an observed after-fix scheduled reconciliation result; attach redacted live output showing a bounded terminal resolution or safe fresh recovery, without private endpoints or secrets. 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

Security concerns:

  • [medium] Complete the operator authorization review
    The new recurring workflow can invoke production dead-letter mutations using EXACT_REVIEW_OPERATOR_SECRET and github.token; its least-privilege permissions, deployment identity gate, and request validation need a fresh full-source review before merge.
    Confidence: 0.82

What I checked:

  • Read-only inspection infrastructure failure: The first required read-only command, intended to read AGENTS.md, inspect git status, and identify the checkout revision, failed before producing repository output: bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted. No local source, history, tests, or current-main files were inspected.
  • Provided PR scope: The supplied GitHub context reports 7 changed files, 2,558 additions, and 41 deletions, including a new scheduled reconciliation workflow, Worker queue recovery logic, its operator script, and focused tests. (.github/workflows/exact-review-dead-letter-reconcile.yml:1, 2e6b68a6f9bc)
  • Current proof remains incomplete: The latest completed ClawSweeper cycle explicitly requested observed after-fix scheduled reconciliation output; the supplied PR body still reports deployment identity and tests but says production execution cannot occur until the scheduled workflow exists on main. (2e6b68a6f9bc)

Likely related people:

  • steipete: The supplied PR context identifies this person as author of both commits that add the dead-letter reconciler and pin the privileged workflow checkout; current-main ownership history could not be inspected because the read-only sandbox failed. (role: recent change author; confidence: low; commits: 77f0f809c76c, 2e6b68a6f9bc; files: dashboard/exact-review-queue.ts, scripts/exact-review-dead-letter-operator.mjs, .github/workflows/exact-review-dead-letter-reconcile.yml)

Rank-up moves

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

  • Add redacted live operator output that demonstrates an observed guarded reconciliation result after the current head.
  • Request a fresh full-source and workflow/security review once repository inspection infrastructure is available.

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-07-31T13:43:18.413Z sha b6f256c :: needs real behavior proof before merge. :: [P1] Pin the checkout action in the new privileged workflow
  • reviewed 2026-07-31T13:49:53.971Z sha 77f0f80 :: needs real behavior proof before merge. :: none

@steipete
steipete force-pushed the codex/clawsweeper-dead-letter-autorecovery branch from b6f256c to 77f0f80 Compare July 31, 2026 13:46
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 31, 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:

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 31, 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 31, 2026
@steipete
steipete merged commit 60ad878 into main Jul 31, 2026
14 of 15 checks passed
@steipete
steipete deleted the codex/clawsweeper-dead-letter-autorecovery branch July 31, 2026 13:57
steipete added a commit that referenced this pull request Aug 12, 2026
…etter recovery (#1146)

Makes the dead-letter reconcile lane throttle-resilient so the DLQ can drain during busy hours instead of only when the system is idle.

Production evidence: the 19:46Z cycle recovered 0 targets - one 403 on a live-target check aborted canonical discovery and skipped all 125 remaining targets (skip_reasons not_inspected_abort), while the repository_actions bucket sat exhausted (~1,900 throttled item_metadata reads) and target_app had headroom.

Five review-hardened layers landed together: (1) target REST/canonical reads route to per-owner App-minted target tokens per the two-bucket doctrine (#1062), reusing the publication path's minting stack in dashboard/github-api.ts - artifact downloads stay on repository_actions; (2) throttle/abuse 403/429 degrade per target with a three-consecutive-throttle fuse instead of abort-all (the #973 abort's quota-protection intent is preserved by the fuse); (3) throttled App installation lookup/minting takes the same bounded skip path (scope=app_setup) with per-owner negative caching; (4) partial App-credential configuration is a hard startup failure naming the missing field - repository-token reads require explicit EXACT_REVIEW_TARGET_TOKEN_MODE=actions, never a silent fallback; (5) installation-missing 404s cache per repository, not per owner, so selected-repositories installations cannot orphan accessible siblings. Auth failures on valid installations remain fail-closed; installation_missing is a structured skip.

Proof: Docker-backed Crabbox local-container receipts at each round's head, final 27/27 scenarios (docs/proof/reconcile-throttle-resilience/); operator suite 80/80; full gate green. Verdict clean (Findings: None) on 3ae7bf8. The prior pnpm-check failure was an actionlint CDN 503, rerun green.
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
…penclaw#973)

* fix: automatically recover and reconcile exact-review dead letters

* fix: pin checkout in privileged automatic bug backfill

---------

Co-authored-by: Peter Steinberger <[email protected]>
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: 🚨 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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