fix: rotate apply queue batches#375
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 27, 2026, 10:33 AM ET / 14:33 UTC. Summary Reproducibility: yes. source-reproducible. Current main preselects proposed close records by item number without a bounded apply cursor, so a skip-heavy prefix can consume the processed-record budget before later records are reached. Review metrics: 3 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the cursor-based apply rotation after maintainers accept the live automation rollout risk and keep any extra production observation in workflow logs/status rather than adding branch churn. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible. Current main preselects proposed close records by item number without a bounded apply cursor, so a skip-heavy prefix can consume the processed-record budget before later records are reached. Is this the best way to solve the issue? Yes. The AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ae63b16d6c74. Label changesLabel justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
What Problem This Solves
Scheduled
apply-existingcan spend its processed-record budget on the same front of the proposed-close queue when many candidates are skipped, policy-blocked, or otherwise unchanged. That can make later stale OpenClaw issues/PRs wait indefinitely even though the workflow is running.This PR makes automatic apply runs rotate through a bounded cursor window instead of always scanning the same candidates first.
Why This Change Was Made
apply_checked_atand item number.results/apply-cursors/<target>.jsonafter automatic apply checkpoints.apply_checked_aton processed apply outcomes, including comment sync, label sync, policy skips, and closed records.set -uunbound variables.item_snapshot_hashfrom apply preselection, becauseapply-decisionsignores them before producing report entries.User Impact
ClawSweeper should move through stale apply candidates more predictably instead of repeatedly spending the same apply budget on a skip-heavy prefix. This does not run the #371 manual back-sweep; that remains an explicit maintainer-triggered apply run.
Evidence
Open PR overlap check
Checked the current open
openclaw/clawsweeperPRs on 2026-06-27: #374, #370, #369, #358, #350, #342, and #341. The nearest overlaps are #350 (worker budget/caps), #341 (repair checkpoint contract), and #358 (decision packets), but none implement apply queue rotation,apply_checked_atcoverage, or apply cursor persistence.ClawSweeper feedback addressed
explicit_item_numbersandauto_selected_apply_batchinitialization into the apply step that uses them.write-apply-cursornow accepts--item-numbersand falls back to the selected window when the apply report is empty.item_snapshot_hashare not selected for apply windows.Tests and checks
pnpm run build:allnode --test test/repair/workflow-utils.test.tsnode --test --test-name-pattern "(apply workflow bounds checkpoints and requeues with a fresh token|apply-decisions counts advisory label-only syncs against the processed limit|apply-decisions syncs labels when first review placeholder advanced issue updated_at)" test/sweep-workflow.test.ts test/clawsweeper.test.tspnpm exec oxfmt --check .github/workflows/sweep.yml src/clawsweeper.ts src/repair/workflow-utils.ts test/clawsweeper.test.ts test/repair/workflow-utils.test.ts test/sweep-workflow.test.tspnpm run lint:repairpnpm run lint:srcpnpm run lint:scriptspnpm run codex:local:checkcodex review -c 'service_tier="fast"' --base origin/main-> no actionable correctness issues identified.pnpm run review -- --local-only --target-repo openclaw/clawsweeper --item-number 375 --target-dir C:\oc-work\clawsweeper-apply-queue-rotation --artifact-dir artifacts/local-review-375 --codex-model gpt-5.5 --codex-reasoning-effort high --codex-timeout-ms 600000-> patch correct, no review findings; remaining local review rank-up was PR-body proof, provided below.Known local limitation: full
node --test test/sweep-workflow.test.tsstill has an existing Windows checkout file-mode assertion failure inread-only checkout mode restores file modes and leaves git metadata writable(292 !== 365). The apply workflow assertions in that file pass.Temp-state apply proof
This proof used a temp record tree and the built CLI, not live GitHub mutation. It exercised cursor-based preselection, real
apply-decisionsprocessing with--processed-limit 300, cursor persistence, next-window selection, and the empty-report cursor fallback.