-
Notifications
You must be signed in to change notification settings - Fork 303
fix: null-pointer when message send configuration is provided with no history limit #536
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
fix: null-pointer when message send configuration is provided with no history limit #536
Conversation
Summary of ChangesHello @yarolegovich, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical null-pointer exception that could arise during message processing when the history length configuration was not explicitly defined. By implementing a robust check for the presence of a history limit, the change enhances the stability and reliability of the message sending mechanism, preventing unexpected application crashes in such scenarios. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request addresses a potential null pointer issue when message send configuration is provided without a history limit, and adds a new test case to cover this scenario. The fix in default_request_handler.py is effective, but the added condition is redundant as the called function apply_history_length already handles the None case gracefully. I've suggested a simplification to avoid this redundancy. Additionally, I've proposed a more descriptive name for the new test to improve clarity.
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.
While this change is intended to fix a null-pointer issue, the check for params.configuration.history_length is not None appears to be redundant. The apply_history_length function already includes a check for history_length is not None and safely handles the case where it is None by returning the task unmodified.
To avoid duplicating this logic and to keep the code cleaner, it would be better to rely on apply_history_length to handle this. This centralizes the logic for handling history_length values.
| if params.configuration and params.configuration.history_length is not None: | |
| if params.configuration: |
| task_store = InMemoryTaskStore() | ||
| push_store = InMemoryPushNotificationConfigStore() | ||
|
|
||
| request_handler = DefaultRequestHandler( |
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.
This is a great test case to ensure that a None value for history_length doesn't truncate the history. For better readability, consider renaming the test to be more descriptive of its purpose. For example: test_on_message_send_with_none_history_length_is_not_limited.
| async def test_on_message_send_limit_history_non_as_no_limit(): | |
| async def test_on_message_send_with_none_history_length_is_not_limited(): |
Head branch was pushed to by a user without write access
Fixes a null pointer when message send configuration is provided with no history limit.