hermes - 💡(How to fix) Fix [Bug]: TUI resize causes ghost copies (same root cause as #5474 but for Ink/TUI) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#17961Fetched 2026-05-01 05:54:45
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×3cross-referenced ×1

Root Cause

The CLI fix in bb00b783f 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

Fix Action

Fix / Workaround

  • #5474 — same symptom, CLI side, fixed by #16527
  • #8688 — related cmux resize issue, CLI side
RAW_BUFFERClick to expand / collapse

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 bb00b783f 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

  • #5474 — same symptom, CLI side, fixed by #16527
  • #8688 — related cmux resize issue, CLI side

extent analysis

TL;DR

The issue can be fixed by ensuring the terminal screen is properly erased before rendering a new frame in the TUI mode, potentially by modifying the handleResize function in ink.tsx to reliably clear the screen.

Guidance

  • Review the handleResize function in ink.tsx (around line 435) to ensure it correctly erases the screen before rendering a new frame.
  • Investigate the renderFrameSlice function in log-update.ts to determine if the use of LF (\n) for row advancement in alt-screen mode is causing the terminal to scroll and push content off-screen.
  • Compare the fix applied to the CLI side in PR #16527 to understand how a similar solution could be applied to the TUI path.
  • Verify that the needsEraseBeforePaint flag is being set correctly and that the erase operation is reaching the terminal reliably.

Example

No code snippet is provided as the issue requires a deeper understanding of the specific implementation details of the ink.tsx and log-update.ts files.

Notes

The fix may require modifications to the ink.tsx and log-update.ts files, and careful consideration of the interactions between the handleResize function and the renderFrameSlice function.

Recommendation

Apply a workaround by modifying the handleResize function to force a screen erase before rendering a new frame, similar to the fix applied to the CLI side in PR #16527. This should help to prevent the ghost copies of UI elements from appearing after resizing the terminal window.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix [Bug]: TUI resize causes ghost copies (same root cause as #5474 but for Ink/TUI) [1 participants]