-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix/tool confirmation parsing #3656
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @akos-sch, 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 bug in the tool confirmation processing logic. Previously, payloads from the ADK web client containing nested 'response' keys would cause parsing errors, preventing proper tool confirmation. The changes introduce a robust parsing mechanism to correctly extract and validate the actual confirmation data, thereby ensuring that tool confirmations are handled reliably and tools can resume execution as expected. 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 effectively addresses the tool confirmation parsing issue by introducing a helper function, _parse_tool_confirmation_payload, to handle arbitrarily nested response wrappers and decode the final JSON string. The implementation is clean and robust. The addition of the test_request_confirmation_processor_doubly_wrapped_response unit test is excellent, as it specifically validates the fix and prevents future regressions. The overall code quality is high. I have one suggestion to add type hints to the new helper function for improved maintainability and consistency.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
Problem:
Tool-confirmation payloads coming from the ADK web client arrive with redundant
responsewrappers (e.g.,{"response":{"response":"{\"confirmed\":false,...}"}}). The processor treated the payload as already-decoded JSON, so it passed a dict/string mix directly intoToolConfirmation.model_validate, causing confirmation handling to fail.Solution:
Replaced
request_confirmation.pywith the provided version that introduces_parse_tool_confirmation_payload, which strips any number of nestedresponsekeys and JSON-decodes the innermost string before validation. Addedtest_request_confirmation_processor_doubly_wrapped_responseto ensure confirmations resume correctly when the client sends doubly wrapped payloads.Testing Plan
Unit Tests:
Manual End-to-End (E2E) Tests:
Suggested steps:
make playgroundHERE>>>payload dump and confirmations propagate back.Checklist
Additional context
None.