Repository navigation
linearize-chat-compression-history-reconstruction - #29512
harshitgupta31415 wants to merge 1 commit into
Conversation
|
📊 PR Size: size/M
|
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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 optimizes the chat history compression service by refactoring how message parts are reconstructed. By switching from expensive front-of-array insertions to end-of-array pushes followed by a single reversal, the service achieves better computational efficiency while maintaining the required message ordering and token-budget priority. 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 updates truncateHistoryToBudget in chatCompressionService.ts to use push and a final reverse instead of repeated unshift operations, ensuring correct message and part ordering during history truncation. It also adds corresponding unit tests in chatCompressionService.test.ts to verify order preservation and error handling behavior. There are no review comments to evaluate, and the changes appear correct and well-tested.
|
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 only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding. |
Replaced repeated
unshift()calls withpush()and a final reversal. This avoids repeatedly moving array elements while preserving message order and newest-first token-budget priority.In a local benchmark, 10,000 mixed messages took 5.01 ms instead of 18.97 ms. This measures the helper only, excluding model calls and file I/O.
All 39 compression tests, package builds, ESLint, formatting and core TypeScript checks passed. Full preflight stopped at a missing Windows
grepcommand; YAML lint passed when run directly.Fixes #29511.