-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure asyncio event queue is drained prior to CLI termination #1163
Conversation
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Reviewer Guide 🔍
|
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Code Suggestions ✨
|
I don't want to wait 30 additional seconds each time I run the CLI. |
It doesn't take an additional 30 seconds to run the CLI - it terminates as soon as the extra tasks complete. The 30 second timeout was a defensive guard to prevent the CLI from hanging in case something went wrong. |
@MarkRx i suggest a one-liner: and also add if litellm.enable_callbacks: |
48822c0
to
93773f3
Compare
User description
The LiteLLM library may add events to the asyncio event queue from a LLM execution (such as to run event handlers from callbacks). If the CLI terminates before these events run the agent may crash with
asyncio.exceptions.CancelledError
.This change gives the CLI a little extra time to ensure the event queue is completed before terminating. The timeout is hard coded to reduce configuration sprawl but could be a configuration option if desired. If there are no extra events then the CLI terminates immediately.
See BerriAI/litellm#5293 (comment)
PR Type
Bug fix, Enhancement
Description
Changes walkthrough 📝
cli.py
Implement asyncio event queue draining mechanism
pr_agent/cli.py
get_logger
function from pr_agent.loginner()