Skip to content

fix: hold scanner refusals and simplify sweep execution - #1701

Merged
steipete merged 9 commits into
mainfrom
codex/scanner-refusal-hold
Sep 28, 2026
Merged

steipete merged 9 commits into
mainfrom
codex/scanner-refusal-hold

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Terminal scanner refusals currently delete their queue row, so later events, sweeps, or recovery can review the same item again and repeat notifications. Retain the existing row as a durable scanner_refused hold and make the shared queue the hosted review admission owner.

Fixes #1455. Implements the maintainer's durable-hold decision: #1455 (comment). Thanks @yetval for the report and reproduction.

Behavior and simplification

Automatic source changes, comments, close/reopen, alarms, and closed/source recovery preserve the hold. A fresh verified re-review, a new explicit manual request, or an intentional EXACT_REVIEW_RETRY_POLICY_EPOCH change can release it. Ordinary deploy, model, and prompt changes cannot. Release advances the revision and replaces failed command authority.

Verified command timestamps must be strictly later than both the refusal and any failed command timestamp. GitHub has second precision, so all same-second requests stay held regardless of command ID or refusal origin; a new command or edit in a later second can retry. Failed manual delivery identities remain fenced after receipt expiry for numeric and named/UUID IDs. Old workflow reruns cannot become new retries. Independent retryable and source-incompatible failures retain their behavior.

The maintainer explicitly approved retiring broad manual sweep sizing and immediate-apply controls. Remove batch_size, shard_count, the three apply_after_review* inputs, five unreachable matrix/recovery/publication jobs, and the unused runtime-packaging helper. Broad sweeps offer candidates under shared capacity; the separate apply lane owns closing. Explicit selection, target branch, hot intake, timeout, and additional prompt remain supported, including nested repository-dispatch options and their legacy flat fallbacks. The PR removes 1,258 net lines.

Automatic failed-review retries use repository dispatch, preserving source pins and options. Issue retries reject changed source before model work and retain the post-hydration guard. Retry workflow refs must match the workflow repository default branch; other refs are rejected explicitly. Repair follow-ups surface dispatch failure instead of falling back to a manual workflow that could acquire explicit retry authority. Historical dispatch receipts remain readable.

Existing exact publication hooks and strict-bug backfill remain. The planner offers canonical vision-fit OpenClaw reports under their separate opt-in and viable reports from other eligible repositories through the shared bounded implementation dispatcher. Manual record/comment-only reports remain ineligible for implementation. No new table, scheduler, timer, fingerprint registry, or dependency.

Real behavior proof

Candidate: 7fd5bb4307c7f811566480cec02876c735313a72. Reproducible contract: docs/proof/scanner-refusal-hold/README.md.

Commands: frozen install, pnpm run build:all, node scripts/e2e/scanner-refusal-hold.mjs, node scripts/e2e/exact-review-noop-read-scope.mjs --scenario retry:issue-source-current --scenario retry:issue-source-changed, and node scripts/e2e/implementation-backfill.mjs.

Passed on macOS with Node 24.21.0 and on Linux through Crabbox provider aws, image ami-0461d919be7deb53c, class c7a.8xlarge, lease cbx_5aa883234b54. Final-head AWS run: https://crabbox.openclaw.ai/portal/runs/run_b0d176eaabb3a873045519d4b81d536e. Exit 0; lease confirmed released. The exercised production source hashes match the committed candidate.

The proof uses real workerd/SQLite persistence, signed production Worker HTTP routes, the actual planner Bash, and compiled enqueue/admission/discovery CLIs. Base 420da22ea0f2844e495eed9844c8b283fe63e8b7 permits queued:true after terminal completion. Candidate returns scanner_refused, retains the row through restart and automatic producer/source variants, and makes no review dispatch on the real alarm. Fresh verified/manual requests release once; policy epoch release advances the revision without old authority.

The final authority-chain proof covers automatic-origin and command-origin refusals plus an in-flight successor. In the third case, the verified command is timestamped after lease claim but before refusal: completion returns requeued: false, and the row stays parked. Every path uses the actual refusal time; lease start never backdates the cutoff. Production alarms produce no review dispatch for the held item, and a strictly later command is admitted. These are actual redacted observations from the final-head AWS run (authority_proof in the printed result):

Refusal origin Refusal time Rejected command timestamp Completion / alarm effect Later command timestamp
command 2026-09-27T23:28:48.649Z 2026-09-27T23:28:48.000Z parked; 0 item review dispatches 2026-09-27T23:28:49.000Z: admitted
in-flight successor 2026-09-27T23:28:49.133Z 2026-09-27T23:28:48.035Z Completion did not requeue; parked; 0 item review dispatches 2026-09-27T23:28:50.000Z: admitted
automatic 2026-09-27T23:28:46.260Z 2026-09-27T23:28:46.000Z parked; 0 item review dispatches 2026-09-27T23:28:47.000Z: admitted

Dispatch observations are captured before each later-command positive control and scoped to the held item. Terminal command acknowledgements are separate control work; other deliberately admitted items can progress in the same alarm.

The numeric-ID regression was reproduced before its fix and now rejects the failed request even when its API ID exceeds the worker run ID. A distinct request is admitted. The same-second rule uses one strict chronological threshold, with no comment-ID ordering exception.

Matching issue pins proceed; changed pins stop before model work. Planner capacity/allocation/fallback and preserved options are exercised. The shared implementation dispatcher discovers both retained candidate classes through the compiled production CLI, excludes manual-only reports, and respects the dispatch cap; only GitHub writes are captured locally.

Queue source SHA256: 98187591c7f7467e252342aadfae640a5669fe2425f97cb5624c2149e89b0dcf. Workflow SHA256: b4ce5333db0e5afb01bd9585d8e8a78534bbb1aa2c6058841a019bd9b24cd321. Artifacts: result.json, bounded trace.json, and Worker log under .artifacts/scanner-hold-HaKlX6 on AWS and .artifacts/scanner-hold-9BXN9G on macOS. Fixture keys are never published.

Limits: seeded leases, synthetic loopback GitHub, and already-verified command metadata; no live scanner, complete hosted sweep, contributor mutation, or changed permission-verification boundary. The fixture admission burst is 60 to isolate scenarios from unrelated rate limiting; production limits are unchanged. Optional JSON metadata requires no SQL migration; existing rows lacking the hold field are exercised.

Review disposition and validation

Accepted findings and rank-up work are resolved: the broad-run operator transition is explicitly approved; implementation backfills and nested options are preserved; all ambiguous tied-timestamp commands and pre-refusal in-flight successors are fenced with final-effect proof. The earlier relay finding is fixed with POST-only constant loopback destinations, redirects disabled, and real negative HTTPS requests.

Focused hold, planner, router, admission, and manual-authority checks pass, along with build, static checks, lint, and actionlint. Precommit reviews are clean through P2. The retired-fallback assertion was corrected, and the complete hosted suite passed on the preceding candidate. The focused strict-timestamp tests, dashboard build/lint, and current-head runtime proof also pass. The final committed-branch review is clean through P2. Current-head CI, CodeQL, production automerge testing, and the refreshed ClawSweeper verdict are required before landing.

Bay and rollout

Bay is affected only in projection: held items consume no active review capacity and show no waiting review card; their failed lifecycle remains terminal, and public parked counts include scanner_refused. The runtime proof covers this. Bay remains observer-only with no retry or mutation control.

The normal Worker deployment protects newly observed refusals. Previously deleted rows are not inferred as holds; already-running older direct workflows remain a rollout limit. Verify the deployed Worker SHA after merge. Landing and deployment are authorized in the maintainer conversation; no product decision remains pending.

@steipete
steipete requested a review from a team as a code owner September 27, 2026 10:59
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. 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. 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. labels Sep 27, 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 Sep 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 27, 2026, 7:49 PM ET / 23:49 UTC (Revision 11).

ClawSweeper review

What this changes

The branch retains scanner refusals in the durable review queue, routes broad sweeps and failed-review retries through that queue, and retires per-run shard and immediate-apply controls.

Merge readiness

✅ Ready for maintainer review

Keep open: the linked scanner-refusal loop remains on main. The final-head proof addresses the prior authority concern, and this review found no blocking patch defect.

Priority: P1
Reviewed head: 7fd5bb4307c7f811566480cec02876c735313a72

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Final-head production-boundary proof and focused coverage support a good patch across a broad workflow change.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): At the final head, the production queue and workflow source hashes match the reported macOS and Crabbox AWS workerd/SQLite run. Signed Worker routes and a real alarm left automatic, command, and in-flight stale requests parked with zero item review dispatches, then admitted later commands. Existing serialized rows without the optional hold field were exercised across restart, supporting compatibility without a SQL migration. The run used synthetic GitHub responses and did not execute a live scanner or complete hosted sweep.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): At the final head, the production queue and workflow source hashes match the reported macOS and Crabbox AWS workerd/SQLite run. Signed Worker routes and a real alarm left automatic, command, and in-flight stale requests parked with zero item review dispatches, then admitted later commands. Existing serialized rows without the optional hold field were exercised across restart, supporting compatibility without a SQL migration. The run used synthetic GitHub responses and did not execute a live scanner or complete hosted sweep.
Evidence reviewed 10 items Current main still permits readmission: Main deletes the queue item after a terminal scanner failure, leaving no durable hold for a later producer.
Durable refusal and release rule: The introduced completion path parks scanner refusals; release requires a later verified command, a new explicit manual request, or a changed retry-policy epoch.
Final-effect hold: Enqueue checks the retained hold before creating a pending review and returns scanner_refused for an unauthorized retry.
Findings None None.
Security None None.

How this fits together

ClawSweeper sends item events, sweep candidates, and explicit requests to a shared queue. The queue admits individual review workflows and projects their status to the dashboard.

flowchart LR
  A[Item events] --> D[Review queue]
  B[Sweep candidates] --> D
  C[Explicit requests] --> D
  D --> E{Refusal hold or admission}
  E --> F[Review workflow]
  E --> G[Dashboard status]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch footprint 48 files; +2,034/−3,292 lines, net −1,258 The large workflow removal makes the queue and proof coverage central to review.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #1455
Summary: This PR is the candidate fix for the canonical cross-producer scanner-refusal loop.

Members:

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

Technical review

Best possible solution:

Ship the queue-owned hold and staged Worker rollout, then retain terminal failure status in Bay while allowing only the approved release paths.

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

Yes. Current main deletes the terminal queue row, and the supplied earlier-main workerd run observed same-source readmission; this read-only review did not execute current main.

Is this the best way to solve the issue?

Yes. The queue is the admission owner, and the final-head trace exercises both refusal and authorized release through its production boundary.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. At the final head, the production queue and workflow source hashes match the reported macOS and Crabbox AWS workerd/SQLite run. Signed Worker routes and a real alarm left automatic, command, and in-flight stale requests parked with zero item review dispatches, then admitted later commands. Existing serialized rows without the optional hold field were exercised across restart, supporting compatibility without a SQL migration. The run used synthetic GitHub responses and did not execute a live scanner or complete hosted sweep.
  • 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 (terminal): At the final head, the production queue and workflow source hashes match the reported macOS and Crabbox AWS workerd/SQLite run. Signed Worker routes and a real alarm left automatic, command, and in-flight stale requests parked with zero item review dispatches, then admitted later commands. Existing serialized rows without the optional hold field were exercised across restart, supporting compatibility without a SQL migration. The run used synthetic GitHub responses and did not execute a live scanner or complete hosted sweep.
  • 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: The existing failure repeatedly starts reviews and sends contributor notifications after a terminal refusal.
  • merge-risk: 🚨 automation: The PR moves broad sweep and failed-review retry execution into shared queue admission.
  • merge-risk: 🚨 compatibility: The maintainer-approved removal of manual batch, shard, and immediate-apply inputs changes existing operator calls.
  • merge-risk: 🚨 security-boundary: The new release decision controls whether a verified command can cause a review dispatch; final-effect proof covers stale and allowed commands.
  • 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 (terminal): At the final head, the production queue and workflow source hashes match the reported macOS and Crabbox AWS workerd/SQLite run. Signed Worker routes and a real alarm left automatic, command, and in-flight stale requests parked with zero item review dispatches, then admitted later commands. Existing serialized rows without the optional hold field were exercised across restart, supporting compatibility without a SQL migration. The run used synthetic GitHub responses and did not execute a live scanner or complete hosted sweep.
  • proof: sufficient: Contributor real behavior proof is sufficient. At the final head, the production queue and workflow source hashes match the reported macOS and Crabbox AWS workerd/SQLite run. Signed Worker routes and a real alarm left automatic, command, and in-flight stale requests parked with zero item review dispatches, then admitted later commands. Existing serialized rows without the optional hold field were exercised across restart, supporting compatibility without a SQL migration. The run used synthetic GitHub responses and did not execute a live scanner or complete hosted sweep.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-27T12:46:45.453Z sha bf98874 :: blocked before merge. :: [P1] Preserve immediate apply for broad manual sweeps | [P1] Honor or explicitly retire manual batch and shard limits
  • reviewed 2026-09-27T21:23:26.780Z sha 50512f5 :: blocked before merge. :: [P2] Reject same-second commands older than the refused comment
  • reviewed 2026-09-27T21:34:38.299Z sha f1cbf02 :: needs real behavior proof before merge. :: [P2] Reject older commands in the refusal second
  • reviewed 2026-09-27T21:41:38.055Z sha f1cbf02 :: needs real behavior proof before merge. :: [P2] Fence older verified commands in the refusal second
  • reviewed 2026-09-27T22:21:06.935Z sha 0bf7439 :: needs real behavior proof before merge. :: [P2] Fence same-second commands after automatic refusals
  • reviewed 2026-09-27T22:29:11.773Z sha 0bf7439 :: needs real behavior proof before merge. :: [P2] Fence tied commands after automatic scanner refusals
  • reviewed 2026-09-27T22:53:43.895Z sha 6c75459 :: needs real behavior proof before merge. :: [P2] Fence commands queued before scanner refusal completes
  • reviewed 2026-09-27T23:30:33.992Z sha 7fd5bb4 :: needs real behavior proof before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The proof-relay finding is resolved: only POSTs to two exact fixture routes can be forwarded, both destinations are fixed loopback URLs, and redirects are disabled. The current head and rerun HTTPS/Worker proof, including malformed-target rejection, are in the main PR body. Production queue behavior is unchanged.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. and removed merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels Sep 27, 2026
@steipete
steipete marked this pull request as draft September 27, 2026 12:42
Use the shared exact-review queue and separate apply lane. Preserve bounded implementation intake and opaque manual request identities while preventing automatic retries from acquiring explicit release authority.
@steipete steipete changed the title fix: hold scanner refusals until explicit retry fix: hold scanner refusals and simplify sweep execution Sep 27, 2026
@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 Sep 27, 2026
@steipete
steipete marked this pull request as ready for review September 27, 2026 21:35
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The PR body now contains the maintainer-approved control retirement, current-head AWS/macOS behavior proof, and disposition of all accepted findings. Please review f1cbf027de8ce7a8d676f0bc40cf04d8820ffd4a and the current body.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. label Sep 27, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The current PR body includes final-head AWS/macOS proof for the accepted command-order finding and rank-up: delayed lower-ID and unordered same-comment versions stay held through the real alarm with no new dispatch, while a newer command releases. Failed numeric and opaque manual request identities are fenced as well. All accepted findings are addressed, and the full committed-branch review is clean through P2.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The current body contains the final-head AWS trace for automatic-origin, command-origin, and in-flight successor cases. All re-review timestamps must be strictly later than the actual refusal and failed command timestamp; there is no ID tie exception or lease-start backdating. Each forbidden case remains parked through the real alarm with zero review dispatches for that item, and a later command is admitted. All accepted findings and rank-up proof requests are addressed; the full committed-branch review is clean through P2.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added 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: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 27, 2026
@steipete
steipete merged commit 8d659e7 into main Sep 28, 2026
29 checks passed
@steipete
steipete deleted the codex/scanner-refusal-hold branch September 28, 2026 00:07
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: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. 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. 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.

Terminal scanner refusal is re-leased by shard, recovery, and backfill lanes; each attempt posts and deletes a placeholder comment

2 participants