Skip to content

fix(ai): retry a Qdrant request after a 429, 502, 503 or 504 answer - #6761

Merged
dan-petty merged 5 commits into
mainfrom
fix/6757-qdrant-retry-gateway-errors
Nov 22, 2026
Merged

dan-petty merged 5 commits into
mainfrom
fix/6757-qdrant-retry-gateway-errors

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

A Qdrant request gets a retry after an answer with the status 429, 502, 503 or 504. Before, one 502 (Bad Gateway) from the proxy in front of Qdrant stopped a full devops ai rag index run: qdrant-client raises UnexpectedResponse, and the client counted it as permanent.

  • _is_transient_qdrant_error decides an UnexpectedResponse by its status alone, with the table _RETRY_STATUSES. Each other status, such as 400, 408 or 500, ends the operation at once.
  • _execute_with_retry does not change: a gateway answer gets the backoff and attempt limit of a transport error.
  • serving_qdrant can answer with an error status and an HTML body. docs/TESTING.md states it.
  • httpx retries only a failed connect, and qdrant-client retries only in upload_points, each error with time.sleep.

Closes #6757

Change: openspec/changes/archive/2026-11-22-6757-qdrant-retry-gateway-errors/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/ai AI review pipeline, personas, prompts, LLM client, or RAG labels Nov 22, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Review points for the owner:

  • Pending a person: review the diff in tuicr (tuicr -r origin/main..HEAD).
  • 408 is now permanent. On the base, a 408 (Request Timeout) and a 504 (Gateway Timeout) got a retry only because their reason phrases hold the word "Timeout". This PR lets the status alone decide, as the issue asks ("every other status stays permanent"). So a 408 now ends the operation at once, as in the read policy of src/devops_cli/http/retry.py. A 504 still gets a retry, now by its status.
  • A 429 with a Retry-After header is not covered. qdrant-client 1.20.0 raises ResourceExhaustedResponse (a QdrantException, not an UnexpectedResponse) for it, so it stays permanent. A correct retry of it waits the Retry-After time, not the backoff of _execute_with_retry. I filed no issue: no run has shown it. Tell me if you want one.
  • Stale spec found: the requirement qdrant-retry-wait-uses-clock-seam in rag-lookup-pause names tenacity and a third wait of 1.5 s, which the code does not have. I filed docs(openspec): the Qdrant retry spec names tenacity and a third wait #6762 for it; it depends on this PR.

@dan-petty
dan-petty force-pushed the fix/6757-qdrant-retry-gateway-errors branch from f66df38 to da13db7 Compare November 22, 2026 13:07
@dan-petty
dan-petty marked this pull request as ready for review November 22, 2026 13:15
@dan-petty
dan-petty merged commit a406980 into main Nov 22, 2026
30 checks passed
@dan-petty
dan-petty deleted the fix/6757-qdrant-retry-gateway-errors branch November 22, 2026 13:16
dan-petty-release Bot added a commit that referenced this pull request Nov 22, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.194.0](v0.193.1...v0.194.0)
(2026-11-22)


### Features

* **roadmap:** run the runner Job as three containers
([#6732](#6732))
([97d6bc7](97d6bc7)),
closes [#3700](#3700)


### Bug Fixes

* **ai:** retry a Qdrant request after a 429, 502, 503 or 504 answer
([#6761](#6761))
([a406980](a406980))
* **deps:** pin the devtools image in its run tag form
([#6763](#6763))
([4735538](4735538)),
closes [#6760](#6760)
* **k8s:** Scrape the SearXNG engine metrics
([#6755](#6755))
([80fc29d](80fc29d))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/ai AI review pipeline, personas, prompts, LLM client, or RAG type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ai): retry a Qdrant call after a 502, 503 or 504

1 participant