Skip to content

feat: stream progress notifications from query-mode ingest_paper - #27

Merged
Burton-David merged 1 commit into
mainfrom
feat/ingest-progress
May 31, 2026
Merged

feat: stream progress notifications from query-mode ingest_paper#27
Burton-David merged 1 commit into
mainfrom
feat/ingest-progress

Conversation

@Burton-David

Copy link
Copy Markdown
Owner

What

Query-mode ingest_paper(query=..., max_papers=N) runs a search plus a batched embed and an index upsert — 30–60s of silence in Claude Desktop today. assist_draft already streams progress when the client passes a progressToken; this gives ingest parity.

  • LibraryService.bulk_ingest gains an optional progress callback (same (done, total, message) shape as DraftService.assist) and reports its embed and index phases.
  • _do_ingest builds the callback via the existing _maybe_progress_callback(server) and emits a searching... event before the search. Single-id mode stays silent — it's a sub-second single fetch + embed.
  • ingest_paper tool description updated to mention progress streaming (parity with assist_draft).

Honest progress, not faked per-paper ticks

The issue sketched "once per paper as embeddings complete," assuming N parallel embeds. The implementation does a single batched embedder.embed(texts) call (priced by token, one round-trip). Rather than fake a per-paper tick over one atomic call, progress advances by phase: 0/(N+1) while embedding all N, N/(N+1) while indexing, N+1/(N+1) done. The total still conveys the paper count; the message names the phase. Reverting to per-paper embeds purely to animate a bar would regress the batching optimization.

Closes #6.

Test plan

  • ruff check src tests — clean
  • mypy src — clean
  • pytest -q --strict-markers — 527 passed, 14 skipped
  • New test_library_service.py cases: progress sequence [(0,3),(2,3),(3,3)] for 2 papers with the right phase messages; no-callback path unchanged; empty input emits nothing

Query-mode ingest_paper (query=..., max_papers=N) runs a search plus a
batched embed and index upsert — 30-60s of silence in Claude Desktop today.
assist_draft already streams progress when the client passes a progressToken;
this gives ingest the same treatment.

bulk_ingest takes an optional progress callback (same shape as
DraftService.assist) and reports its embed and index phases; _do_ingest
builds the callback via the existing _maybe_progress_callback and emits a
'searching...' event before the search. Single-id mode stays silent — it's
sub-second.

The embedder call is a single batched request, so progress advances by phase
(0/N+1 embedding all N, N/N+1 indexing) rather than faking a per-paper tick
over one atomic call.
@Burton-David
Burton-David merged commit f62d708 into main May 31, 2026
1 check passed
@Burton-David
Burton-David deleted the feat/ingest-progress branch May 31, 2026 15:45
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.

Progress notifications for query-mode ingest_paper

1 participant