perf(cli): truncate large debug logs and limit message history#18663
perf(cli): truncate large debug logs and limit message history#18663mattKorwel merged 5 commits intomainfrom
Conversation
Summary of ChangesHello @mattKorwel, 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 enhances the stability and performance of the Gemini CLI, particularly when operating in debug mode. By introducing intelligent truncation mechanisms for excessively large log messages and output data, and by capping the historical record of debug messages, the changes effectively mitigate memory consumption issues. This ensures a more robust and responsive user interface, preventing crashes that could arise from overwhelming the system with verbose debug information. 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
|
|
Size Change: +670 B (0%) Total Size: 23.9 MB ℹ️ View Unchanged
|
| ? payload.chunk | ||
| : new TextDecoder().decode(payload.chunk); | ||
|
|
||
| const MAX_OUTPUT_CHUNK_LENGTH = 10000; |
There was a problem hiding this comment.
nit: add a helper for this string truncation logic
| state: ConsoleMessageItem[], | ||
| action: Action, | ||
| ): ConsoleMessageItem[] { | ||
| const MAX_CONSOLE_MESSAGES = 1000; |
There was a problem hiding this comment.
nit: move const to the top level.

Summary
This PR fixes memory bloat and potential OOM crashes when running the Gemini CLI with the
--debugflag enabled. It introduces truncation for large console logs and output chunks, and limits the total number of debug messages stored in the UI.Details
ConsolePatcher(capped at 10,000 characters).useConsoleMessageshook (capped at 10,000 characters).useConsoleMessagesreducer.Related Issues
Related to the out-of-memory error crashes reported during session.
How to Validate
--debugflag.npm run testor reading large files).Pre-Merge Checklist