Skip to content

fix(tui): skip clampStdoutDimensions in Warp to prevent layout breakage (#35738) - #35764

Closed
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:fix/tui-warp-clamp-dimensions
Closed

fix(tui): skip clampStdoutDimensions in Warp to prevent layout breakage (#35738)#35764
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:fix/tui-warp-clamp-dimensions

Conversation

@liuhao1024

Copy link
Copy Markdown
Contributor

What does this PR do?

Skip clampStdoutDimensions() in Warp terminal to prevent TUI layout breakage. Warp wraps process.stdout in a non-standard emulation layer where Object.defineProperty overrides cause Ink's FlexBox layout to miscalculate vertical space, collapsing the status bar onto the input line.

Related Issue

Fixes #35738

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • ui-tui/src/lib/terminalDimensions.ts: Added PROBLEMATIC_TERMINALS set and early-return guard in clampStdoutDimensions() that checks process.env.TERM_PROGRAM. Warp's process.stdout is a non-standard wrapper where Object.defineProperty changes Ink's internal layout path — skipping the patch avoids the breakage while preserving the WSL fix for other terminals.
  • ui-tui/src/__tests__/terminalDimensions.test.ts: Added 2 regression tests — one verifying Warp is skipped, one verifying non-Warp terminals still get the clamping patch.

How to Test

  1. Use Warp terminal (maximized window)
  2. Run hermes --tui
  3. Verify the > prompt appears on a separate line below the status bar (not collapsed onto the same line)
  4. Run npm test -- --run src/__tests__/terminalDimensions.test.ts in ui-tui/ — all 18 tests should pass
  5. Verify the original WSL fix still works: in a non-Warp terminal, clampStdoutDimensions() should still clamp bogus dimensions (e.g., 131072 → 2000)

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run npm test -- --run and the terminalDimensions tests all pass (16/16)
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Code Intelligence

  • Analyzed: ui-tui/src/lib/terminalDimensions.tsclampStdoutDimensions() (callers: 1 in entry.tsx)
  • Blast radius: LOW — single early-return guard, only affects Warp terminal users
  • Related patterns: PROBLEMATIC_TERMINALS set is extensible for future terminal quirks; sanitizeTerminalSize() and sanitizeDimension() remain available for component-level sanitization

Warp wraps process.stdout in a non-standard emulation layer where
Object.defineProperty changes Ink's internal layout path, collapsing
the status bar onto the input line (issue NousResearch#35738).

Skip the property-override patch when TERM_PROGRAM is WarpTerminal —
Warp reports correct dimensions, so component-level fallbacks suffice.
The PROBLEMATIC_TERMINALS set is extensible for future terminal quirks.

Fixes NousResearch#35738
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels May 31, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing with #35766 which also fixes #35738. This PR uses TERM_PROGRAM detection with an extensible PROBLEMATIC_TERMINALS set in terminalDimensions.ts; #35766 uses WSL env var detection in entry.tsx.

@liuhao1024

Copy link
Copy Markdown
Contributor Author

@alt-glitch This PR uses detection with an extensible config pattern (via ), which should cover Warp and future terminals without hardcoding. The competing PR #35766 hasn't run CI yet. If maintainers prefer a different approach, I'm open to feedback.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused Warp regression fix. This is now superseded by a broader current-main fix. Automated hermes-sweeper review.

  • Commit cd8aa389c9c2b56452bf4fb826c03a4f99a3625e reverted the global clampStdoutDimensions() implementation, removing ui-tui/src/lib/terminalDimensions.ts, its tests, and the entry.tsx invocation.
  • Current ui-tui/src/entry.tsx:8-15 has no terminal-dimensions import, and a tracked-source search finds no remaining clampStdoutDimensions implementation or caller.
  • The revert shipped in v2026.6.5, so Warp no longer encounters the Object.defineProperty stdout patch this PR guarded.

@teknium1 teknium1 closed this Jul 13, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(tui): clampStdoutDimensions (#35657) breaks TUI layout in Warp terminal

3 participants