fix(agentchat): avoid UserInputManager event-order deadlock#7791
Open
White-Mouse wants to merge 1 commit into
Open
fix(agentchat): avoid UserInputManager event-order deadlock#7791White-Mouse wants to merge 1 commit into
White-Mouse wants to merge 1 commit into
Conversation
5c572a5 to
b0bdf44
Compare
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
Fix a
Console/UserInputManagerevent-order race whereConsolecan receiveUserInputRequestedEventbefore the wrapped input callback starts waiting for the same request id.In that ordering,
notify_event_received()creates an unset event for the request id. The later callback then finds that existing event and waits forever.Fix
When
notify_event_received()observes a request id before the callback registered its waiter, create the event in the already-set state. This preserves the existing behavior where a registered waiter is set directly, while also handling the event-first ordering.Tests
uv run pytest packages/autogen-agentchat/tests/test_userproxy_agent.py -quv run ruff check packages/autogen-agentchat/src/autogen_agentchat/ui/_console.py packages/autogen-agentchat/tests/test_userproxy_agent.pyuv run python -m py_compile packages/autogen-agentchat/src/autogen_agentchat/ui/_console.py packages/autogen-agentchat/tests/test_userproxy_agent.pygit diff --check