Skip to content

fix: preserve ansi output history on resize replay#24292

Closed
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:hermes/fix-24017-persistent-output-ansi
Closed

fix: preserve ansi output history on resize replay#24292
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:hermes/fix-24017-persistent-output-ansi

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

What does this PR do?

Preserves ANSI/Rich formatting in the CLI output history that is replayed after terminal redraws. The previous history recorder stripped ANSI control sequences before storing lines, so rich console output could lose styling when persistent output was replayed after a resize.

Related Issue

Fixes #24017

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

  • Updated cli.py so output history keeps ANSI formatting while still normalizing carriage returns and trailing newlines.
  • Updated the existing output-history replay test to assert ANSI preservation.
  • Added coverage for ChatConsole.print() recording Rich-rendered ANSI output for replay.

How to Test

  1. Run scripts/run_tests.sh tests/cli/test_cprint_bg_thread.py tests/cli/test_cli_force_redraw.py.
  2. Run git diff --check.
  3. Run uv sync --frozen --extra all and uv run --frozen ruff check ..

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

For New Skills

N/A — this PR does not add a skill.

Screenshots / Logs

Local verification:

scripts/run_tests.sh tests/cli/test_cprint_bg_thread.py tests/cli/test_cli_force_redraw.py
# passed

git diff --check
# passed

uv sync --frozen --extra all
# passed

uv run --frozen ruff check .
# passed

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard labels May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

persistent_output replay strips ANSI/Rich formatting after terminal resize

2 participants