Skip to content

Comments

fix(cli): resolve double rendering in shpool and address vscode lint warnings#18704

Merged
jacob314 merged 1 commit intogoogle-gemini:mainfrom
braddux:fix/shpool-double-render-independent
Feb 11, 2026
Merged

fix(cli): resolve double rendering in shpool and address vscode lint warnings#18704
jacob314 merged 1 commit intogoogle-gemini:mainfrom
braddux:fix/shpool-double-render-independent

Conversation

@braddux
Copy link
Contributor

@braddux braddux commented Feb 10, 2026

This commit fixes rendering artifacts (specifically double rendering of the footer
and settings menu) when running Gemini CLI within an shpool session.

Key changes for shpool:

  • Detected shpool sessions via the SHPOOL_SESSION_NAME environment variable.
  • Added a 100ms delay before initial TUI rendering in shpool to allow terminal
    state and size to stabilize.
  • Disabled incrementalRendering for shpool sessions, which prevents frame
    replay artifacts common in multiplexed environments.
  • Removed redundant manual enterAlternateScreen() and disableLineWrapping()
    calls in the boot sequence, delegating alternate buffer management entirely
    to the ink library.
  • Ensured line wrapping is disabled after alternate buffer entry and properly
    restored on exit via registered cleanup functions.

VS Code Companion refactorings:

  • Addressed unsafe type assertions in diff-manager.ts and ide-server.ts by
    using proper type guards (instanceof vscode.TabInputTextDiff) and safer
    header extraction logic. This removes the need for eslint-disable directives
    and ensures compliance with root linting rules.

Test updates:

  • Updated unit tests to account for additional cleanup registrations and
    ensured consistent environment variable handling.

Fixes #18703

@braddux braddux requested a review from a team as a code owner February 10, 2026 02:53
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @braddux, 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 resolves critical rendering issues within the Gemini CLI when operating in an shpool environment, preventing visual glitches like double rendering. Concurrently, it enhances the robustness and type safety of the VS Code Companion by eliminating unsafe type assertions and improving header parsing, aligning the codebase with stricter linting standards. These changes collectively improve the user experience in specific terminal multiplexer setups and bolster the overall code quality of the VS Code integration.

Highlights

  • Shpool Rendering Fixes: Implemented specific logic to address rendering artifacts in shpool sessions, including detecting shpool via environment variables, introducing a 100ms delay before TUI rendering, and disabling incremental rendering to prevent frame replay issues.
  • Alternate Buffer Management Refinement: Removed redundant manual calls for enterAlternateScreen() and disableLineWrapping(), delegating alternate buffer management entirely to the Ink library and ensuring proper line wrapping restoration via cleanup functions.
  • VS Code Companion Type Safety Improvements: Refactored diff-manager.ts and ide-server.ts to replace unsafe type assertions with proper type guards (e.g., instanceof vscode.TabInputTextDiff) and safer header extraction logic, eliminating the need for eslint-disable directives.
  • Unit Test Updates: Adjusted unit tests to correctly handle the new cleanup registrations and ensure consistent environment variable management, specifically for SHPOOL_SESSION_NAME.
Changelog
  • packages/cli/src/gemini.test.tsx
    • Added originalEnvShpool variable to store and restore the SHPOOL_SESSION_NAME environment variable.
    • Ensured SHPOOL_SESSION_NAME is cleared before each test and restored afterwards.
    • Introduced vi.unstubAllEnvs() to clean up environment stubs.
    • Updated the expected number of registerCleanup calls in tests from 3 to 4.
  • packages/cli/src/gemini.tsx
    • Removed direct imports and calls for enterAlternateScreen and added enableLineWrapping.
    • Introduced isShpool detection based on SHPOOL_SESSION_NAME environment variable.
    • Added a 100ms delay before TUI rendering when running in an shpool session.
    • Conditionally disabled incrementalRendering for shpool sessions.
    • Managed disableLineWrapping and enableLineWrapping via registerCleanup when using an alternate buffer.
    • Removed manual alternate screen and line wrapping management from the main function, relying on Ink's capabilities.
  • packages/vscode-ide-companion/src/diff-manager.ts
    • Replaced an unsafe type assertion for tab.input with a type guard using instanceof vscode.TabInputTextDiff.
  • packages/vscode-ide-companion/src/ide-server.ts
    • Refactored header extraction for MCP_SESSION_ID_HEADER to safely handle array or string values.
    • Removed an unsafe type assertion for this.server.address() by capturing the server instance locally.
    • Assigned the local server instance to this.server after it has started listening.
Activity
  • No human activity has occurred on this pull request yet.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several valuable improvements. It effectively resolves rendering artifacts in shpool by detecting the session and adjusting rendering parameters, including adding a short delay and disabling incremental rendering. The refactoring of terminal screen management to better leverage the ink library is a good cleanup. Furthermore, the changes in the VS Code companion are excellent, replacing unsafe type assertions with proper type guards (instanceof) in diff-manager.ts and ide-server.ts. This significantly improves type safety and code clarity, removing the need for eslint-disable directives. The test suite has also been updated accordingly to reflect these changes. Overall, this is a high-quality contribution that improves both functionality and code health.

