Skip to content

fix(agentchat): avoid UserInputManager event-order deadlock#7791

Open
White-Mouse wants to merge 1 commit into
microsoft:mainfrom
White-Mouse:codex/fix-user-input-manager-event-order
Open

fix(agentchat): avoid UserInputManager event-order deadlock#7791
White-Mouse wants to merge 1 commit into
microsoft:mainfrom
White-Mouse:codex/fix-user-input-manager-event-order

Conversation

@White-Mouse
Copy link
Copy Markdown

Summary

Fix a Console / UserInputManager event-order race where Console can receive UserInputRequestedEvent before 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 -q
  • uv run ruff check packages/autogen-agentchat/src/autogen_agentchat/ui/_console.py packages/autogen-agentchat/tests/test_userproxy_agent.py
  • uv run python -m py_compile packages/autogen-agentchat/src/autogen_agentchat/ui/_console.py packages/autogen-agentchat/tests/test_userproxy_agent.py
  • git diff --check

@White-Mouse White-Mouse force-pushed the codex/fix-user-input-manager-event-order branch from 5c572a5 to b0bdf44 Compare June 2, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant