fix(embeddings): make the HTTP lane read timeout configurable - #5776
Open
MummIndia wants to merge 1 commit into
Open
fix(embeddings): make the HTTP lane read timeout configurable#5776MummIndia wants to merge 1 commit into
MummIndia wants to merge 1 commit into
Conversation
The 10s read budget holds for a warm endpoint — embedding a short string does return in well under a second, as the comment says. But the FIRST call after a cold start also pays for loading the embedding model into memory, and on a modest or busy machine that is comfortably past 10s. The failure is silent, which is the part worth fixing. The timeout fires, the lane produces no vectors, its collection stays empty, and retrieval degrades to whatever other lane happens to be populated. Nothing marks the endpoint as the cause, so the symptom shows up much later as poor retrieval quality rather than as an embedding error — in our case French queries ranking badly because only the English-only fallback lane had any content. Adds EMBEDDING_TIMEOUT alongside the existing EMBEDDING_BATCH_SIZE and EMBEDDING_MAX_CHARS, floored at 1s. The default is unchanged at 10s, so nothing moves for existing installs; a slow first load can now be given room without patching. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Summary
The 10s read budget holds for a warm endpoint — embedding a short string does return in
well under a second, as the comment says. But the FIRST call after a cold start also
pays for loading the embedding model into memory, and on a modest or busy machine that
is comfortably past 10s.
The failure is silent, which is the part worth fixing. The timeout fires, the lane
produces no vectors, its collection stays empty, and retrieval degrades to whatever
other lane happens to be populated. Nothing marks the endpoint as the cause, so the
symptom shows up much later as poor retrieval quality rather than as an embedding error
— in our case French queries ranking badly because only the English-only fallback lane
had any content.
Adds
EMBEDDING_TIMEOUTalongside the existingEMBEDDING_BATCH_SIZEandEMBEDDING_MAX_CHARS, floored at 1s. The default is unchanged at 10s.Target branch
dev, notmain.Linked Issue
Fixes #5775
Type of Change
Checklist
devdocker compose up) and verified the change works end-to-end.How to Test
Point the HTTP embedding lane at a local endpoint whose model is not resident, so the
first call must load it.
Before — the lane's collection stays at 0 entries with no error logged, and
retrieval silently uses the other lane.
Set
EMBEDDING_TIMEOUT=60and reindex. The lane populates.Confirm the default and the floor:
Visual / UI changes
None.
src/embeddings.pyonly — an HTTP client timeout.