@braddux braddux force-pushed the fix/shpool-double-render-independent branch from 08720a1 to 72d16f2 Compare February 10, 2026 03:00
@gemini-cli gemini-cli bot added area/core Issues related to User Interface, OS Support, Core Functionality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels Feb 10, 2026
@braddux braddux force-pushed the fix/shpool-double-render-independent branch from c5aae5d to 26beffa Compare February 11, 2026 00:55
…ntal rendering for others

This commit fixes rendering artifacts (double rendering of the footer and settings
menu) when running Gemini CLI within an shpool session.

Key changes:
- Detected shpool sessions via the SHPOOL_SESSION_NAME environment variable.
- Disabled incrementalRendering specifically for shpool sessions. This is
  necessary because shpool's raw terminal replay and synchronization mechanisms
  often conflict with ink's incremental diffing algorithm, leading to persistent
  artifacts like double footers or misaligned UI elements.
- Used terminal dimensions (columns/rows) as a React 'key' for the AppContainer.
  This forces a full unmount and remount of the UI whenever the terminal is
  resized, which helps self-heal state drift in multiplexed environments.
- Added a 100ms delay before initial TUI rendering in shpool to allow terminal
  state and size to stabilize.
- Removed redundant manual enterAlternateScreen() and disableLineWrapping()
  calls in the boot sequence, delegating alternate buffer management entirely
  to the ink library.
- Ensured line wrapping is disabled after alternate buffer entry and properly
  restored on exit via registered cleanup functions.

Test updates:
- Updated unit tests to account for additional cleanup registrations and
  ensured consistent environment variable handling using vi.stubEnv.

Fixes google-gemini#18703
@braddux braddux force-pushed the fix/shpool-double-render-independent branch from 26beffa to 19b1f4f Compare February 11, 2026 17:02
Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jacob314 jacob314 enabled auto-merge February 11, 2026 17:17
@jacob314 jacob314 added this pull request to the merge queue Feb 11, 2026
Merged via the queue into google-gemini:main with commit 0080589 Feb 11, 2026
27 checks passed
@braddux braddux deleted the fix/shpool-double-render-independent branch February 11, 2026 18:22
krsjenmt added a commit to krsjenmt/gemini-cli that referenced this pull request Feb 12, 2026
…ini/gemini-cli (#37)

* fix(cli): resolve double rendering in shpool and address vscode lint warnings (google-gemini#18704)

* feat(plan): document and validate Plan Mode policy overrides (google-gemini#18825)

* Fix pressing any key to exit select mode. (google-gemini#18421)

* fix(cli): update F12 behavior to only open drawer if browser fails (google-gemini#18829)

* feat(plan): allow skills to be enabled in plan mode (google-gemini#18817)

Co-authored-by: Jerop Kipruto <jerop@google.com>

* docs(plan): add documentation for plan mode tools (google-gemini#18827)

* Remove experimental note in extension settings docs (google-gemini#18822)

* Update prompt and grep tool definition to limit context size (google-gemini#18780)

* docs(plan): add `ask_user` tool documentation (google-gemini#18830)

* Revert unintended credentials exposure (google-gemini#18840)

* feat(core): update internal utility models to Gemini 3 (google-gemini#18773)

* feat(a2a): add value-resolver for auth credential resolution (google-gemini#18653)

* Removed getPlainTextLength (google-gemini#18848)

* More grep prompt tweaks (google-gemini#18846)

* refactor(cli): Reactive useSettingsStore hook (google-gemini#14915)

* fix(mcp): Ensure that stdio MCP server execution has the `GEMINI_CLI=1` env variable populated. (google-gemini#18832)

* fix(core): improve headless mode detection for flags and query args (google-gemini#18855)

* refactor(cli): simplify UI and remove legacy inline tool confirmation logic (google-gemini#18566)

* feat(cli): deprecate --allowed-tools and excludeTools in favor of policy engine (google-gemini#18508)

* fix(workflows): improve maintainer detection for automated PR actions (google-gemini#18869)

* refactor(cli): consolidate useToolScheduler and delete legacy implementation (google-gemini#18567)

* Update changelog for v0.28.0 and v0.29.0-preview0 (google-gemini#18819)

* fix(core): ensure sub-agents are registered regardless of tools.allowed (google-gemini#18870)

---------

Co-authored-by: Brad Dux <959674+braddux@users.noreply.github.com>
Co-authored-by: Jerop Kipruto <jerop@google.com>
Co-authored-by: Jacob Richman <jacob314@gmail.com>
Co-authored-by: Sandy Tao <sandytao520@icloud.com>
Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
Co-authored-by: christine betts <chrstn@uw.edu>
Co-authored-by: Christian Gunderman <gundermanc@gmail.com>
Co-authored-by: Adam Weidman <65992621+adamfweidman@users.noreply.github.com>
Co-authored-by: Dev Randalpura <devrandalpura@google.com>
Co-authored-by: Pyush Sinha <pyushsinha20@gmail.com>
Co-authored-by: Richie Foreman <richie.foreman@gmail.com>
Co-authored-by: Gal Zahavi <38544478+galz10@users.noreply.github.com>
Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
Co-authored-by: Abhijit Balaji <abhijitbalaji@google.com>
Co-authored-by: Bryan Morgan <bryanmorgan@google.com>
Co-authored-by: g-samroberts <158088236+g-samroberts@users.noreply.github.com>
Co-authored-by: matt korwel <matt.korwel@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI rendering artifacts (double rendering) in Gemini CLI when used within shpool sessions

2 participants