hermes - 💡(How to fix) Fix [Bug]: CLI input field leaks terminal control sequences (cursor positioning / DSR responses) causing garbled input [3 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

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#14692Fetched 2026-04-24 06:15:15
View on GitHub
Comments
3
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×4commented ×3

Terminal control sequences (ANSI escape codes) leak into the Hermes CLI input field, causing garbled text, cursor position corruption, and duplicated characters. This makes the input unreliable — typed text gets scrambled and keystrokes produce wrong output.

Root Cause

Possible Root Cause

RAW_BUFFERClick to expand / collapse

Summary

Terminal control sequences (ANSI escape codes) leak into the Hermes CLI input field, causing garbled text, cursor position corruption, and duplicated characters. This makes the input unreliable — typed text gets scrambled and keystrokes produce wrong output.

Observed Leaked Sequences

  • ^[[53;1R — DSR (Device Status Report) cursor position response
  • ^[[51;1R — DSR response (different row)
  • ^[[50;9R — DSR response (different column)
  • ^[[53;1R combined with partial input rendering

These are responses to CSI 6 n (Device Status Report — Report Cursor Position) queries that are being rendered as literal text instead of being consumed by the terminal/parser.

Steps to Reproduce

  1. Launch Hermes Agent in Terminal.app (macOS)
  2. Use Hermes normally (chat, tool calls, MCP operations)
  3. After some interactions, the input field becomes unstable
  4. Typed characters appear garbled, escape sequences show as literal text
  5. Input line shows partial renders and duplicated characters

Expected Behavior

All ANSI control sequences should be consumed/handled by prompt_toolkit and never appear as literal text in the input field.

Actual Behavior

Raw escape sequences appear in the input, cursor position is wrong, and input becomes unreliable. The user has to restart Hermes to recover.

Environment

  • Hermes Agent: v0.10.0 (2026.4.16)
  • Terminal: Terminal.app (macOS 26.3 Tahoe)
  • OS: macOS 26.3 (Apple M3 Max, 128GB)
  • Python: 3.12.8

Related Issues

  • #7316 — Similar escape sequence leak (bracketed-paste markers in Ghostty)
  • #4064 — Mouse support / cursor positioning discussion

Possible Root Cause

The spinner/activity display may be emitting CSI 6 n queries (or the terminal is sending unsolicited DSR responses), and prompt_toolkit's input parser is not consuming these responses before they reach the input buffer. The KawaiiSpinner or the status bar update logic could be the source.

extent analysis

TL;DR

Disable or modify the spinner/activity display to prevent emitting CSI 6 n queries, which are causing ANSI escape codes to leak into the Hermes CLI input field.

Guidance

  • Investigate the KawaiiSpinner and status bar update logic to determine if they are emitting CSI 6 n queries, and consider disabling or modifying them to prevent this.
  • Verify that prompt_toolkit's input parser is correctly configured to consume DSR responses before they reach the input buffer.
  • Check if there are any other potential sources of unsolicited DSR responses from the terminal, and consider implementing a workaround to handle these responses.
  • Review related issues #7316 and #4064 for potential insights into similar problems and their solutions.

Example

No code snippet is provided as the issue does not contain sufficient information to create a specific example.

Notes

The root cause of the issue is likely related to the spinner/activity display or the terminal sending unsolicited DSR responses, but further investigation is needed to determine the exact cause.

Recommendation

Apply a workaround by disabling or modifying the spinner/activity display, as this is the most likely cause of the issue and can be investigated and modified without requiring significant changes to the underlying code.

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