Skip to content

fix: bound chunk overlap and preserve generation capacity errors - #664

Merged
ajroetker merged 2 commits into
mainfrom
fix/chunker-overlap-capacity
Sep 8, 2026
Merged

fix: bound chunk overlap and preserve generation capacity errors#664
ajroetker merged 2 commits into
mainfrom
fix/chunker-overlap-capacity

Conversation

@ajroetker

@ajroetker ajroetker commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Fixed-text overlap searched normalized decoded tokens in the original source. When case or punctuation differed, a failed match retained the entire previous chunk, producing growing embedding inputs and scratch contention during local RAG.

Use tokenizer byte offsets for overlap, validate the independently tokenized suffix, and count assembled source spans including separators. Reduce or omit overlap when the next section needs the room. Reuse validated candidate token counts on both the normal and overlap paths to avoid duplicate tokenization. Tokenizer errors propagate instead of retaining a prefix.

Preserve explicit retryable MODEL_RESOURCE_BUSY HTTP 503 responses as GenerationCapacityUnavailable through both the local HTTP provider and in-process JSON generation bridge. Carry the error through the stable runtime ABI, return retryable RAG SSE/JSON failures, and return HTTP 503 with retry guidance for query planning. Permanent or malformed provider failures retain their existing generic failure behavior.

Validation:

  • 13 chunker tests pass; all three new regressions fail against the original implementation.
  • 36 generation/provider tests, 11 retrieval SSE tests, 8 runtime error ABI tests, and 95 standalone runtime tests pass.
  • Live and buffered SSE capacity failures preserve retryability and emit no terminal done event.
  • Formatting and git diff --check pass.
  • Full ReleaseFast + Metal production build was interrupted before completion and has no passing result yet.

The retained quickstart dataset/model directory from the report is not available on this machine, so the complete real-model quickstart has not been replayed. Existing materialized chunks are not migrated by this change.

@ajroetker
ajroetker merged commit fea3e66 into main Sep 8, 2026
15 of 17 checks passed
@ajroetker
ajroetker deleted the fix/chunker-overlap-capacity branch September 8, 2026 19:21
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.

1 participant