Skip to content

Conversation

@akos-sch
Copy link

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 response wrappers (e.g., {"response":{"response":"{\"confirmed\":false,...}"}}). The processor treated the payload as already-decoded JSON, so it passed a dict/string mix directly into ToolConfirmation.model_validate, causing confirmation handling to fail.

Solution:
Replaced request_confirmation.py with the provided version that introduces _parse_tool_confirmation_payload, which strips any number of nested response keys and JSON-decodes the innermost string before validation. Added test_request_confirmation_processor_doubly_wrapped_response to ensure confirmations resume correctly when the client sends doubly wrapped payloads.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.
.venv/bin/pytest tests/unittests/flows/llm_flows/test_request_confirmation.py

Manual End-to-End (E2E) Tests:

Suggested steps:

  1. make playground
  2. Trigger a tool requiring confirmation (e.g., mock confirmation demo).
  3. Approve/reject confirmations and verify the tool resumes without parsing errors.
  4. Confirm logs no longer show the HERE>>> payload dump and confirmations propagate back.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

None.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • Tool Confirmation Parsing Fix: Addressed an issue where tool confirmation payloads from the ADK web client were failing to parse due to redundant 'response' wrappers, causing confirmation handling to fail.
  • New Payload Parsing Helper: Introduced a new private helper function, _parse_tool_confirmation_payload, which intelligently unwraps any number of nested 'response' keys and JSON-decodes the innermost string before validation.
  • Enhanced Unit Testing: Added a new unit test, test_request_confirmation_processor_doubly_wrapped_response, to specifically ensure that the system correctly handles doubly wrapped payloads from the client.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Nov 21, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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>
@ryanaiagent ryanaiagent self-assigned this Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core [Component] This issue is related to the core interface and implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HITL - getting 'TypeError(f'the JSON object must be str, bytes or bytearray, '' in Request Confirmation

3 participants