fix(plan): keep approved plan during chat compression#21284
Conversation
Summary of ChangesHello, 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 the system would lose context of an approved implementation plan during chat history compression. By explicitly instructing the model to preserve plan details like file path, step completion, and user feedback, the agent can maintain its progress and avoid redoing work, significantly improving the continuity and efficiency of long-running tasks. 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
This pull request implements a mechanism to preserve the state of an approved plan during chat history compression by modifying the prompt provider to pass the plan path and updating prompt snippets. However, a prompt injection vulnerability was identified in getCompressionPrompt in both snippets.ts and snippets.legacy.ts. The approvedPlanPath is directly interpolated into the prompt string without sanitization, which could allow manipulation of the LLM's behavior if a malicious path is provided. It is recommended to properly escape or quote the path, or use returnDisplay if the path is for display purposes, to prevent such injections.
|
Size Change: +474 B (0%) Total Size: 26 MB ℹ️ View Unchanged
|
15867e6 to
8286e27
Compare
8286e27 to
731da3e
Compare
a70d5d0 to
f19058f
Compare
f19058f to
b25627b
Compare
jerop
left a comment
There was a problem hiding this comment.
lgtm to me, looping in IQ workstream
abhipatel12
left a comment
There was a problem hiding this comment.
LGTM, thanks for adding!
Summary
This PR ensures that approved implementation plans are preserved during chat history compression. When the conversation history grows too large and needs to be distilled into a
<state_snapshot>, the model is now explicitly instructed to keep the plan's file path, step completion status, and any relevant user feedback.Details
PromptProviderto retrieve and pass the approved plan path (if any) to the history compression prompt.snippets.ts) and legacy (snippets.legacy.ts) compression prompts to include a new### APPROVED PLAN PRESERVATIONsection when a plan is active.Related Issues
Fixes #17796
How to Validate
### APPROVED PLAN PRESERVATIONsection.npm test -w @google/gemini-cli-core -- src/prompts/promptProvider.test.tsPre-Merge Checklist