From ceac993b4bb0f861d749cb035da171c46b4177ee Mon Sep 17 00:00:00 2001 From: irandoku Date: Sun, 31 May 2026 15:35:27 +0800 Subject: [PATCH] fix(tui): gate clampStdoutDimensions behind WSL detection (#35738) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit clampStdoutDimensions() patches process.stdout via Object.defineProperty, which breaks TUI layout in Warp terminal (status bar and input prompt merge onto one line). Warp's process.stdout is not a standard Node TTY stream, so the property descriptor override changes how Ink reads terminal dimensions in alt-screen mode. Gate the call behind WSL environment detection (WSL_DISTRO_NAME / WSL_INTEROP) so the patch only runs where it's needed — WSL is the environment that reports bogus dimensions (e.g. 131072x1). Fixes #35738 --- ui-tui/src/entry.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui-tui/src/entry.tsx b/ui-tui/src/entry.tsx index 787f738f9f3c1..a950a5eb29a62 100644 --- a/ui-tui/src/entry.tsx +++ b/ui-tui/src/entry.tsx @@ -23,7 +23,12 @@ if (!process.stdin.isTTY) { // `process.stdout.columns`/`rows` at the source so the Ink renderer, its // resize handler, and every component read see sane values. Must run before // `ink.render` constructs the renderer. -clampStdoutDimensions() +// Only apply in WSL — patching process.stdout via Object.defineProperty breaks +// some terminals (e.g. Warp) that use non-standard stdout objects. +// See: https://github.com/NousResearch/hermes-agent/issues/35738 +if (process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP) { + clampStdoutDimensions() +} // Start from a clean slate. If a previous TUI crashed or was kill -9'd, the // terminal tab can still have mouse/focus/paste modes enabled.