hermes - ✅(Solved) Fix Classic CLI resize clears startup banner/tool summary after terminal maximize [2 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#22999Fetched 2026-05-11 03:31:46
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×3cross-referenced ×2commented ×1

After starting Hermes classic CLI in a small terminal window, the startup banner and right-side tool summary are visible.

When the terminal window is maximized/resized, the startup banner/tool summary disappears, and the screen is left with only the bottom input prompt area.

Root Cause

After starting Hermes classic CLI in a small terminal window, the startup banner and right-side tool summary are visible.

When the terminal window is maximized/resized, the startup banner/tool summary disappears, and the screen is left with only the bottom input prompt area.

Fix Action

Fix / Workaround

Local workaround tested

PR fix notes

PR #23048: fix(cli): preserve startup banner on terminal resize

Description (problem / solution / changelog)

Problem

After starting the classic CLI in a small terminal window and then maximizing/resizing, the startup banner and right-side tool summary disappear. Only the bottom input prompt area remains visible.

Root cause: _recover_after_resize() calls _clear_prompt_toolkit_screen(app, rebuild_scrollback=True) which sends erase_screen() + ] (clear scrollback). The startup banner was printed before prompt_toolkit owned the chrome, so it lives in normal terminal scrollback — clearing it removes the banner permanently. _replay_output_history cannot reconstruct it because the banner was never added to _OUTPUT_HISTORY.

Fix

Replace the aggressive screen/scrollback clear with a minimal renderer reset:

  • app.renderer.reset(leave_alternate_screen=False) — drops prompt_toolkit's cached screen + cursor state so the next redraw starts clean
  • app.invalidate() — schedules a repaint
  • original_on_resize() — recalculates layout for the new terminal size

This matches how bash/zsh/fish/vim/htop handle SIGWINCH — they never clear scrollback on resize.

Before vs After

ScenarioBeforeAfter
Resize terminalBanner disappears, only prompt visibleBanner preserved, layout adapts
_force_full_redraw (Ctrl+L)Full clear + replay (unchanged)Same — explicit redraw still clears
Exception safety_clear_prompt_toolkit_screen wrapped in try/exceptSame — both try/except blocks swallow errors

Tests

Updated test_resize_rebuilds_scrollback_before_prompt_toolkit_redrawtest_resize_preserves_scrollback_and_resets_renderer to verify:

  • renderer.reset() + invalidate() + original_on_resize() called in order
  • erase_screen, write_raw, cursor_goto NOT called (scrollback preserved)

All 9 tests in tests/cli/test_cli_force_redraw.py pass.


Fixes #22999

Changed files

  • cli.py (modified, +21/-3)
  • tests/cli/test_cli_force_redraw.py (modified, +15/-15)

PR #23294: fix(cli): preserve startup scrollback on resize

Description (problem / solution / changelog)

What does this PR do?

Preserve the classic CLI startup banner and tool summary during terminal resize recovery by resetting prompt_toolkit's renderer instead of wiping the physical terminal scrollback.

Related Issue

Fixes #22999

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • update /Users/leongong/Desktop/LeonProjects/worktrees/hermes-agent/hermes-22999-cli-resize-banner/cli.py so resize recovery calls the original prompt_toolkit resize path first, then resets the renderer and invalidates for a clean repaint
  • stop clearing physical scrollback during resize recovery so startup banner/tool summary content survives maximize and resize events
  • update /Users/leongong/Desktop/LeonProjects/worktrees/hermes-agent/hermes-22999-cli-resize-banner/tests/cli/test_cli_force_redraw.py to assert the resize path preserves scrollback and still repaints the prompt chrome

How to Test

  1. Run uv run --frozen pytest -q -o addopts='' tests/cli/test_cli_force_redraw.py
  2. Start classic CLI mode in a narrow terminal and confirm the startup banner/tool summary are visible
  3. Maximize or resize the terminal and confirm the startup area stays visible instead of being wiped away

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 pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 15.x

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

Screenshots / Logs

  • uv run --frozen pytest -q -o addopts='' tests/cli/test_cli_force_redraw.py9 passed
  • uv run --frozen ruff check cli.py tests/cli/test_cli_force_redraw.py → passed

Changed files

  • cli.py (modified, +16/-8)
  • tests/cli/test_cli_force_redraw.py (modified, +9/-15)

Code Example

self._clear_prompt_toolkit_screen(app, rebuild_scrollback=True)
_replay_output_history()
original_on_resize()

---

try:
    original_on_resize()
finally:
    app.renderer.reset(leave_alternate_screen=False)
    app.invalidate()

---

python -m pytest tests/cli/test_cli_force_redraw.py
# 9 passed
RAW_BUFFERClick to expand / collapse

Description

After starting Hermes classic CLI in a small terminal window, the startup banner and right-side tool summary are visible.

When the terminal window is maximized/resized, the startup banner/tool summary disappears, and the screen is left with only the bottom input prompt area.

Expected behavior

Resizing or maximizing the terminal should preserve the visible startup banner/tool summary, or at least should not clear the non-prompt startup area.

Actual behavior

After maximizing the terminal, the top startup UI disappears and only the prompt/input area remains.

Environment

  • Hermes Agent: v0.13.0 (2026.5.7)
  • Python: 3.11.15
  • OS: macOS
  • Local commit: 998676dd0

Suspected cause

This appears related to the classic CLI resize recovery introduced by #20444.

_recover_after_resize() clears the physical terminal screen/scrollback via:

self._clear_prompt_toolkit_screen(app, rebuild_scrollback=True)
_replay_output_history()
original_on_resize()

The startup banner and tool summary are printed before prompt_toolkit owns the live bottom input chrome, so they live in normal terminal scrollback rather than in the prompt_toolkit layout. Clearing the physical screen/scrollback on SIGWINCH can therefore remove that startup UI, and _OUTPUT_HISTORY does not reliably reconstruct it.

Related issues / PRs

  • #19280
  • #20444
  • #21972

Local workaround tested

Changing resize recovery to preserve physical scrollback and only reset prompt_toolkit renderer state avoids the disappearance:

try:
    original_on_resize()
finally:
    app.renderer.reset(leave_alternate_screen=False)
    app.invalidate()

Targeted test:

python -m pytest tests/cli/test_cli_force_redraw.py
# 9 passed

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…

FAQ

Expected behavior

Resizing or maximizing the terminal should preserve the visible startup banner/tool summary, or at least should not clear the non-prompt startup area.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING