Observational note: single state-publish lease is stalling review completion; consider per-item shard of the lease and state layout
Note up front: this is an outside observational warning based on what I am seeing from the public Actions logs and the openclaw/openclaw item history, not an incident report from inside the project and not a request for anyone to act on a schedule. It is a detailed note. Please feel free to keep it open purely as a reference for what appears to be happening while the current fixes settle. If it is already understood or covered by work in flight, close it.
Update 2026-07-22 (current picture)
The situation has changed shape since the original 07-20 note (kept below for baseline), and by the public signals it looks worse, not better. Sharing an updated read in case it is useful. Still an outside observation from public logs; happy to be corrected where the internal picture differs.
Severity now
- Of the most recent
clawsweeper[bot]issue comments on openclaw/openclaw, roughly 90 percent are still stuck at the "review started" placeholder (411 of 458 over a ~9.6h window, and 60 of 67 in a smaller live sample). On 07-20 this was about 59 percent (224 of 380), so the completion path has degraded by roughly 30 points. - The newest item with a completed review trails the newest item overall by about 131 numbers, and completion is out of order (newer items complete while older placeholders from the same morning stay stuck).
- About 86 percent of new issues above #112400 have zero labels (labels are applied on review completion, so this tracks the same stall).
The failure has moved and gone quiet
The per-item "Review event item ..." runs now report success (green) while the placeholder is never edited. Comment delivery was moved out of the review run into a downstream serialized batch/materializer lane, so a green run no longer means the review landed. The synchronous StatePublishContentionError from 07-20 (could not acquire the single lease within 180000ms) has been replaced by size-driven failures further down the pipe:
- Materializer lease-renewal expiry mid-push. Run 29917944092 (Materialize queued state, 12:01Z, failure) drains its full row cap, spends about 162s pushing, the lease renewal expires before the branch publication completes, and the cycle ends
committed=0 acked=0. The drained rows are released and re-drained on the next cycle. Only a small fraction of materializer cycles succeed. - Server-side commit_refs push failures. Run 29922440569 (Publish exact review batch, 13:06Z, failure) acquired the publish lease on the first attempt (no contention) then died with
remote: fatal error in commit_refspushing to clawsweeper-state. This is GitHub's git backend rejecting the ref transaction on a very large repo, and it is orthogonal to the lease. PR #795 ("recover state publication after commit_refs failures") addresses this failure directly. - Runner disk exhaustion. Run 29925344094 (Publish exact review batch, 13:45Z, failure) hits
No space left on devicewhile staging the large state tree plus batch artifacts on the runner. - Poison records aborting whole batches. The same batch log shows
ENOENT ... records/openclaw-openclaw/items/110739.mdduring apply-decisions. A single missing record file throws and takes the entire batch job to exit 1, so the healthy items batched alongside it never publish either. Because the poison item is never acked, it recurs batch to batch (the same item numbers reappear across the 13:06 and 13:32 manifests), consuming capacity.
Why knob-tuning is not converging
Comment-delivery throughput is now equal to the throughput of one serialized batch publisher. A clean size-8 batch takes on the order of 13 minutes, so the drain ceiling is roughly 27 items per hour, against an inflow of roughly 96 to 135 items per hour. That is a net negative of roughly 70 to 108 items per hour, and the pending backlog is rising monotonically (observed pending count climbing into the 2800s, oldest pending item around 30 hours old). With delivery pinned to a single serial drain, batch-size and lease-duration tuning each buy only a bounded multiple against a load that scales with the producer fleet. This shows up in the PR history as oscillation: batch grant flipped between 4, 8, and 32 within one day, and the drain lease was raised 8m to 30m to 60m to 90m over the same window.
Refined root cause
The single-lease framing in the original note was the symptom of the 07-20 architecture. The batching rework (roughly #722 through #795) mostly retired multi-writer lease contention, but by serializing all writes onto the same shared state branch rather than by sharding it. The binding constraint underneath is unchanged: durable state lives as files on one git branch in clawsweeper-state, and that tree has grown to about 434,644 flat, never-pruned files (records/<repo>/{items,closed,plans,decision-packets}/<number>, where closed/ only ever grows; the openclaw-openclaw closed/ directory alone holds around 21k entries, large enough that GitHub's tree API returns 502 on it). Every publish pays a cost that scales with that tree, now surfacing as commit_refs rejections, runner ENOSPC, and materializer holds that outlive their lease. This is a git-as-database scale limit, and no lease or batch parameter changes the per-write cost curve.
Suggested direction (refined)
In rough order of leverage:
- Decouple comment delivery from state persistence. Edit the placeholder in the review run itself (or a dedicated per-item delivery lane), so a state-publish backlog can never strand a review comment. This is the cheapest change and directly removes the "run succeeded, comment never edited" signature.
- Isolate poison items so a single missing or unreadable record cannot fail an entire batch. Skip and quarantine the bad item, publish the healthy remainder, ack independently.
- Shard the state layout, not just the lease. Split the flat category directories (per-shard subtrees or per-item refs) so a publish rewrites a small slice, each shard has its own lease and materializer, and the materializer and compaction stop holding a global lease over a 434k-file tree. This is the "increasing effort" option from the original note, and on the current evidence it is the primary lever rather than a secondary one.
- Match admission to drain capacity. Cap review-producer admission to what a single serialized drain can absorb, or add drain capacity, so the queue cannot grow past what the writers can clear.
- Longer term, take live review, comment, and label state off git onto an actual datastore, and keep git only as the immutable audit ledger.
Evidence pointers (07-22)
- Materializer lease-renewal expiry: run 29917944092 (
committed=0 acked=0). - commit_refs push failure with the lease held on attempt 1: run 29922440569; see also PR #795.
- Runner ENOSPC: run 29925344094.
- Poison-record ENOENT aborting a batch: run 29922440569 (
records/openclaw-openclaw/items/110739.md). - Flat state layout and growth:
records/<repo>/{items,closed,plans,decision-packets}/<number>(closed/monotonically growing; openclaw-openclawclosed/around 21k entries).
Original note (2026-07-20), kept for baseline
What I am observing
ClawSweeper is not down. It is reviewing constantly, but the final delivery step (editing the placeholder into the real review, applying labels and rating, and closing) is not landing for a large fraction of items.
The visible signature is on the target repo. Each new issue gets an immediate placeholder comment ("ClawSweeper status: review started ... I will edit this same comment with the actual review when the claws are done clicking.") and then the placeholder is never edited.
Snapshot from openclaw/openclaw earlier today (2026-07-20):
- Of the ~380 most recent
clawsweeper[bot]issue comments, roughly 224 are still stuck at the "review started" placeholder and only about 156 are completed reviews. - 67 placeholders have been stuck for more than 2 hours (a normal completion is seconds to minutes).
- Every issue newer than about #111900 (for example #111944, #111948, #111959) has exactly one bot comment (the placeholder) and zero labels.
- Issue closures per day have bent down from roughly 170 to 250 per day in early July to 97, then 74, then 68 over 07-18 to 07-20, and went acute today.
Mechanism
Review runs are dying at the publish step, after the review is computed but before the label, comment edit, and close are written. The error, taken directly from failing run 29781081610 (step "Publish event result and apply safe close"):
State publish lease busy owner=104017a7-e3f7-42a0-befe-b7b2fd9594af attempt=14 remaining_ms=36024
StatePublishContentionError: Failed to acquire the state state publish lease within 180000ms
at acquireStatePublishLease (.../dist/repair/git-publish.js:1209:11)
at withStatePublishLease (.../dist/repair/git-publish.js:1149:19)
Across the recent window, roughly 54 percent of "ClawSweeper" review runs are failing this way. The owners in the log (owner=104017a7..., owner=80000b97...) are other in-flight ClawSweeper runs, so the system is contending against itself.
Root cause as I understand it
All durable state (review records, labels, close decisions, the immutable apply-proof ledger) is published to a single shared branch (state) in the clawsweeper-state repo, and every reviewed item publishes by committing and pushing that one ref. The sweep pipeline admits on the order of 32 to 40 concurrent publishers, and the state worktree is very large (PR #723 measured 434,644 files, checked out shallow).
That is a compare-and-swap against one ref by tens of concurrent writers. Only one push per round can fast forward. The rest are rejected, then have to fetch the new head and rebuild against a 434k-file shallow tree, which is slow enough that a losing writer can hold and then lose its lease mid-recovery. At roughly 37 runs per minute the writers queue behind one holder, retry about 14 times, and blow the 180000 ms acquisition budget. A scheduled failed-review-retry lane then re-runs the timed-out reviews back into the same contended lease, and the repair-* / self-heal / reconcile workflows exist largely to reconcile the half-written state this produces.
This is not a GitHub API or rate-limit issue. Core quota was healthy (4986/5000) during the failures. The bottleneck is the single-lease serialization on one shared branch.
Relationship to the current fixes
Today's series #711 through #724 is one continuous firefight on this subsystem. #711 to #721 move the failure around (retry pushes, recover missing objects, mktree --missing, rebuild on remote head, larger fetch budget). #722, #723, and #724 change direction and retrofit an actual mutex (a --force-with-lease ref lock), ending at #724 coordinating every state-branch writer. That is the first structurally correct step and it should stop losing reviews.
The concern is that a single global lease trades a race for a throughput ceiling: the 32 to 40 "concurrent" publishers now execute one at a time, each doing seconds of tree work under the lock on a 434k-file worktree. It drains the backlog but caps sustained rate, so a busy period can still fall behind.
Suggested direction: shard the publish lease and the state layout per item
Instead of one lock over one shared branch, remove the contention so publishers rarely touch the same ref at all.
- Shard the lease key by item. Derive the lock from the item identity (for example
target_repoplusitem_number, hashed into N buckets), sorefs/heads/clawsweeper-publish-lease/state/<shard>rather than one.../state. Two publishers only serialize if they hash to the same shard, which turns a fleet-wide bottleneck into rare same-item contention. - Shard the state layout to match, so writers do not rebuild each other's trees. Options, roughly in increasing effort:
- Per-shard branches (
state-00..state-NN) or per-shard subtrees under one branch, with a small periodic reducer that folds shards into a read view for anything that needs the global picture. Each publisher only fetches and rewrites its own shard, so the worktree work per push drops from 434k files to a shard slice. - Longer term, treat one item as one object keyed by item id (per-item ref or per-item file path) so a publish is a bounded write that almost never collides, and the "immutable ledger" appends per shard.
- Per-shard branches (
- Stop the failed-review-retry lane from re-feeding lease-timeout failures into the same lock. Classify a lease-acquisition timeout as backpressure and requeue with jitter and a concurrency cap tied to lease availability, rather than an immediate re-run into contention.
- Optionally cap admitted concurrent publishers to the number of shards, so admission and lock capacity match and the queue cannot grow past what the locks can drain.
Net effect: publishers contend only on same-shard collisions, each push rewrites a small slice instead of a 434k-file tree, and the retry lane stops amplifying contention. That keeps the correctness #724 introduced while removing the throughput ceiling a single global lease imposes.
Evidence pointers
- Failing review runs: 29781081610, 29781068410, 29781052133 (all
StatePublishContentionError, 180000 ms lease timeout). - Publish/lease/reconcile logic:
src/repair/git-publish.ts. - Concurrency and retry lanes:
.github/workflows/sweep.yml,.github/workflows/repair-publish-results.yml,.github/workflows/exact-review-reconcile.yml, and the.github/workflows/repair-*.ymlset. - Related in-flight work: #711 through #724.
Happy to be corrected on any of this if the internal picture differs from what the public logs show.
@yetval - we are aware of issues with clawsweeper (started approx 20 hrs ago and got worse around 06:00 UTC on 20th). I am currently looking to resolve the issue. We have just had some positive signs with the latest PR https://github.com/openclaw/clawsweeper/pull/724 , but there were others before. I am working on an additional PR now, to hopefully resolve it more fully. Thanks for your patience.
Perfect! Looking forward to the fix.
@yetval - FYI - looking into this too.... that comment then triggers a new clawsweeper comment as though it's doing another review...
Still occurring post-#724 — openclaw/openclaw#107744 has a stuck placeholder posted 2026-07-21T19:36Z (>24h ago). Review started, acknowledged, clawsweeper-command-status written — but no verdict edit. This confirms the publish contention is still affecting PR reviews as well as issues after the July 20/21 fixes. Example run: the re-review was triggered at 2026-07-21T19:32Z by @clawsweeper re-review.
ClawSweeper status: review started.
I am starting a fresh review of this issue: Observational note: single state-publish lease is stalling review completion; consider per-item shard of the lease and state layout 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.
Closing with proof, and thank you — this note was an unusually accurate outside read of the pipeline, and its 2026-07-22 update described the terminal failure mode precisely: green review runs with publication dying "further down the pipe."
The root causes are fixed as of today:
- #805 — the materializer built every commit on a stale checkout base (force-rewritten by compaction), guaranteeing
fetch firstrejection; publishes now fetch and hard-reset onto the live remote head after lease admission. The same PR bounded the coordinator's silent infinite acquire poll (26-minute hangs) and the unbounded network pushes. - #806 — the materializer starved in the ordinary lane behind publication-batch lease turns; it is now admitted through the batch lane (the two-turn cap still protects ordinary writers).
Proof: run 30006985986 — the first fully green materializer cycle — drained and acked 12,500 queued rows (drained=12500 committed=9308 acked=12500 skipped=3192 errors=0), rebasing onto the moving head three times mid-run. The remaining backlog is draining on the */20 schedule, which unsticks the placeholder comments you counted.
The per-item lease shard you suggested ended up unnecessary: RFC #738 went the other direction (single writer + durable append window), which removes the contention rather than sharding it. Long-tail writer cutover continues under that RFC.