fix(core): sanitize function_response.parts before compression - #19856
fix(core): sanitize function_response.parts before compression#19856Aarchi-07 wants to merge 5 commits into
Conversation
Summary of ChangesHello @Aarchi-07, 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 critical issue where Gemini 3 multimodal data, specifically Highlights
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 Gemini 3 specific multimodal data in tool responses causes the summarizer model to fail. By stripping the nested parts field from function_response before sending history to the summarizer, it prevents session-breaking errors. I've suggested a few improvements to the sanitization logic to ensure type safety, adhere to object construction best practices, and avoid redundant processing of large chat histories.
|
Hi there! Thank you for your interest in contributing to Gemini CLI. To ensure we maintain high code quality and focus on our prioritized roadmap, we have updated our contribution policy (see Discussion #17383). We only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. All other community pull requests are subject to closure after 14 days if they do not align with our current focus areas. For this reason, we strongly recommend that contributors only submit pull requests against issues explicitly labeled as 'help-wanted'. This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding and for being part of our community! |
Summary
Gemini 3 models support nesting multimodal data (
inlineData) insidefunction_response.partsat runtime. When chat history compression triggers, it sends this raw history to a summarizer model that may not support this Gemini-3-specific feature, causing the API to reject the request with:Once this happens, every subsequent turn also triggers auto-compression with the same corrupted history, permanently breaking the session.
Changes
function_response.partsfield before passing history to the summarizergenerateContentcalls (initial summary + verification)Pre-Merge Checklist
Fixes #19853