Skip to content

[Bug]: TUI resize causes ghost copies (same root cause as #5474 but for Ink/TUI) #17961

@Wt00000111

Description

@Wt00000111

Bug Description

Resizing the terminal window in --tui mode causes ghost/duplicate copies of UI elements (composer, status bar, etc.) at regular intervals. The old content is not cleared before the new frame is drawn.

This is the same root cause as #5474, which was fixed for the CLI (prompt_toolkit) in PR #16527, but the TUI (Ink) path was not addressed.

Steps to Reproduce

  1. hermes --tui
  2. Start a conversation
  3. Drag terminal window to resize
  4. Scroll up — observe duplicate composer/status bar copies at intervals corresponding to previous terminal heights

Expected Behavior

Terminal should re-render cleanly after resize with no ghost copies.

Actual Behavior

Multiple copies of the composer appear at positions from previous terminal heights. Each resize creates a new ghost. Spacing between ghosts reflects the terminal height at the time of each resize.

Affected Component

TUI (Ink/React terminal UI) — ui-tui/ and ui-tui/packages/hermes-ink/

Operating System

macOS (Terminal.app)

Hermes Version

v0.11.0 (2026.4.23)

Root Cause Analysis

The CLI fix in bb00b78 forces erase_screen + cursor_goto(0,0) + renderer.reset() on every resize via prompt_toolkit's renderer. The Ink TUI has a similar handleResize in ink.tsx that calls resetFramesForAltScreen() and sets needsEraseBeforePaint, but the erase may not be reaching the terminal reliably, or the diff system's renderFrameSlice using LF (\n) for row advancement in alt-screen mode causes terminal scrolling that pushes content off-screen.

Key files:

  • ui-tui/packages/hermes-ink/src/ink/ink.tsxhandleResize (line ~435)
  • ui-tui/packages/hermes-ink/src/ink/log-update.tsrenderFrameSlice uses LF which scrolls in alt-screen

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/tuiTerminal UI (ui-tui/ + tui_gateway/)type/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions