You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Blocking I/O in AsyncConsoleEventProcessor halts the event loop #2110
The AsyncConsoleEventProcessor.process_event method uses the synchronous, blocking functions input() and getpass.getpass() directly within an async function. This causes the entire asyncio event loop to halt until the user provides input. As a result, any other concurrent tasks are frozen, which negates the benefits of using an asynchronous architecture.
Additionally, there is a logical flaw in the method: after calling getpass.getpass(), the result is immediately overwritten by the subsequent result = input(prompt) call, rendering the password input functionality non-operational.
Steps to reproduce
Configure an agent to use the AsyncConsoleEventProcessor.
Create and run a separate, simple async task concurrently with the agent's execution (e.g., a coroutine that prints a message every second).
Trigger an InputRequestEvent in the agent, either for a password or regular input.
Observe that while the application is waiting for the user's input in the console, the concurrent task (the ticking clock) completely stops executing. It only resumes after the input is submitted.
Model Used
Not applicable. This is an issue with the core event processing logic, independent of any specific model.
Expected Behavior
When the AsyncConsoleEventProcessor awaits user input, the asyncio event loop should not be blocked. Other concurrent async tasks should continue to run in the background. The user input should be handled in a way that is non-blocking to the main event loop, for instance by running the blocking input() call in a separate thread.
Furthermore, the logic should correctly handle password prompts, capturing the result from getpass.getpass() without overwriting it.
Screenshots and logs
Not applicable, as this is a behavioral bug related to the execution model rather than a visual or logged error.
Activity
Merge branch 'main' into ag2aigh-2110