Python: Fix deadlock in Magentic workflow - #1325
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a deadlock issue in the Magentic workflow by removing thread synchronization mechanisms and adding proper test coverage for the reset functionality.
Key changes:
- Removed the asyncio.Lock from the orchestrator executor to prevent deadlocks since executors are not designed to be thread-safe
- Added a test to verify that stall and reset mechanisms work correctly
- Cleaned up unnecessary context initialization code
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| python/packages/core/agent_framework/_workflows/_magentic.py | Removed the inner loop lock and associated synchronization code, renamed helper method |
| python/packages/core/tests/workflow/test_magentic.py | Added test class and test function to verify stall/reset functionality works properly |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Eric Zhu (ekzhu)
approved these changes
Oct 8, 2025
Contributor
Victor Dibia (victordibia)
approved these changes
Oct 8, 2025
Reuben Bond (ReubenBond)
pushed a commit
to ReubenBond/agent-framework
that referenced
this pull request
Oct 28, 2025
* Fix deadlock in Magentic workflow * Fix unit test
Aris Nguyen (arisng)
pushed a commit
to arisng/agent-framework
that referenced
this pull request
Feb 2, 2026
* Fix deadlock in Magentic workflow * Fix unit test
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.
Motivation and Context
Fix #1222
Description
Contribution Checklist