fix(shell): throttle text output updates to prevent UI jank#25643
fix(shell): throttle text output updates to prevent UI jank#25643ixchio wants to merge 1 commit intogoogle-gemini:mainfrom
Conversation
|
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. |
🛑 Action Required: Evaluation ApprovalSteering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged. Maintainers:
Once approved, the evaluation results will be posted here automatically. |
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 UI unresponsiveness caused by high-frequency shell output updates. By introducing a time-gated check for text data events, the application avoids unnecessary re-renders while maintaining the integrity of the final output once command execution completes. 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 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request implements throttling for UI updates during command execution to prevent excessive re-renders. While the approach addresses performance, the review highlights critical issues: initializing the update timer to the current time causes a delay in showing the first output, binary progress events are missing throttling, and the shell tool logic leads to data loss because output chunks are overwritten rather than accumulated during the throttle window.
Text data events trigger a React re-render on every chunk, while binary_progress already throttles to OUTPUT_UPDATE_INTERVAL_MS (1s). High-volume commands like builds with hundreds of warnings make the UI completely unresponsive. This applies the same time-gate to text data events in both the core shell tool and the useExecutionLifecycle hook. The final output is always delivered via the result object after the command completes, so nothing gets lost. Fixes google-gemini#25459
b546c64 to
9f14b3c
Compare
|
Quick one — the UI freezes up during high-volume shell output.
What's happening
Every text
dataevent triggers a React re-render. Run something likenpm teston a big project or a build with hundreds of warnings, and the UI becomes completely unresponsive. Meanwhile,binary_progressalready throttles toOUTPUT_UPDATE_INTERVAL_MS(1 second) — text output just... didn't get the same treatment.The fix
Applied the same
Date.now() - lastUpdateTime > OUTPUT_UPDATE_INTERVAL_MStime-gate to thedatacase in two places:packages/core/src/tools/shell.ts— the tool execution pathpackages/cli/src/ui/hooks/useExecutionLifecycle.ts— the user shell (!prefix) pathThe final output is always delivered via the result object after the command completes, so you never lose anything — you just don't re-render 500 times a second while it's running.
Why not PR #25461?
That PR was flagged for unbounded memory growth in
cumulativeOutputaccumulation. This fix doesn't change what gets accumulated — it only gates how often we callupdateOutput()/setPendingHistoryItem(). The accumulation behavior stays exactly the same.Total diff is like 8 lines.
Fixes #25459
cc @NTaylorMullen @abhipatel12 this touches your area — thoughts?