Skip to content

fix: resolve vp hanging on launch in Warp terminal#762

Merged
Brooooooklyn merged 1 commit intomainfrom
fix/warp-terminal-hang
Mar 10, 2026
Merged

fix: resolve vp hanging on launch in Warp terminal#762
Brooooooklyn merged 1 commit intomainfrom
fix/warp-terminal-hang

Conversation

@Brooooooklyn
Copy link
Copy Markdown
Member

@Brooooooklyn Brooooooklyn commented Mar 10, 2026

Background

The global vp CLI appeared to hang in Warp terminal, requiring a
keypress before any output was displayed. This affected both the bare
vp command (interactive picker) and subcommands like vp create that
delegate to Node.js. The issue did not occur in other terminals such as
iTerm2 or Terminal.app.

Root Cause

vite_shared::header::vite_plus_header() calls query_terminal_colors()
which sends OSC escape sequences (\x1b]10;?\x1b\\ for foreground color
and \x1b]4;N;?\x1b\\ for palette colors) to /dev/tty in raw mode to
read the terminal's color values for the header gradient. Most terminals
respond to these queries, but Warp's block-mode renderer does not. The
function then blocks on poll()/read() waiting for a response that
never comes, consuming the next keypress as a fake "response" instead.

Since the header is rendered on nearly every command, this caused the
CLI to appear stuck on every invocation in Warp.

Fix

  1. Skip OSC color queries in Warp (header.rs): Early-return from
    query_terminal_colors() when TERM_PROGRAM=WarpTerminal, falling
    back to default blue/magenta colors. This matches the existing CI
    environment skip pattern.

  2. Use alternate screen for the picker (command_picker.rs): Switch
    the interactive command picker to use EnterAlternateScreen /
    LeaveAlternateScreen instead of Clear(ClearType::All) + manual
    cursor reset. This is standard TUI practice and avoids a large blank
    area that Warp's block-mode renderer created with the previous
    clear-based approach.

  3. Conditional padding for Warp (command_picker.rs): Warp renders
    alternate screen content flush against the edges. Add a 1-line top
    margin and 1-space left margin only when running in Warp to improve
    readability, without affecting other terminals.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com


Note

Medium Risk
Touches terminal I/O and TUI screen-management paths, which can regress rendering or leave terminals in a bad state if edge cases are missed, but changes are scoped to UI behavior and add explicit cleanup/error handling.

Overview
Fixes vp appearing to hang in Warp by detecting Warp (TERM_PROGRAM=WarpTerminal) and skipping OSC color queries in vite_shared::header::query_terminal_colors, falling back to default header colors.

Updates the interactive command picker to use the terminal alternate screen (EnterAlternateScreen/LeaveAlternateScreen) with safer event/error handling, and adds Warp-specific padding plus a viewport-size adjustment (compute_viewport_size now accounts for header overhead; tests updated accordingly).

Written by Cursor Bugbot for commit 5bebc95. This will update automatically on new commits. Configure here.

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 10, 2026

Deploy Preview for viteplus-staging canceled.

Name Link
🔨 Latest commit 5bebc95
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-staging/deploys/69afdb5049a76a00085c752d

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 10, 2026

Deploy Preview for viteplus-staging canceled.

Name Link
🔨 Latest commit 84eb869
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-staging/deploys/69afd1030e6cb800083af660

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Comment thread crates/vite_global_cli/src/command_picker.rs Outdated
@Brooooooklyn Brooooooklyn force-pushed the fix/warp-terminal-hang branch from 84eb869 to 2f5b913 Compare March 10, 2026 08:25
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread crates/vite_global_cli/src/command_picker.rs
Comment thread crates/vite_global_cli/src/command_picker.rs
## Background

The global `vp` CLI appeared to hang in Warp terminal, requiring a
keypress before any output was displayed. This affected both the bare
`vp` command (interactive picker) and subcommands like `vp create` that
delegate to Node.js. The issue did not occur in other terminals such as
iTerm2 or Terminal.app.

## Root Cause

`vite_shared::header::vite_plus_header()` calls `query_terminal_colors()`
which sends OSC escape sequences (`\x1b]10;?\x1b\\` for foreground color
and `\x1b]4;N;?\x1b\\` for palette colors) to `/dev/tty` in raw mode to
read the terminal's color values for the header gradient. Most terminals
respond to these queries, but Warp's block-mode renderer does not. The
function then blocks on `poll()`/`read()` waiting for a response that
never comes, consuming the next keypress as a fake "response" instead.

Since the header is rendered on nearly every command, this caused the
CLI to appear stuck on every invocation in Warp.

## Fix

1. **Skip OSC color queries in Warp** (`header.rs`): Early-return from
   `query_terminal_colors()` when `TERM_PROGRAM=WarpTerminal`, falling
   back to default blue/magenta colors. This matches the existing CI
   environment skip pattern.

2. **Use alternate screen for the picker** (`command_picker.rs`): Switch
   the interactive command picker to use `EnterAlternateScreen` /
   `LeaveAlternateScreen` instead of `Clear(ClearType::All)` + manual
   cursor reset. This is standard TUI practice and avoids a large blank
   area that Warp's block-mode renderer created with the previous
   clear-based approach.

3. **Conditional padding for Warp** (`command_picker.rs`): Warp renders
   alternate screen content flush against the edges. Add a 1-line top
   margin and 1-space left margin only when running in Warp to improve
   readability, without affecting other terminals.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Brooooooklyn Brooooooklyn force-pushed the fix/warp-terminal-hang branch from 2f5b913 to 5bebc95 Compare March 10, 2026 08:50
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Copy link
Copy Markdown
Member Author

Brooooooklyn commented Mar 10, 2026

Merge activity

  • Mar 10, 9:10 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 10, 9:10 AM UTC: @Brooooooklyn merged this pull request with Graphite.

@Brooooooklyn Brooooooklyn merged commit 775616a into main Mar 10, 2026
23 checks passed
@Brooooooklyn Brooooooklyn deleted the fix/warp-terminal-hang branch March 10, 2026 09:10
Brooooooklyn added a commit that referenced this pull request Mar 16, 2026
tmux does not reliably forward OSC color query responses back to child
processes, causing the CLI to appear stuck until a keypress is consumed
as a fake response — the same issue fixed for Warp terminal in #762.

Closes #822

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fengmk2 pushed a commit that referenced this pull request Mar 16, 2026
)

tmux does not reliably forward OSC color query responses back to child
processes, causing the CLI to appear stuck until a keypress is consumed
as a fake response — the same issue fixed for Warp terminal in #762.

Closes #822

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: adds an early-return guard in header color probing based on
the `TMUX` env var, only affecting optional terminal color
detection/formatting.
> 
> **Overview**
> Prevents the header color-probing routine (`query_terminal_colors`)
from sending OSC color queries when inside *tmux* by short-circuiting if
`TMUX` is set, matching the existing Warp terminal workaround.
> 
> This avoids a launch-time hang where tmux may not forward OSC query
responses back to the child process, at the cost of falling back to
default header colors under tmux.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
d86e10f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants