You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(ingest): per-LLM-call timeout + leaf-section cap (un-stick big PDFs)
Two ingest bugs that froze FinanceBench ingests and are real product
defects on any large filing:
1. No per-LLM-call timeout. A single hung summarize / HyDE / multi-axis
/ TOC-build call blocked the stage's errgroup Wait() forever — a doc
was observed stuck in `summarizing` for 13+ hours. Fix:
completeWithTimeout wraps every individual LLM.Complete in a
context.WithTimeout (default 90s, ingest.llm_call_timeout_seconds /
VLE_INGEST_LLM_CALL_TIMEOUT_SECONDS). On timeout the call is logged
and skipped — the section keeps its existing/empty summary and the
document still reaches `ready`. One bad call can no longer freeze a
whole document.
2. Leaf-section explosion. chunkOversizedLeaves splits any leaf over
2400 chars into ~900-char pieces, so a 45K-char "Notes to Financial
Statements" section shattered into ~50 chunks; a 92-page 10-K
produced ~1500 leaves, each costing a summarize+HyDE+multi-axis LLM
call → the slow/stalled ingest. Fix: capLeafSections enforces a
ceiling (default 400, ingest.max_sections / VLE_INGEST_MAX_SECTIONS)
by merging the smallest adjacent leaf siblings under a shared parent
until the count is within budget. Content is preserved (blank-line
joined), page ranges unioned, and table sections — attached after
this pass — are never merged. Applied in both the heuristic and
outline parse paths.
The cap runs at its default (400) through the existing
RegistryFromTableOpts → NewPDFWithTables path, so the fix is active on
the deployed binary without a cmd wiring change. ingest.max_sections
becoming operator-tunable end-to-end is a small follow-up in the cmd
binaries.
Tests: a hung-call mock proves the pipeline still completes and other
sections summarize; cap tests prove merge-down to budget, smallest-pair
ordering, content preservation, and the disabled (<=0) escape hatch.
go build/vet/test all green.
"Section titled %q.\n\n%s\n\nReturn a single sentence (≤ 60 words) that names this section's concrete topics, entities, identifiers, and key items so a retrieval engine can match it to user questions.",
728
787
cleanForLLM(s.Title), body)},
729
788
},
730
-
})
789
+
}, p.LLMCallTimeout)
731
790
iferr!=nil {
732
791
// Stub LLMs return ErrNotImplemented. Degrade gracefully: use a
733
792
// truncated excerpt as the "summary" so downstream retrieval
0 commit comments