Repository navigation
Conversation
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/unstructured_client/utils/retries.py">
<violation number="1" location="src/unstructured_client/utils/retries.py:94">
P3: This exception list misses `httpx.StreamConsumed` and `httpx.StreamClosed`, so a matching streamed response that was consumed or closed before inspection becomes a permanent error and skips the existing status retry. Treat these unavailable-body exceptions like `ResponseNotRead` and return `False`.</violation>
</file>
Shadow auto-approve: would not auto-approve because issues were found.
View guided diff | Re-trigger cubic
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.
What
The client stops retrying an API error whose response body says it can't succeed on a retry. Today every 5xx is retried until the retry budget runs out, even when the server has already declared that resending the same request will fail the same way.
With the platform's retry settings (20s initial, 90s cap, 300s budget):
{"detail": …, "retryable": false, …}{"detail": …, "retryable": true, …}{"detail": "Internal server error"}(no verdict)"retryable": "false"(string), unparsableThe same check covers the split-PDF path. A chunk that gets a declared non-retryable 5xx is sent once instead of using up its own per-chunk retry budget.
Why
The Unstructured API publishes its own verdict next to
detailon errors it raises deliberately:error_type,audience,retryableanderror_reason. An OCR (Tesseract) timeout, for example, answers 503 withretryable: false. The same image re-sent to the same time budget times out again. The retry loop matches on status before any caller can read the body, so no caller can act on that verdict. In production, one Transform record received 12 HTTP 500s across two dispatches over 670s. Attempt-6 retry markers are 98.6% as common as attempt-1 markers, so these failures do not recover on retry.The retry loop is the one place that both whole-document requests and split-PDF chunk requests pass through. A caller-side hook can't reach the split-PDF chunks, because the split hook sends them through its own HTTP client. The check only ever stops a retry. A declared
retryable: truenever makes a status retryable that wasn't already.retries.pyalready carries hand edits (#342).gen.yamlhaspersistentEditsenabled.Notes for consumers
"retryable": falsechanges behaviour. An unread streamed response is never consumed; it keeps status-based retries.Validation
make lintis clean (pylint 10/10, mypy).partition/partition_asyncthrough a mocked transport.RecursionErroron a deeply nested body) is fixed.