Skip to content

[Windows] Critical performance issues: UI freeze on paste, terminal freeze on display, and PowerShell command failures #18366

@devnezu

Description

@devnezu

Environment

  • OS: Windows 11
  • Terminal: Git Bash (MINGW64), PowerShell, Windows Terminal
  • Gemini CLI Version: Latest (tested on multiple versions)
  • Node.js Version: v20.x

Problem Summary

The Gemini CLI is currently unusable on Windows for real-world workflows due to three critical performance and compatibility issues:

1. UI Freeze on Large Paste Operations

Severity: Critical - Makes the application unusable for pasting code, logs, or documentation

Description:
When pasting text larger than ~500 characters, the entire UI freezes for several seconds (or minutes for very large pastes). The terminal becomes completely unresponsive during this time.

Root Cause:
The current implementation processes pasted text character-by-character through the text buffer, causing O(n²) complexity for large inputs.

Reproduction Steps:

  1. Copy a large file (e.g., 50KB log file or code file)
  2. Paste into Gemini CLI input prompt using Ctrl+V or terminal paste
  3. Observe UI freeze - terminal becomes unresponsive
  4. Wait several seconds/minutes for paste to complete

Expected Behavior:
Paste should be instant regardless of size, similar to Claude Code CLI or standard terminal behavior.


2. Terminal Freeze When Displaying Large Messages in Chat History

Severity: High - Prevents reviewing conversation history with large content

Description:
After sending a large message (>10,000 characters), the terminal freezes when trying to render the message in the chat history. Scrolling becomes impossible and the UI hangs.

Root Cause:
The UserMessage component attempts to render the entire message content without any truncation or virtualization, causing terminal rendering performance issues.

Reproduction Steps:

  1. Paste and send a very large text (e.g., 50,000+ character file)
  2. Message is sent successfully to the API
  3. Try to scroll up in chat history
  4. Terminal freezes when attempting to render the large message

Expected Behavior:
Large messages should be truncated in the display (e.g., show preview with character count) while still being sent fully to the model API.


3. PowerShell Command Execution Failures with AI-Generated Commands

Severity: High - Makes AI-generated commands unusable on Windows

Description:
The AI frequently generates Unix-style commands using &&, ||, pipes, and other bash operators. These fail when executed in PowerShell (the default Windows shell) with cryptic syntax errors.

Examples of Failing Commands:

# AI generates:
npm install && npm run build

# PowerShell error:
The token '&&' is not a valid statement separator in this version.
# AI generates:
cat file.txt | grep "pattern"

# PowerShell error:
cat : The term 'cat' is not recognized...

Root Cause:
The shell-utils.ts module defaults to PowerShell on Windows, which has incompatible syntax with bash commands that the AI is trained to generate.

Reproduction Steps:

  1. Ask Gemini to run a command like "install dependencies and build the project"
  2. AI generates: npm install && npm run build
  3. Command fails with PowerShell syntax error
  4. User must manually rewrite to PowerShell syntax: npm install; if ($?) { npm run build }

Expected Behavior:
Since Git Bash is commonly installed on Windows developer machines, the CLI should detect and prefer Git Bash for command execution, ensuring compatibility with AI-generated Unix-style commands.


Impact

These issues collectively make Gemini CLI nearly unusable on Windows for:

  • Pasting code snippets, logs, or documentation
  • Reviewing chat history with large messages
  • Executing AI-generated commands without manual syntax conversion

Windows is a primary development platform, and these issues significantly impact the Windows user experience compared to macOS/Linux.

Proposed Solution

I have implemented fixes for all three issues in PR #18314, which:

  1. Implements fast paste optimization with placeholder-based handling
  2. Adds message display truncation for large content
  3. Configures shell to prefer Git Bash on Windows with PowerShell fallback

All changes maintain backward compatibility and have been tested extensively on Windows 11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreIssues related to User Interface, OS Support, Core Functionalitystatus/need-triageIssues that need to be triaged by the triage automation.status/possible-duplicate

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions