fix(agent): add return_exceptions=True to asyncio.gather in context_references - #58808
Closed
x7peeps wants to merge 1 commit into
Closed
fix(agent): add return_exceptions=True to asyncio.gather in context_references#58808x7peeps wants to merge 1 commit into
x7peeps wants to merge 1 commit into
Conversation
…eferences Without return_exceptions=True, a single failing _expand_reference call cancels all sibling coroutines and propagates the exception up, losing all successful expansions. This is especially problematic when refs include a mix of local files and remote URLs — a network timeout on one URL would kill the entire expansion. With return_exceptions=True, failed refs are caught and added to the warnings list while successful ones still render. This matches the pattern already used in other gather calls in the codebase (e.g. agent learning_graph_render.py).
Contributor
Author
|
Closing as superseded by #59954 (newer version of the same context reference expansion fix). |
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
Add to the call in so that a single failing reference expansion doesn't cancel all sibling coroutines.
Problem
Without , if one call raises (e.g., network timeout on a remote URL, permission error on a local file), the exception propagates immediately and cancels all other in-flight expansions. The agent loses all successfully expanded references.
Fix
Testing