Repository navigation
Conversation
Extraction batched fields by count only, so up to 20 fields with values and quotes shared one max_output_tokens limit; a cut reply failed every field of the call. Fields now fill a call while their estimated replies (value leaves, lists at five items, five quotes each, set from measured reply sizes) fit the output limit, with max_fields_per_call as an upper bound. A field whose estimated reply alone exceeds the limit fails with field_output_exceeds_budget, naming the setting to raise.
This was referenced Nov 11, 2026
Contributor
Author
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.
Stacked on #59 (pool provenance, on #55):
extraction_callsalready builds passages per batch there. Review the last commit.Cause
Extraction batched fields by count (
max_fields_per_call, default 20) without regard to how much each field's reply needs. Every field carries a value plus up to five quotes inside onemax_output_tokens(default 4096), so object and verbatim text fields overflow it, and one truncated reply fails every field of the call.Fix
shapes.output_estimate(f): the expected reply of one field = envelope (30) +EVIDENCE_LIMITquotes (5 x 20) + value leaves (text 40, other scalars 8, objects the sum of their properties, lists five items). The constants come from the per-call completion sizes the new call records report (feat(docscout): record model call outcomes and run summaries #53) on a stress run: a text field's reply is about 65 tokens at the median and 165 at the 90th percentile, so the estimate sits near the 90th percentile.max_output_tokens;max_fields_per_callstays the upper bound.max_output_tokensfails before any call withfield_output_exceeds_budget(INVALID, not retryable), and the message namesstages.extract.max_output_tokens.A heuristic: it reduces collateral failures; a long verbatim value (measured up to about 1700 tokens) can still be cut, and then fails alone or with few neighbours. No configuration change.
Tests
shapes_test: estimates grow with text, objects and lists and include the quotes.engine_test: a group splits by estimated output within the limit; a field whose estimate exceeds the limit fails with the code and the setting named while the other field extracts. Unit fixtures now carry a validmax_output_tokens(the schema minimum is 256).Red before, green after.
make lintclean. Suite on SQLite and PostgreSQL: 188 passed, 0 failed.test/check-package-bindings.pyfails onmainas well (unrelated).