Skip to content

fix(queue): preserve pending backlog across dispatcher pauses - #601

Merged
brokemac79 merged 1 commit into
mainfrom
codex/csw-041-queue-recovery
Jul 15, 2026
Merged

brokemac79 merged 1 commit into
mainfrom
codex/csw-041-queue-recovery

Conversation

@brokemac79

Copy link
Copy Markdown
Contributor

Summary

Preserve each pending exact-review item's own retry time when the dispatcher is paused or blocked, while making the dispatcher's retry deadline an explicit admission barrier.

Problem

During a dispatcher preflight pause/block, the queue rewrote every pending item's nextAttemptAt to the dispatcher retry time. Repeated transient pauses could therefore keep moving an entire backlog forward, even where capacity was available. An alarm already scheduled for an expiring lease could also run before that dispatcher retry and accidentally admit retained due work.

Implementation

  • Stop rewriting all pending rows when the dispatcher is paused or blocked.
  • Keep the dispatcher retry as the pending wake deadline while retaining active-lease recovery wakes.
  • Refuse admission while a paused or blocked dispatcher has a future retry deadline, including from a stale lease alarm.
  • Add focused regression coverage for retained backlog recovery and for an early expired-lease wake with a pending item whose independent retry equals the dispatcher retry.

Validation

  • node --test test/dashboard-worker.test.ts — 106 passed, 0 failed.
  • pnpm run build:dashboard
  • pnpm run lint:dashboard
  • pnpm exec oxfmt --check dashboard/worker.ts test/dashboard-worker.test.ts
  • git diff --check
  • codex review --uncommitted — clean after focused proof.
  • codex review --base origin/main — clean after commit.
  • pnpm run review -- --local-range --target-repo openclaw/clawsweeper --target-dir C:\clawsweeper-work\worktrees\csw-041-queue-recovery --base origin/main --artifact-dir C:\clawsweeper-work\local-reviews\csw-041-pr-final2 — final local ClawSweeper review: patch correct, no actionable findings.

The final local review used the known-good reviewer baseline 7d58c63, which already includes the selected-current-Codex-CLI local-review support from #541. It caught two earlier queue-timing edge cases; both were fixed before this final pass.

Risks and rollout

This changes internal Durable Object queue scheduling. The local review identifies the remaining limitation accurately: proof is unit-test/source-reproduction only, not a redacted after-fix Durable Object or staging trace. It does not change capacity, GitHub tokens, labels/comments publication, or state-branch publication.

After deployment, rows previously deferred by a pause remain held only until the current dispatcher retry; once active at or after that retry, they are admitted naturally. Monitor pending, dispatching, and leased counts together with exact-review run completion and GitHub label/comment publication.

Incident alignment

This addresses the queue-admission component of the recent review-backlog incident. It is deliberately scoped and does not claim to fix independent state-publication contention, token/permission errors, or GitHub label/comment publication failures.

@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@brokemac79
brokemac79 merged commit 68f83c2 into main Jul 15, 2026
7 checks passed
@brokemac79
brokemac79 deleted the codex/csw-041-queue-recovery branch July 15, 2026 15:44
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant