-
Notifications
You must be signed in to change notification settings - Fork 11.1k
feat(core): implement persistence and resumption for masked tool outputs #18451
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
Conversation
This PR enables the synchronization of masked tool outputs to the session history, ensuring that automatic and manual masking updates are persisted to disk and correctly resumed in future sessions. It also fixes a bug where masked outputs were resumed as plain text parts, breaking the tool-use trajectory and stripping multi-modal data.
Summary of ChangesHello @abhipatel12, 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 significantly improves the robustness of the chat recording service by implementing comprehensive persistence and resumption for masked tool outputs. It addresses critical synchronization issues, ensuring that the full history, including sensitive masked data and multi-modal content, is accurately saved to and loaded from session files, thereby maintaining the integrity of the conversation trajectory. 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.
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 implements history synchronization for masked tool outputs, ensuring they are persisted and resumed correctly. The changes are well-structured and include relevant tests. I've identified one critical issue in the history processing logic that could lead to data loss if API response parts are not ordered as expected. My feedback includes a code suggestion to make this logic more robust.
|
Size Change: +1.82 kB (+0.01%) Total Size: 23.8 MB
ℹ️ View Unchanged
|
Summary
This PR implements history synchronization for observation masking, ensuring that masked tool outputs are tracked, persisted to session files, and correctly resumed.
Details
GeminiChat.setHistoryto persist the message history to disk whenever it is updated. This ensures that any masked content (stored in memory) is mirrored in the session history file.ChatRecordingServiceto correctly synchronize in-memory history when manual masking updates occur.functionResponseparts, which preserves the model's tool-use trajectory and multi-modal content (like images).inlineData) within tool results is preserved when a response is updated/masked.Related Issues
Phase 2 of Observation Masking (History Synchronization).
How to Validate
npm run test -w @google/gemini-cli-core -- src/services/chatRecordingService.test.tsto verify persistence and multi-modal preservation.npm run preflightto ensure no regressions..jsonsession history file reflects the masked state and can be resumed correctly.Pre-Merge Checklist