-
Notifications
You must be signed in to change notification settings - Fork 55
Add debug logging when creating a new agent #235
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
Conversation
Signed-off-by: Eran Cohen <eranco@redhat.com>
WalkthroughLogging within the agent retrieval logic was updated for greater clarity and traceability. Messages now more explicitly indicate whether an agent is being reused or newly created, and reference conversation IDs directly. No changes were made to control flow or public interfaces; all updates are limited to logging statements. Changes
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/app/endpoints/query.py(2 hunks)src/app/endpoints/streaming_query.py(2 hunks)
🧰 Additional context used
🪛 GitHub Actions: Black
src/app/endpoints/query.py
[error] 1-1: Black formatting check failed. File would be reformatted. Run 'black --write' to fix code style issues.
src/app/endpoints/streaming_query.py
[error] 1-1: Black formatting check failed. File would be reformatted. Run 'black --write' to fix code style issues.
🪛 GitHub Actions: Python linter
src/app/endpoints/query.py
[warning] 84-84: pylint: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
src/app/endpoints/streaming_query.py
[warning] 55-55: pylint: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-pr
🔇 Additional comments (4)
src/app/endpoints/query.py (2)
85-85: LGTM! Enhanced logging clarityThe log message improvement makes it clearer that we're referencing a specific conversation_id rather than a generic key.
101-101: LGTM! Valuable debug information addedThis debug log provides important traceability for when new agents are created along with their conversation_id.
src/app/endpoints/streaming_query.py (2)
56-56: LGTM! Consistent logging enhancementThe log message improvement maintains consistency with the synchronous version and enhances clarity.
71-71: LGTM! Maintains consistency with synchronous versionThis debug log provides the same valuable traceability as the synchronous version, maintaining consistency across both endpoints.
| else: | ||
| logger.debug("No existing agent found for conversation_id: %s", conversation_id) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unnecessary else clause to improve code quality
The else clause after a return statement is unnecessary and flagged by pylint.
Apply this diff to fix the linting issue:
if agent:
logger.debug("Reusing existing agent with conversation_id: %s", conversation_id)
return agent, conversation_id
- else:
- logger.debug("No existing agent found for conversation_id: %s", conversation_id)
+ logger.debug("No existing agent found for conversation_id: %s", conversation_id)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| else: | |
| logger.debug("No existing agent found for conversation_id: %s", conversation_id) | |
| if agent: | |
| logger.debug("Reusing existing agent with conversation_id: %s", conversation_id) | |
| return agent, conversation_id | |
| logger.debug("No existing agent found for conversation_id: %s", conversation_id) |
🤖 Prompt for AI Agents
In src/app/endpoints/query.py around lines 87 to 89, remove the else clause that
follows a return statement because it is unnecessary and flagged by pylint.
Instead, unindent the code inside the else block so it runs directly after the
if block without the else, improving code clarity and lint compliance.
| else: | ||
| logger.debug("No existing agent found for conversation_id: %s", conversation_id) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unnecessary else clause to improve code quality
Same issue as in query.py - the else clause after a return statement is unnecessary and flagged by pylint.
Apply this diff to fix the linting issue:
if agent:
logger.debug("Reusing existing agent with conversation_id: %s", conversation_id)
return agent, conversation_id
- else:
- logger.debug("No existing agent found for conversation_id: %s", conversation_id)
+ logger.debug("No existing agent found for conversation_id: %s", conversation_id)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| else: | |
| logger.debug("No existing agent found for conversation_id: %s", conversation_id) | |
| if agent: | |
| logger.debug("Reusing existing agent with conversation_id: %s", conversation_id) | |
| return agent, conversation_id | |
| logger.debug("No existing agent found for conversation_id: %s", conversation_id) |
🤖 Prompt for AI Agents
In src/app/endpoints/streaming_query.py around lines 58 to 60, remove the else
clause that follows a return statement to improve code quality and fix the
pylint warning. Instead of using else after return, unindent the code inside the
else block so it runs directly after the if block, eliminating the unnecessary
else.
|
PR recreated in #276 , you can close this one |
Description
Add a debug log when creating a new agent
Type of change
Related Tickets & Documents
Checklist before requesting a review
Testing
Summary by CodeRabbit