fix: skip rewound invocations when resuming agent in _find_agent_to_run#4602
fix: skip rewound invocations when resuming agent in _find_agent_to_run#4602rahulmansharamani14 wants to merge 4 commits intogoogle:mainfrom
Conversation
Summary of ChangesHello @rahulmansharamani14, 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 a bug where the agent selection logic in 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
The pull request correctly addresses the issue where rewound invocations were not being skipped during agent selection in _find_agent_to_run. The extraction of the filtering logic into a separate function is a good improvement. I have suggested a few refinements regarding the visibility and performance of the new filtering function to ensure it follows best practices and remains efficient as the conversation history grows.
There was a problem hiding this comment.
Code Review
This pull request introduces a fix to correctly handle rewound invocations when determining the next agent to run. The core change involves filtering out events that have been annulled by a rewind operation before the agent selection logic is executed. This is achieved by introducing a new helper function, filter_rewound_events, which is then used in _find_agent_to_run. The implementation includes refactoring existing rewind logic into this new function and adding comprehensive unit tests to validate the fix. The changes appear correct and well-tested, effectively addressing the described issue.
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):
Testing Plan
Unit Tests:
New tests in
tests/unittests/test_runners.py:test_find_agent_to_run_ignores_rewound_sub_agent_event- verifies that a sub-agent event from a rewound invocation is excluded androot_agentis returned.test_find_agent_to_run_ignores_rewound_function_call- verifies that a rewound function-call/response pair is excluded and does not influence agent selection.Please include a summary of passed
pytestresults.python -m pytest tests/unittests/test_runners.py -v
49 passed in 2.03s
Manual End-to-End (E2E) Tests:
The fix is fully exercised by unit tests. No additional manual E2E setup is required for this targeted bug fix.
Checklist
Additional context
Additional unit tests for _filter_rewound_events and further _find_agent_to_run rewind scenarios are the next planned steps.