fix(interactions/events):fixed response duplication and added turn_complete check to is_final_response()#4416
Conversation
Summary of ChangesHello @DineshThumma9, 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 addresses critical issues related to response handling in the interactions module. It resolves a problem where responses were being duplicated after a migration to interactions by removing an unnecessary aggregated response generation step. Additionally, it refines the logic for determining a final response by incorporating a Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
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.
Code Review
This pull request effectively addresses the response duplication issue in streaming mode and corrects the logic for is_final_response(). The changes are clear and well-supported by the new unit tests. I've left a couple of minor suggestions in the test file to improve code style by moving local imports to the top level.
12297f2 to
0a2fed5
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request addresses response duplication and improves the final response detection when using the interactions API. The changes correctly incorporate the turn_complete flag in is_final_response() and remove logic that caused duplicate final messages. The accompanying unit tests are well-designed to cover these fixes. I've identified a critical issue with a missing import in the new tests that will prevent them from running, and a minor maintainability issue with a redundant import. My comments provide details on how to resolve these.
0a2fed5 to
70e0eb6
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request addresses an issue with response duplication in streaming mode when using the interactions API. The fix involves removing a redundant final response yield and correctly using the turn_complete flag in is_final_response(). The changes are logical and well-supported by new unit tests that verify the fix. Overall, this is a good change. I have one suggestion to refactor one of the new tests to be more concise and maintainable using pytest.mark.parametrize.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
Problem:
After Migration to interactions response was getting duplicated and also is_final_response isn't using turn complete for deciding final response
Solution:
Removed aggregated message as interaction.update was taking care of final response and added turn_complete to is_final_response()
Testing Plan
Please describe the tests that you ran to verify your changes. This is required
for all PRs that are not small documentation or typo fixes.
Unit Tests:
Please include a summary of passed
pytestresults.Manual End-to-End (E2E) Tests:
Please provide instructions on how to manually test your changes, including any
necessary setup or configuration. Please provide logs or screenshots to help
reviewers better understand the fix.
Checklist
Additional context
Add any other context or screenshots about the feature request here.