hermes - ✅(Solved) Fix TUI: Terminal resize accumulates blank separator lines [1 pull requests, 1 comments, 2 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#22976Fetched 2026-05-11 03:31:56
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
0
Author
Participants
Timeline (top)
labeled ×4referenced ×2commented ×1cross-referenced ×1

Root Cause

The status bar separator in ui-tui/src/components/appChrome.tsx (lines ~294-297 and ~335) renders hardcoded characters. On terminal resize:

  1. Node.js stdout.on('resize') fires (ui-tui/src/app/useMainApp.ts:413)
  2. Ink's AlternateScreen re-renders the full React tree
  3. The separator lines are re-drawn at the new terminal size
  4. However, Ink's virtual DOM diff does not clear the previous terminal output — old separator characters remain visible while new ones are rendered on top
  5. Result: each resize appends one more layer of ghost separators

This is an Ink rendering engine edge case: React's VDOM diff has no awareness of physical terminal geometry changes, so it cannot reconcile "the canvas just got wider/taller" against "the existing screen content needs invalidation."

Fix Action

Fix / Workaround

This is not a feature request for a workaround. The /clear command exists but is a palliative measure — it does not prevent the issue from recurring on the next resize.

PR fix notes

PR #23034: fix(tui): clear terminal on resize to prevent ghost separator lines

Description (problem / solution / changelog)

Problem

When the terminal is resized while the TUI is running, Ink's VDOM reconciliation does not handle geometry changes. Old separator lines (──────) accumulate on screen, creating visual garbage.

Solution

Add a raw ANSI escape sequence (\x1b[2J\x1b[H) to the resize handler to clear the terminal before Ink re-renders. This is a targeted fix that does not affect normal rendering.

Testing

  • Resized terminal during active TUI session
  • No ghost lines observed after fix

Fixes #22976

Changed files

  • ui-tui/src/app/useMainApp.ts (modified, +6/-0)
RAW_BUFFERClick to expand / collapse

Impact

When working with multiple Hermes TUI sessions side by side — a common workflow for managing parallel development tasks — users resize terminal windows frequently. Each resize event causes blank separator lines () to accumulate in the prompt area. After a few resize operations, the TUI becomes cluttered with dozens of ghost lines, forcing the user to run /clear repeatedly.

This is not a cosmetic issue. It interrupts the development flow for users who rely on multi-window Hermes setups to manage concurrent agent tasks.

Steps to Reproduce

  1. Run hermes --tui in multiple terminal windows
  2. Start a conversation in each
  3. Resize any of the terminal windows (drag edge, maximize/restore, or switch between full-screen splits)
  4. Observe: each resize adds one or more blank lines filled with below the input prompt <img width="1054" height="790" alt="Image" src="https://github.com/user-attachments/assets/5b443035-af13-41f2-9c03-b1ff2d87c0dd" />
<img width="1054" height="790" alt="Image" src="https://github.com/user-attachments/assets/86959c96-c5cb-4629-8b55-2875585ce5f9" />

Root Cause

The status bar separator in ui-tui/src/components/appChrome.tsx (lines ~294-297 and ~335) renders hardcoded characters. On terminal resize:

  1. Node.js stdout.on('resize') fires (ui-tui/src/app/useMainApp.ts:413)
  2. Ink's AlternateScreen re-renders the full React tree
  3. The separator lines are re-drawn at the new terminal size
  4. However, Ink's virtual DOM diff does not clear the previous terminal output — old separator characters remain visible while new ones are rendered on top
  5. Result: each resize appends one more layer of ghost separators

This is an Ink rendering engine edge case: React's VDOM diff has no awareness of physical terminal geometry changes, so it cannot reconcile "the canvas just got wider/taller" against "the existing screen content needs invalidation."

Environment

  • Hermes Agent version: (Hermes Agent v0.12.0 (2026.4.30))
  • OS: macOS
  • Terminal: (Terminal.app)
  • TUI mode: hermes --tui

Request

This is not a feature request for a workaround. The /clear command exists but is a palliative measure — it does not prevent the issue from recurring on the next resize.

The fix should address the root cause: Ink's AlternateScreen must perform a full buffer clear before re-rendering on resize events, or the TUI must explicitly manage resize lifecycle to prevent separator-line accumulation.

Affected code paths:

  • ui-tui/src/components/appChrome.tsx:294-297 — leading separator in StatusRule
  • ui-tui/src/components/appChrome.tsx:335 — cwd separator
  • ui-tui/src/app/useMainApp.ts:405-411 — resize event handler (currently just forwards new column count, does not trigger screen invalidation)

A proper fix would ensure that after any resize event, the TUI renders on a clean slate rather than diffing against stale terminal output.

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