feat: add explicit pause/resume for the ingest queue#491
Merged
Conversation
Previously the only queue controls were "cancel all" (destructive) and "retry failed". There was no way to stop spending tokens on pending work without cancelling it. Add a pause toggle: the in-flight task finishes normally (pause never aborts it), but no further pending task is handed to the LLM until resumed. The drain-sweep (also an LLM call) is suppressed while paused too. - pauseProcessing / resumeProcessing / isQueuePaused in ingest-queue.ts; a `paused` guard at the top of processNext (before queue.find), so enqueue/retry/restore all honor it for free. paused is surfaced on getQueueSummary so the panel picks it up with no new plumbing. - In-memory only (not persisted): reset to false in restoreQueue and clearQueueState, so every project loads un-paused and a pending queue auto-resumes on app restart. (v1 limitation: pause does not survive a restart — the cheap durable path, if wanted later, is a project-store key, not the queue JSON.) - activity-panel: Pause/Resume button next to "Cancel all", and a "(paused)" label on the queue header.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The ingest queue has only two controls today: Cancel all (destructive — aborts the running task, removes its partial output, drops every pending item) and Retry failed. There's no way to stop spending tokens on pending work without throwing it away.
This matters for the local-CLI / paid-API users: if you queue a batch and then realize you want to hold off (review intermediate output, switch to other work, avoid burning quota), your only option is to cancel everything and re-add it later.
What this adds
A Pause / Resume toggle for the ingest queue:
sweepResolvedReviews, itself an LLM call) is also suppressed while paused, so a pause genuinely stops token spend.Implementation
pauseProcessing()/resumeProcessing()/isQueuePaused()iningest-queue.ts.if (paused) returnguard at the top ofprocessNext(beforequeue.find), leaving the abort controller untouched. BecauseenqueueIngest,retryTask, andrestoreQueueall funnel throughprocessNext, they honor the pause for free — a file added while paused just sitspending.pausedis surfaced ongetQueueSummary(), so the activity panel picks it up through the polling it already does — no new plumbing.falseinrestoreQueueandclearQueueState, so every project loads un-paused and a pending queue auto-resumes on app restart — consistent with the existing "resume pending on startup" behavior.UI
A Pause/Resume button next to "Cancel all" in the activity panel, plus a "(paused)" label on the queue header.
Tests
ingest-queue.test.tsadds coverage for: the in-flight task completing while the next stayspending, resume draining the queue, the drain-sweep being skipped while paused, and the flag resetting onrestoreQueue/clearQueueState.Note / possible follow-up
Pause is intentionally session-scoped: it does not survive an app restart (a pending queue auto-resumes, matching today's startup behavior). If restart-durable pause is desirable, the natural place is a project-store key rather than the queue JSON — happy to do that as a follow-up if you'd prefer it.