Repository navigation
Fix task result retries after transient errors - #41
Draft
Kayvan-Zahiri wants to merge 1 commit into
Draft
Kayvan-Zahiri wants to merge 1 commit into
Kayvan-Zahiri wants to merge 1 commit into
Conversation
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.
A transient result-fetch error inside
task_run.executereaches a generator context manager that yields again after catching the error. Python raisesRuntimeError: generator didn't stop after throw()instead of repeating the fetch. This affects both sync and async execution once a read timeout or HTTP 408/503/504 escapes the HTTP client's own retries.Run the retry loop around the callable itself, retaining the existing status allowlist, monotonic deadline, and final TimeoutError cause. Remove the invalid context manager and colocate its error helpers with the retry callers. Generated resources and dependency metadata are unchanged.
Tests exercise public sync/async execute through HTTPX MockTransport with the inner HTTP retry disabled, then assert successful recovery. Additional checks cover 429 propagation, expired deadlines without requests, and timeout causes. No live API/account calls.
Validation on Python 3.12:
The repository development lock cannot resolve as written (virtualenv requires a newer filelock than pinned). Used an isolated environment with repository-pinned Pydantic, typing-extensions, type checkers and build backend, plus compatible test tools. Mypy has a typing.TypeAliasType tuple incompatibility under the local 3.12 interpreter; it also reproduces on the untouched baseline. Resource tests requiring the mock API server and the Python/Pydantic version matrix were not run.