Repository navigation
fix: prevent apply cursor livelock - #1129
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 8:47 PM ET / August 12, 2026, 00:47 UTC. ClawSweeper reviewWhat this changesThis PR prioritizes the numeric comment-sync frontier in the apply loop, checkpoints it from execution trace order, and removes pre-lease placeholder cleanup. Merge readinessKeep this PR open for normal landing review: its cursor-livelock repair is not on current main, the prior frontier-ordering concern is addressed, and this review found no actionable patch defect. Priority: P1 Review scores
Verification
How this fits togetherThe scheduled apply lane selects reviewed records, updates durable GitHub review comments, and stores a cursor so later runs resume the batch. This change controls which selected record runs first and how completed execution advances that cursor. flowchart LR
A[Scheduled apply run] --> B[Comment-sync batch]
B --> C[Numeric cursor frontier]
C --> D[Apply execution order]
D --> E[Trusted execution trace]
E --> F[Durable cursor checkpoint]
D --> G[GitHub comment synchronization]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the narrow frontier-first ordering with its trace-based checkpoint semantics and retain the focused fixture as regression coverage. Do we have a high-confidence way to reproduce the issue? Yes: the committed fixture replays the production-derived 40-item ordering and an ascending request that places the frontier last, exercising the real apply command and completion helper. Is this the best way to solve the issue? Yes: making the apply loop independently select the numeric frontier is the narrowest reliable defense because shell preparation can reorder item numbers before execution. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 83dddd63e750. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Summary
Fix the ongoing
openclaw/openclawapply/comment-sync cursor livelock without raising its 300-second runtime budget.Production run https://github.com/openclaw/clawsweeper/actions/runs/31544381133 selected 39 urgency-ranked records before the only numeric frontier record. It terminally evaluated 25 records, yielded at the runtime budget, and printed
Comment sync made no cursor progress; the durable cursor therefore stayed at#105854and every later cycle selected the same window.The selector still reserves its first slot for the numeric frontier, which helps non-apply consumers. The load-bearing guarantee now lives in the TypeScript apply loop: with an active comment-sync cursor, it computes the smallest selected item number strictly greater than the cursor and executes that record first regardless of incoming
item_numbersposition. If no selected number is greater, it wraps to the smallest selected number, matching the existing cycle bookkeeping. Cursor completion follows the trusted terminal execution trace rather than the shell list order, so downstreamsortoperations cannot recreate the starvation.The branch also removes the redundant placeholder sweep attempted before apply-lease acquisition. Those deletes were correctly rejected locally with
apply mutation lease is not held; the lease reaper then removed the expired placeholders through its authorized path. Post-publication placeholder cleanup remains intact.Behavior proof
apply-decisionsloop,comment-sync-batchselector,complete_comment_sync_batch, cursor writer, canonical closed-record fallback, and wrap/cycle regression seams.31544381133, plus adversarial ascending input[87267,95788,97566,105342,105870]with frontier#105870last.docs/proof/apply-cursor-livelock/run-proof.shon Node 24.19.0, pnpm 11.10.0, jq 1.8.2; synthetic filesystem records, no GitHub credentials or mutation.#105870first and persisted cursor#105870with every lower urgent record unexamined; the clipped-frontier replay persisted#105854withcursor_count=0; five focused apply/selector/completion/wrap probes passed.docs/proof/apply-cursor-livelock/fixture-result.json, behavior contract/report, container provenance, and the scripted reproduction in the same directory.Finding disposition
item_numbers; the loop-level numeric comparison is now the authoritative guarantee.find()ordering: accepted. The loop now uses an explicit numeric minimum, with forward, wrap, ascending, and unsorted coverage.Validation
pnpm run check: 3,336 tests; 3,327 passed, 9 skipped, 0 failed; coverage thresholds passed.PROOF_RC=0.2ebe882831f99d9f22dd6f696f48d2a4e80f3195through configuredprovider=aws, leasecbx_a9f86ad7a357(quick-prawn-5920), runrun_61dcc42eb8d2, insidenode:24-bookworm; 5/5 focused tests passed, exit 0, and lease cleanup is confirmed. Receipt commit695d7beaca437fe03d1da003c4a69838c043602achanges documentation only and was included in the same push.jq-linux-amd64binary matched repository-pinned SHA-256b1c22172dd303f3be49e935aa56aa48a8b7a46e0bc838b4997d3bb451495870fbefore installation.Scope
No runtime-budget increase, cursor schema change, close-policy change,
CHANGELOG.md, orCLAUDE.mdchange.OpenClaw Bay is unaffected: this changes internal apply-lane ordering and removes a redundant pre-lease cleanup attempt; no lifecycle publication or observer-only dashboard contract changes.