fix(core): Fix chat corruption bug in context manager.#26534
fix(core): Fix chat corruption bug in context manager.#26534joshualitt merged 2 commits intomainfrom
Conversation
|
Size Change: +1.86 kB (+0.01%) Total Size: 34 MB
ℹ️ View Unchanged
|
f86ff39 to
e9ce4a4
Compare
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 chat corruption issue by refactoring how the ContextManager synchronizes pristine history. By introducing a more robust synchronization mechanism, the system can now better maintain the integrity of the context buffer when dealing with mutated or summarized nodes. Additionally, it improves the rendering pipeline by filtering out preview nodes and refining the detection of legacy environment headers. 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 the 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 counterproductive. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the context management system by replacing separate pruning and appending operations with a unified syncPristineHistory method in the ContextWorkingBuffer. It also introduces a mechanism to filter out preview nodes during the rendering process and improves the detection of legacy environment headers. A critical issue was identified in the syncPristineHistory logic where system-injected nodes might be unintentionally removed during synchronization because they are not part of the authoritative chat history.
SandyTao520
left a comment
There was a problem hiding this comment.
Nice unification of the append/prune logic into a single syncPristineHistory — the chronological re-weave is much easier to reason about than the previous two-step flow, and the multi-root drop semantics look correct. Filtering preview nodes from the rendered Content[] while still letting them participate in budget accounting is a clean fix for the duplicated-message corruption.
A few optional, non-blocking suggestions inline.
SandyTao520
left a comment
There was a problem hiding this comment.
LGTM! Nice unification of the append/prune logic into a single syncPristineHistory — the chronological re-weave is much easier to reason about than the previous two-step flow, and the multi-root drop semantics look correct. Filtering preview nodes from the rendered Content[] while still letting them participate in budget accounting is a clean fix for the duplicated-message corruption.
Thanks for the fix!
3014a42 to
d7748b6
Compare
Fixes #26521