hermes - ✅(Solved) Fix CLI TUI renders blank lines after terminal resize [1 pull requests, 3 comments, 3 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#17975Fetched 2026-05-01 05:54:42
View on GitHub
Comments
3
Participants
3
Timeline
7
Reactions
0
Timeline (top)
commented ×3labeled ×3cross-referenced ×1

Fix Action

Fix / Workaround

There is already a _resize_clear_ghosts() patch in cli.py (around line 10850) that wraps app._on_resize to force erase_screen() + cursor_goto(0,0) before the renderer redraw. However the bug persists -- the fix may not cover all resize scenarios (e.g. SIGWINCH-less reflows, row-count changes, or multiplexer-driven resizes).

PR fix notes

PR #17996: fix(cli): clear ghost lines on ALL terminal resize events

Description (problem / solution / changelog)

Summary

Fixes #17975 - CLI TUI renders blank lines after terminal resize.

Problem

When the terminal resizes (shrink, grow, or height change), the emulator may reflow previously-rendered full-width rows into multiple narrower/taller rows, leaving ghost duplicates visible. The prompt area drifts downward with ghost empty rows.

Root Cause

The previous fix (_resize_clear_ghosts) only handled horizontal shrinking (columns getting smaller) by calculating a reflow factor. It missed:

  • Terminal growing (columns getting larger)
  • Height changes
  • SIGWINCH-less multiplexer-driven resizes

Solution

Use a simpler, more robust approach: force erase_screen() + cursor_goto(0,0) BEFORE the standard resize handler to completely clear any ghost content from the previous render. This handles ALL resize types.

Changes

  • cli.py: Simplified _resize_clear_ghosts() to always call erase_screen(), cursor_goto(0,0), and flush() before the original resize handler, rather than conditionally based on resize direction.
  • tests/cli/test_cli_resize_ghosts.py: Added test coverage for the resize fix.

Local Verification

  • ✅ All existing CLI tests pass (26/26)
  • ✅ New resize tests pass (4/4)
  • ✅ Python syntax check passed
  • ✅ Ruff lint check passed (no new errors)

Notes

This contribution was developed with AI assistance.

Changed files

  • cli.py (modified, +13/-31)
  • tests/cli/test_cli_resize_ghosts.py (added, +132/-0)
RAW_BUFFERClick to expand / collapse

Bug Description

When the terminal window is resized (e.g. dragging to make it wider/narrower, or un-maximizing), the CLI TUI renders extra blank lines and the layout becomes visually corrupted. The prompt area drifts downward with ghost empty rows.

Steps to Reproduce

  1. Start hermes in interactive CLI mode
  2. Resize the terminal window (drag to change width or height)
  3. Observe blank/empty lines appearing in the TUI

Expected Behavior

The TUI should cleanly redraw after resize with no extra blank lines or visual artifacts.

Actual Behavior

Multiple blank lines appear after resize. The prompt area drifts. Ctrl+L, reset, and /exit + hermes --continue do not fully resolve the issue.

Notes

There is already a _resize_clear_ghosts() patch in cli.py (around line 10850) that wraps app._on_resize to force erase_screen() + cursor_goto(0,0) before the renderer redraw. However the bug persists -- the fix may not cover all resize scenarios (e.g. SIGWINCH-less reflows, row-count changes, or multiplexer-driven resizes).

Environment

  • OS: WSL2 Ubuntu (Windows host)
  • Terminal: Windows Terminal / WSL
  • Mode: hermes interactive CLI (non-TUI / prompt_toolkit mode)

extent analysis

TL;DR

The issue can be mitigated by enhancing the _resize_clear_ghosts() function in cli.py to handle various resize scenarios, including SIGWINCH-less reflows and row-count changes.

Guidance

  • Review the _resize_clear_ghosts() function in cli.py (around line 10850) to ensure it correctly handles all possible resize events, including those not triggered by SIGWINCH.
  • Investigate the app._on_resize method to see if it needs additional logic to properly redraw the TUI after a resize event.
  • Consider adding logging or debugging statements to track the resize events and the subsequent TUI redraw process to identify where the issue occurs.
  • Test the TUI with different resize scenarios, such as changing the terminal width, height, or using a multiplexer, to reproduce the issue and verify any fixes.

Example

No code example is provided due to the complexity of the issue and the need for specific knowledge of the hermes codebase.

Notes

The provided patch in cli.py may not cover all possible resize scenarios, and the issue may be related to the specific terminal environment (WSL2 Ubuntu on Windows host) or the hermes interactive CLI mode.

Recommendation

Apply a workaround by modifying the _resize_clear_ghosts() function to better handle various resize events, as the root cause of the issue is likely related to the TUI redraw process after a resize event.

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 - ✅(Solved) Fix CLI TUI renders blank lines after terminal resize [1 pull requests, 3 comments, 3 participants]