fix: complete quickstart search, chunking, and retry contracts - #667
Merged
Conversation
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.
The real local quickstart exposed correctness gaps: default dynamic strings were missing from
_all, empty separator sections could bypass chunk limits, and generation-capacity errors lost their public retry contract.Include unmapped dynamic strings in
_all, matching the schemaless default, and record that inclusion in observed metadata. Keep exact.keywordcopies excluded and preserve explicit mappings. Default omitted text-query fields to_allin both direct and generated-schema parser paths, as allowed by the public schemas. Preserve explicit field selectors. The real Gemma plan submitted a legal fieldlessmatchquery that previously receivedUnsupportedQueryRequest; its query-string fallback found no evidence. Guide query planning toward concise subject terms while retaining normal_allsearch. There is no separate configurable query-default field in the current Zig full-text index configuration.Preserve query-string AND semantics when converting boolean filters into scored text queries. Internal filters ignore their optional-clause minimum when the optional list is empty; the scorer correctly rejects a positive minimum over an empty list. Normalize that minimum to zero during conversion so implicit AND, explicit AND, repeated clauses and nested negation retain their meaning. Keep
matchOR semantics and actual disjunction minimums unchanged.Skip empty and tokenizer-empty sections, including whitespace-only sections, and check span overflow whenever a current section exists. This prevents
,alphafrom exceeding a one-token limit andalpha,beta,from emitting an empty terminal chunk. Independently re-tokenize source windows because continuation pieces can expand when encoded alone (for example,ordfromunaffordable). Recursively split oversized windows with guaranteed byte progress and preserve validated counts for the assembly loop. When token offsets are unavailable or invalid, partition contiguous UTF-8 source spans instead of searching normalized decoded text; this preserves leading text in cases such asHELLOhelloЖ.Use the existing inference-capacity envelope for retrieval JSON, query-builder JSON, and live/buffered SSE:
error,message,reason,retryable, andretry_after_ms. HTTP responses also includeRetry-After. Query-builder document-identity and transient-embedding failures use the existing typed query-unavailability response instead of minimal JSON or plain text. All three explicitly mapped query-builder 503 variants now conform to the declared union and carry retry headers. Declare agent 503 variants and SSE retry fields in OpenAPI, and regenerate Zig, Go, TypeScript, and Python clients. TypeScript agent HTTP calls throw the existingInferenceCapacityError; SSE delivers it throughonErrorDetailwhile preserving the legacy stringonErrorcallback. StreamingchatAgent().messagesrejects on terminal SSE errors, premature EOF, and abort, preserving typed capacity failures and forwarding caller callbacks. Completion settles the promise and removes the abort listener; a later abort cannot invalidate a completed turn. Completion also preserves the terminal generation and server-provided history for JSON fallback, done-only SSE, and streams whose final answer differs from partial deltas.Validation:
_allregression fails before the fix.make generate,make fmt, andgit diff --checkpass. The embedded Antfarm bundle was rebuilt after the SDK changes and is current (index-CzrJXyaN.js).0c0a2eda8.b6dd12a9aReleaseFast + Metal build passed 27/27 steps. Its fresh-data quickstart passed through image search but RAG completed with zero hits and an apology, exposing the omitted-field parser gap above. The exact0c0a2eda8ReleaseFast + Metal build passed 27/27 steps (20m41s), and the unchanged fresh-data local CLI/cURL quickstart passed end to end at the documented 8192 MiB budget. Both real Gemma RAG commands returned five evidence hits, nonempty generation, exactly one terminal completion and no SSE error (CLI 22.626s, cURL 19.770s). Optional query planning passed; the missing-generator command correctly exited 1. Both standalone processes stopped with exit 0.make generateandmake fmtpass again.7fee6e39b: it now parses the published retry schema and checks a positiveRetry-After. Repaired surrounding query-builder tests to parse raw query JSON before inspecting fields. All 113 selected query-builder and capacity-response tests pass with zero leaks; Zig formatting and diff checks pass. This follow-up (90b90b365) changes tests only.10da5e326conversion fix passes all twelve controls in both phases (24 HTTP requests against real storage). The ReleaseFast regression build passes 11/11 steps; the test passes with zero leaks. Python lint/formatting, Zig formatting and diff checks pass. The new standalone E2E case reproduced the failure against the retained binary and will run against the new binary in CI; a new full real-model quickstart run is not claimed.0c0a2eda8. Follow-ups through7fee6e39bhave targeted failure-path/chunker/SDK validation (including four final-answer/history cases); a new full real-model quickstart run is not claimed for this follow-up. SDK CI passed on0c0a2eda8; CI will rerun for the new head.Previously indexed data needs its full-text index rebuilt or documents reindexed to populate missing
_allpostings; existing segments are not migrated. The rerun uses the unchanged guide and its 8192 MiB budget, with model artifacts downloaded and validated in the preceding cold-store run. That earlier run confirmed the #664 scratch failure no longer reproduced, but RAG returned zero hits and an apology before this default-field fix.An independent user-provided replay on
7fee6e39balso passed the unchanged local CLI workflow with real Gemma, five RAG evidence hits, a terminal completion and no capacity error. It reproduced the separate query-string AND failure addressed by this follow-up. Retrieval relevance, agent query refinement and previously indexed-data migration qualification remain outside that execution pass.