fix(tui): make "/tools list" show real colors instead of "?[32m" etc.…#9091
Closed
dsocolobsky wants to merge 2 commits into
Closed
fix(tui): make "/tools list" show real colors instead of "?[32m" etc.…#9091dsocolobsky wants to merge 2 commits into
dsocolobsky wants to merge 2 commits into
Conversation
… gibberish The colored ✓/✗ marks in /tools list, /tools enable, and /tools disable were showing up as "?[32m✓ enabled?[0m" instead of green and red. The colors come out as ANSI escape codes, but the tui eats the ESC byte and replaces it with "?" when those codes are printed straight to stdout. They need to go through prompt_toolkit's renderer. Fix: capture the command's output and re-print each line through _cprint(), the same workaround used elsewhere for NousResearch#2262. The capture buffer fakes isatty()=True so the color helper still emits escapes (StringIO.isatty() is False, which would otherwise strip colors). The capture path only runs inside the TUI; standalone CLI and tests go straight through to real stdout where colors already work.
1 task
19 tasks
teknium1
added a commit
that referenced
this pull request
Apr 20, 2026
Contributor
|
Merged via PR #13187 (#13187). Your commit was cherry-picked onto current main with your authorship preserved in git log. Thanks @dsocolobsky! |
ulasbilgen
pushed a commit
to ulasbilgen/hermes-adhd-agent
that referenced
this pull request
May 1, 2026
…ousResearch#9091, NousResearch#13131 - Fix duplicate 'timezone' import in e2e conftest - Fix test_text_before_command_not_detected asserting send() is awaited when no agent is present in mock setup (text messages don't produce command output)
aj-nt
pushed a commit
to aj-nt/hermes-agent
that referenced
this pull request
May 1, 2026
…ousResearch#9091, NousResearch#13131 - Fix duplicate 'timezone' import in e2e conftest - Fix test_text_before_command_not_detected asserting send() is awaited when no agent is present in mock setup (text messages don't produce command output)
Luminet2023
pushed a commit
to Luminet2023/hermes-agent
that referenced
this pull request
May 1, 2026
…ousResearch#9091, NousResearch#13131 - Fix duplicate 'timezone' import in e2e conftest - Fix test_text_before_command_not_detected asserting send() is awaited when no agent is present in mock setup (text messages don't produce command output)
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…ousResearch#9091, NousResearch#13131 - Fix duplicate 'timezone' import in e2e conftest - Fix test_text_before_command_not_detected asserting send() is awaited when no agent is present in mock setup (text messages don't produce command output)
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…ousResearch#9091, NousResearch#13131 - Fix duplicate 'timezone' import in e2e conftest - Fix test_text_before_command_not_detected asserting send() is awaited when no agent is present in mock setup (text messages don't produce command output)
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
…ousResearch#9091, NousResearch#13131 - Fix duplicate 'timezone' import in e2e conftest - Fix test_text_before_command_not_detected asserting send() is awaited when no agent is present in mock setup (text messages don't produce command output)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes a display bug where
/tools list,/tools enable, and/tools disableshowed garbled text like?[32m✓ enabled?[0minstead of green/red marks inside the interactive TUI.Why it happens: the
color()helper emits real ANSI escape codes (\x1b[32m...). When those go throughprint()inside the TUI, prompt_toolkit'spatch_stdoutproxy treats\x1bas an unprintable control character and replaces it with?. Same issue as in #2262 (already documented incli.py:6229-6232for/tool-progress).The fix: in
_handle_tools_command, capture the backend's stdout into a buffer and replay each line through_cprint(), which routes ANSI properly via prompt_toolkit's renderer. Two small details:StringIOand overrideisatty()to returnTrue, so whencolor()checks whether it's writing to a terminal it gets a yes and emits the escape codes, otherwise it would strip colors out before we could re-render them.Related Issue
Fixes #9017
Type of Change
Changes Made
cli.py—_handle_tools_command: added a_run_capture()inner helper that captures stdout fromtools_disable_enable_command()into a TTY-claimingStringIOand replays each line through_cprint(). Applied to all three subcommands (list,disable,enable) sincedisable/enablealso emit colored success/error lines viaprint_success/print_error. Wrapped in agetattr(self, "_app", None) is Noneguard so non-TUI callers (standalone scripts, tests) bypass the capture and go straight to stdout.How to Test
/tools list,tools disable web,tools enable weband verify the output is correct with colors.hermes tools listand verify the CLI colors still work.pytest tests/cli/test_cli_tools_command.py tests/hermes_cli/test_tools_disable_enable.py -q, all 27 tests pass.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings)cli-config.yaml.exampleif I added/changed config keysCONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflowsScreenshots / Logs
Before:

After:
