Forward-merge release/0.6 into main#471
Merged
Merged
Conversation
#### Overview Restore the active task's Python scope stack before every context-sensitive native lifecycle call. This prevents concurrent asyncio tasks from closing scopes or invoking tool/LLM middleware against a sibling task's stack. - [x] I confirm this contribution is my own work, or I have the right to submit it under this project's license. - [x] I searched existing issues and open pull requests, and this does not duplicate existing work. #### Details - Centralize ContextVar-to-native stack synchronization in a private helper. - Apply synchronization to scope, tool, and LLM lifecycle wrappers, including managed and streaming execution. - Close context-manager scopes through the synchronized `pop()` wrapper. - Add concurrent asyncio regressions for scope cleanup, middleware isolation, lifecycle helpers, and event ancestry. #### Where should the reviewer start? Start with `python/nemo_relay/_context.py`, then `python/tests/test_context_isolation.py` for the concurrent task coverage. #### Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to) - Fixes RELAY-497 ## Summary by CodeRabbit * **Bug Fixes** * Improved scope and context handling for concurrent operations. * Ensured tool and LLM lifecycle events remain associated with the correct task. * Improved cleanup when scoped operations complete, including status metadata handling. * **Tests** * Added coverage for concurrent tool and LLM operations. * Added validation for task-local scope restoration and event ancestry. Authors: - Will Killian (https://github.com/willkill07) Approvers: - Maryam Najafian (https://github.com/mnajafian-nv) URL: #462
Author
|
SUCCESS - forward-merge complete. |
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.
Forward-merge triggered by push to release/0.6 that creates a PR to keep main up-to-date. If this PR is unable to be immediately merged due to conflicts, it will remain open for the team to manually merge. See forward-merger docs for more info.