Repository navigation
fix: stop durable comment sync from starving automatic closures - #1016
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 11:12 PM ET / August 3, 2026, 03:12 UTC. ClawSweeper reviewWhat this changesThe PR unifies automatic and scheduled durable review-comment synchronization behind a repository-scoped 40-item cursor, narrows reconciliation to selected records, and strengthens freshness, guarded-record, locked-conversation, and cursor-fairness handling in the apply lane. Merge readinessThis PR remains necessary: current Priority: P2 Review scores
Verification
How this fits togetherClawSweeper’s apply lane turns durable review records into GitHub review comments and, only for safe unchanged proposals, closures. Scheduled and background runs first select records and acquire a shared mutation lock, so their cursor and reconciliation policy determines whether urgent closure work can proceed promptly without mutating unrelated records. flowchart LR
A[Durable review records] --> B[Automatic or scheduled apply run]
B --> C[Shared 40-item cursor]
C --> D[Scoped record reconciliation]
D --> E[Shared GitHub mutation lock]
E --> F[Durable review comments]
E --> G[Eligible safe closures]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land only after a maintainer confirms the current head’s workflow concurrency expression, automatic-versus-custom cursor classification, and scoped reconciliation preserve the stated closure and publication guarantees under production load. Do we have a high-confidence way to reproduce the issue? Yes, at source level with medium confidence: current main keeps scheduled comment sync on a separate pull-request-only path and simple wrapping cursor selection, while the PR body documents the production queue starvation scenario. A fully independent replay of the final branch could not be run because its partial-clone objects were unavailable locally. Is this the best way to solve the issue? Yes, with medium confidence: sharing a bounded default-policy cursor while preserving unique custom-policy cursors directly addresses lock starvation without weakening the existing source-revision, protected-label, ownership, proof, and age gates described in the PR. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fd51157a1080. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
…claw#1016) * fix: coalesce bounded comment sync without starving closures * fix: preserve source freshness and locked review synchronization * fix: preserve truthful guarded review publication and queue fairness --------- Co-authored-by: Peter Steinberger <[email protected]>
Why
Real production closure jobs were being starved by stale background comment-sync workflows sharing the same repository mutation lock:
openclaw updateleaves the gateway stopped; recovery restart refused with "binary is older than the config" openclaw#118244 and [Feature]: Externalize the Tencent provider into the official external provider catalog openclaw#116296.gpt-5.6-solwithxhighreasoning. A separately generated candidate, fix(memory-core): ingest transcript turns into short-term recall openclaw#118325, was automatically closed unmerged by ClawSweeper itself after fresh source-backed review proved its behavior was already implemented onmain.Change
needs-humanverdicts must replace earlier passing comments.__cursor__, kindall, batch/checkpoint40, zero item/comment age, no minute-level override, configured default close reasons (including equivalent explicit-default continuations), default 60-day stale gate, and default 2-second delay. Preserve unique workflow groups, independently SHA-256-fingerprinted cursors, and bounded continuations for manual batches, PR-only maintenance, custom limits, custom close reasons, stale gates, delays, checkpoints, and every distinct day/minute age setting. Normalize oversized checkpoints before cursor classification; uncursored default runs consistently use the same shared cursor before and after continuation.reviewed_at/last_full_review_at, repair missing/corrupt metadata, and always inspect PRs live so new heads are never hidden behind a recently synchronized comment. Shared automatic cursors skip genuinely fresh issues while explicit/manual all-item cursors still inspect them. Already-synchronized proof/stale-sync retries stay in normal cursor order rather than repeatedly monopolizing the urgent lane, and urgent out-of-order work can never advance the persisted cursor past unfinished lower-numbered records.none/unknowncomment references without rewriting an already-correct GitHub comment. Advance safely past canonically archived selected records, continue wrapped scans when a newer urgent item sits outside the cycle boundary, and exclude locked/terminal records, unverified checkouts, and ordinary legacy comment records lacking a synchronization timestamp from urgent priority. Preserve the canonical repository slug, including dots and underscores, when locating records and automatic cursors.Real behavior proof
closed=5,review_comment_synced=18, andskipped_protected_label=2.closedtimeline actor isclawsweeper[bot]for the external-plugin issue [Bug]: LCM message_parts with part_type='file' stored without file_mime/file_name — breaks session rendering openclaw#116231, the low-value issue MEDIA directive: narrow file-type support, only first of multiple files sent, UUID filename suffix, workspace-only paths, missing MIME mappings, no documented type matrix openclaw#117428, and the latest live closures [Bug]: failedopenclaw updateleaves the gateway stopped; recovery restart refused with "binary is older than the config" openclaw#118244 and [Feature]: Externalize the Tencent provider into the official external provider catalog openclaw#116296; the issue-fix lane created fix(browser): make extension deep doctor probe page snapshots openclaw#118361, fix(agents): finalize settled failed tool turns openclaw#118315, fix(claude-cli): deduplicate live and imported assistant turns openclaw#118309, fix(minimax): route M3 image calls through MiniMax VL openclaw#118303, and fix(doctor): import historical exec approval metadata openclaw#118282 without requesting auto-merge. ClawSweeper also closed its own superseded candidate fix(memory-core): ingest transcript turns into short-term recall openclaw#118325 unmerged after independently proving the requested behavior already exists.OPEN; OpenClaw has 26 open ClawSweeper-generated PRs, and each of the five new root-cause PRs hasauto_merge: null.scripts/apply-workflow-helpers.sh, created 41 real canonical markdown records, and exercised the background cursor followed by the scheduled cursor. Background selected items 1–40, scheduled selected item 41 from the same durable cursor, scheduled continuation stayedfalse, and the final cursor was 41.clawsweeper reconcileCLI against records 1–3 with only item 2 selected; item 2 moved to closed, unselected open item 1 stayed open, unselected closed item 3 kept its sidecar, only the selected canonical tuple was captured or changed, and the test fails if any full open-inventory scan is attempted (pagesScanned=0). A deleted selected item is archived only after live repository access is verified; an inaccessible repository preserves the item and fails safely.pnpm run checkacross all 3,056 repository tests (3,047 passed and 9 intentionally skipped), and an earlier strengthened follow-up passed the complete single-build unit suite across 1,839 tests (1,837 passed, 2 intentionally skipped, 0 failed). The final state additionally passes 373 focused workflow/cursor/reconciliation/guarded-apply/duplicate-correction/PR-label/lease-ordering/legacy-protected-decision/local-review regression tests plus every static, formatting, and lint check, including independently identified modern locked-review tuples, matching completed lease cleanup, issue/PR timestamp drift, snapshot-only drift withoutitem_updated_at, persisted observed revisions, canonical invalidation, stale close verdicts, guarded snapshot freshness even at zero cooldown, failed-review publication and weekly maintenance, truthful metadata-only verification timestamps, checked-only synchronization repair behind the cursor, protected disposition preservation even after label removal, protected-close and maintainer-ownership priority, persisted live protected/maintainer labels, guarded stale-head readiness cleanup, command-only re-review label restoration, pre-mutation guarded PR freshness, guarded PR live-head maintenance, seven-day locked-review cooldowns, closed legacy records, open-linked locked issue metadata, protected stale-PR-head corrections, proof labels, and guarded freshness cases. All 9 dedicated offline local-review tests pass. Fresh independent reviews separately ran 203 and 206 apply-path regression tests and complete repository checks; an earlier independent review exercised 1,662 cursor-ordering scenarios with zero skipped or oversized batches. The original 14,216-line entry point is now 19 lines, and its largest extracted apply workflow is 1,999 lines.Review finding disposition
current_item_updated_at, and the restored late guard preserves ordinary PR source/label ordering. Existing and newly discovered stale-canonical correction state remain retryable.skipped_*action. Guarded freshness and forced publication now have an explicit protected/maintainer/invalid-decision action allowlist and also require unchanged reviewed source; source-drift skips neither publish close verdicts nor consume the 40-item comment-sync window. Every reviewer-provided mocked reproduction now passes alongside permanent regression coverage.updated_atwhile recording a separate local verification timestamp; and guarded PRs remain eligible for live-head invalidation. A subsequent throughput review additionally proved synchronized failed reviews must leave the urgent lane; failed reports now receive immediate durable publication once and stop monopolizing bounded cursor capacity afterward. Permanent regressions cover failed-review selection and post-publication retirement, guarded stale-source publication, scheduler re-review after human edits, and protected PR head maintenance.proposed_closeeligible for later closure, and a checked-only repair being stranded behind the automatic cursor. Protected labels now win before source-drift shortcuts, the original guarded action is explicitly restored rather than preserving a transient promotion, and checked-only repairs receive bounded urgent priority without prioritizing ordinary legacy records. Existing protected decision-packet tests and new removed-label/cursor-position regressions all pass.Deployment invariants
CLAWSWEEPER_AUTO_CLOSE_REASONS=allCLAWSWEEPER_ALLOW_FIX_PR=1CLAWSWEEPER_FIX_PR_MODEL=gpt-5.6-solCLAWSWEEPER_FIX_PR_REASONING_EFFORT=xhighCLAWSWEEPER_ALLOW_AUTOMERGE=0CLAWSWEEPER_ALLOW_MERGE=0Generated OpenClaw fixes remain PR-only; this PR changes only the ClawSweeper service.