Raise TaskFailedError from gather when a task exhausts retries#17
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LC1fRUucUMCBWKwJFtq5YE
Previously a permanently failed task left its result key empty, so ax.gather and ax.get_result polled until their timeout (default 300s) and raised a generic TimeoutError. Now the pool writes a TaskFailure record to the result key when it gives up on a task, and get_result raises ax.TaskFailedError (task_name, agent_id, error, attempts) on the next poll. gather propagates the first failure via asyncio.gather; other tasks keep running and their results remain retrievable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LC1fRUucUMCBWKwJFtq5YE
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
TaskFailurerecord (task name, agent id, error, attempt count) to the task's result key, following the same key/serialize/set convention as the success path.ax.get_resultrecognizes the record on its next poll and raisesax.TaskFailedErrorwithin ~0.5s, instead of polling into the void and raising a genericTimeoutErrorafter the full timeout (default 300s).ax.gatherpropagates the first failure viaasyncio.gather— a single fail-fast contract, noreturn_exceptionspath. Remaining tasks keep running in their workers and their results stay retrievable, so re-gathering survivors resolves finished tasks instantly.TaskFailedErroris exported on theaxnamespace.Design notes
agent_id, so the failure record can only land after the retry budget is truly spent — a retry that succeeds still writes a normal result to the same key.Testing
get_resultraisesTaskFailedErrorwith the full field set on the first poll (no timeout wait).gatherpropagates a failure among successful tasks.backend.deserialize.🤖 Generated with Claude Code
https://claude.ai/code/session_01LC1fRUucUMCBWKwJFtq5YE