Repository navigation
fix(rag): wait visibly on a busy embedder instead of resending batches - #5348
Conversation
|
Verdict: Approve with suggestions When the GPU is shared, indexing a document no longer sits silent for about nine minutes per batch before failing with "reinstall the model" advice. Each batch is now sent once and waits up to 300 s. While it waits, the "still indexing" message says the embedder is slow, not stuck. A timeout now tells the user to wait and retry. I traced how a timeout travels from the HTTP layer up to the new "busy" flag, and it is classified correctly (it is not mistaken for "server unreachable"). Nothing blocks the merge. Two small things worth fixing:
Real-world evidenceN/A: no evidence bundle was produced for this run. This change touches an internal RAG path, and the only user-visible part is text in tool results. The verdict rests on static review alone. I could not run the PR's test plan here either, because this runner has no 🔍 Technical detailsIssues 🟢 Doc overstates "never resent" ( 🟢 Checked and fine
Strengths
|
…atches Under GPU contention a document's embedding batch was tried three times at 180 s each, with only a log warning in between: about nine minutes of silence per batch, the same work queued twice more on a GPU already too busy to finish it once, then a generic "embedding model failed" with advice to reinstall it. Each batch is now sent once with a 300 s wait. While it waits, the background index job reports how long, and the tool tells the user the GPU is busy and indexing is queued. A timed-out batch raises a busy error whose next step is "wait, then retry", not "run gaia init". Malformed replies, server errors and an unreachable server fail on the first try. Only two cases are tried again, both logged: an embedder still loading (no vectors back, three tries) and one reloaded with too small a batch (reloaded once).
Review follow-ups. The wait and busy messages blamed the GPU, but on ROCm machines the embedder runs on the CPU, so the model would tell users something false about their hardware. A reply that wasn't a dict, or whose items weren't, escaped as a raw AttributeError instead of an embedding error with its next step; and a 200 carrying an error envelope was waited out three times as a "still loading" embedder. Both now fail at once with the backend's own error text when it sent one.
A wait-reporting callback that raised after a timed-out batch would have replaced the busy-embedder error. The wait is now cleared only once the batch answers. The troubleshooting page no longer says a batch is never resent; it is not resent after a timeout.
9c61851 to
3bacbe1
Compare
Resolves conflicts with amd#5336, amd#5348 and amd#5359, and makes the additions this PR owes as the second to land: - _preflight_load keeps amd#5336's re-raise of InsufficientMemoryError and ModelInUseError, and adds `except LeaseWaitCancelled` ahead of its catch-all, so a stopped queued wait is not reported as a failed load. - The chat title's lease runs under lease_wait_limit(30), so a title gives up instead of holding a worker thread behind a long queue. - Background indexing keeps amd#5348's embedder wait callback inside detached_from_turn. - broker.py keeps both _renewed_at and amd#5359's _last_activity; a reclaim stamps _last_activity. Review follow-ups: an unreadable queue-stream line is a BrokerUnavailableError naming the daemon instead of a raw parse error, and a test pins the email translator's copy of _QUEUE_FIELDS to the core one.
When the GPU was busy with another session's model, indexing a document went silent for about nine minutes per batch of chunks. Each batch was tried three times at 180 s, with only a log warning between tries, and the same work was queued again on hardware already too busy to finish it once. Then indexing failed with advice to reinstall the embedding model. Now each batch is sent once and waits up to 300 s. While it waits, the still-indexing message says the embedding model is slow because it is sharing the GPU or CPU. A timeout now says "busy, wait and retry" instead of "run gaia init".
Reproduced by
tests/unit/rag/test_embedding_retry_policy.py; it fails on main and passes here.🔍 Technical details
RAGSDK._encode_texts, a timed-out batch is not resent; it raisesEmbeddingUnavailableErrorwith a newbusyflag.index_document(..., wait_callback=)reports every 15 s how long the current batch has waited, and reports 0 when it answers. The background index job from fix(rag): stop big documents from hanging index_document until timeout #4754 (Indexing a very large PDF runs past the 10-minute tool limit and is abandoned #4744) shows this in its in-progress result asembedder_wait_seconds.call_count == 3); they now assert one send.next_stepfor search and indexing. Category to watch in the next RC eval:rag_quality.Test plan
python -m pytest tests/unit/rag/ tests/unit/test_rag*.py tests/unit/test_indexed_docs_per_turn.py tests/test_rag.py -q