Skip to content

feat: add explicit pause/resume for the ingest queue#491

Merged
nashsu merged 1 commit into
nashsu:mainfrom
AndrewDongminYoo:feat/ingest-queue-pause
Jun 28, 2026
Merged

feat: add explicit pause/resume for the ingest queue#491
nashsu merged 1 commit into
nashsu:mainfrom
AndrewDongminYoo:feat/ingest-queue-pause

Conversation

@AndrewDongminYoo

Copy link
Copy Markdown
Contributor

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:

  • Pause lets the in-flight task finish normally — it is never aborted — but no further pending task is handed to the LLM until you resume.
  • The drain-sweep (sweepResolvedReviews, itself an LLM call) is also suppressed while paused, so a pause genuinely stops token spend.
  • Resume kicks processing again and pending tasks drain as usual.

Implementation

  • pauseProcessing() / resumeProcessing() / isQueuePaused() in ingest-queue.ts.
  • A single if (paused) return guard at the top of processNext (before queue.find), leaving the abort controller untouched. Because enqueueIngest, retryTask, and restoreQueue all funnel through processNext, they honor the pause for free — a file added while paused just sits pending.
  • paused is surfaced on getQueueSummary(), so the activity panel picks it up through the polling it already does — 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 — 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.ts adds coverage for: the in-flight task completing while the next stays pending, resume draining the queue, the drain-sweep being skipped while paused, and the flag resetting on restoreQueue / 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.

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.
@nashsu nashsu merged commit b141d5a into nashsu:main Jun 28, 2026
3 checks passed
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.

2 participants