Follow-up to #420 part 1, which shipped the submit/poll/apply machinery (SubmitExtractionBatch, PollExtractionBatches, kb poll-batches, the extraction_batch_items mapping, BatchExtractor wiring). What remains is the ingest integration:
When EXTRACTION_BATCH is enabled (with the Claude extractor), the ingest extractor loop should, instead of calling extractChunk synchronously per hot chunk, collect BatchWorkItems (custom_id, text, source_uri, discriminators, forceReview) across the document (or the run) and call SubmitExtractionBatch once — so a large backfill submits one cheap batch and kb poll-batches (cron) drains it later, rather than paying per-chunk synchronous cost.
Scope
- In
internal/core/ingest.go, when c.batchExtractor != nil, accumulate items from the kept hot chunks and submit a batch after the doc's store tx (chunks must exist first — the mapping references source_uri, and results are applied to the graph, not to chunk rows).
- Choose custom_id = the chunk's content hash (stable, unique within the batch).
- Keep the synchronous path when batch is off (default).
- Report submitted-batch counts in
IngestStats.
Tests
DB test: with a mock BatchExtractor, ingest a doc in batch mode → a job + items recorded, no synchronous extraction; then PollExtractionBatches applies.
P2, area:ingestion.
🤖 Generated with Claude Code
Follow-up to #420 part 1, which shipped the submit/poll/apply machinery (
SubmitExtractionBatch,PollExtractionBatches,kb poll-batches, theextraction_batch_itemsmapping,BatchExtractorwiring). What remains is the ingest integration:When
EXTRACTION_BATCHis enabled (with the Claude extractor), the ingest extractor loop should, instead of callingextractChunksynchronously per hot chunk, collectBatchWorkItems (custom_id, text, source_uri, discriminators, forceReview) across the document (or the run) and callSubmitExtractionBatchonce — so a large backfill submits one cheap batch andkb poll-batches(cron) drains it later, rather than paying per-chunk synchronous cost.Scope
internal/core/ingest.go, whenc.batchExtractor != nil, accumulate items from the kept hot chunks and submit a batch after the doc's store tx (chunks must exist first — the mapping references source_uri, and results are applied to the graph, not to chunk rows).IngestStats.Tests
DB test: with a mock
BatchExtractor, ingest a doc in batch mode → a job + items recorded, no synchronous extraction; thenPollExtractionBatchesapplies.P2, area:ingestion.
🤖 Generated with Claude Code