Skip to content

fix(cli): render /tools list through prompt_toolkit#8630

Closed
sgaofen wants to merge 1 commit into
NousResearch:mainfrom
sgaofen:codex/tools-list-ansi-renderer
Closed

fix(cli): render /tools list through prompt_toolkit#8630
sgaofen wants to merge 1 commit into
NousResearch:mainfrom
sgaofen:codex/tools-list-ansi-renderer

Conversation

@sgaofen

@sgaofen sgaofen commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • route /tools list output through prompt_toolkit's ANSI renderer instead of plain print()
  • keep built-in, plugin, and MCP sections using the same ANSI-safe output path
  • add a regression test that verifies /tools list goes through the prompt_toolkit printer

Root Cause

/tools list built colored status strings with ANSI escapes and sent them to plain print(). Inside the prompt_toolkit-backed CLI, those raw escape sequences could show up literally instead of rendering as styled output.

Closes #4128.

Validation

  • uv run --extra dev pytest tests/hermes_cli/test_tools_disable_enable.py -k 'list'
  • python3 -m py_compile hermes_cli/tools_config.py tests/hermes_cli/test_tools_disable_enable.py

Platform Tested

  • macOS 15.x (Apple Silicon)

Contribution Guide Notes

  • Reviewed CONTRIBUTING.md and checked for existing open PRs before submitting this scoped change.
  • Ran the targeted verification commands listed above for this PR. I have not claimed a full repo-wide pytest tests/ -q pass unless explicitly noted.

@sgaofen sgaofen changed the title [codex] render /tools list through prompt_toolkit fix(cli): render /tools list through prompt_toolkit Apr 12, 2026
@sgaofen sgaofen marked this pull request as ready for review April 13, 2026 00:53
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the contribution @sgaofen! This fix was independently landed in commit 9de4a38ce on the same day the PR was opened, and has shipped in v2026.4.23.

This is an automated hermes-sweeper review.

Evidence:

  • cli.py lines 4503–4555: _handle_tools_command already contains _run_capture() with a _TTYBuf(StringIO) that fakes isatty()=True, redirects stdout, runs tools_disable_enable_command, then re-prints each line through _cprint()print_formatted_text(ANSI(...)) — the exact same approach.
  • Commit 9de4a38ce message: "fix(tui): make '/tools list' show real colors instead of '?[32m' etc. gibberish" — same root cause, same fix.
  • Released in v2026.4.23.

The test coverage added by this PR (+27 lines in test_tools_disable_enable.py) is appreciated; if you'd like to open a follow-up PR that adds just the regression tests, that would be welcome.

@teknium1 teknium1 closed this Apr 28, 2026
@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 Apr 28, 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.

[Bug]: /tools list shows raw terminal escape codes

3 participants