Skip to content

Restore ANSI colors for agent-launched terminals#4

Merged
dudetru25 merged 1 commit into
mainfrom
feat/ansi-terminal-colors
Jul 14, 2026
Merged

Restore ANSI colors for agent-launched terminals#4
dudetru25 merged 1 commit into
mainfrom
feat/ansi-terminal-colors

Conversation

@dudetru25

@dudetru25 dudetru25 commented Jul 14, 2026

Copy link
Copy Markdown
Member

What changed

  • sanitize the PTY environment when Unity is launched from a non-interactive TERM=dumb host
  • clear inherited NO_COLOR only for that host case, while preserving an explicit preference from interactive terminals
  • keep advertising xterm-256color and truecolor support
  • add regressions for PTY environment behavior and ANSI red/reset parsing

Root cause

Unity inherited TERM=dumb and NO_COLOR=1 from the agent host. Unterm replaced TERM and COLORTERM, but portable-pty also inherited NO_COLOR, so Codex correctly suppressed SGR color sequences before they ever reached Unterm's parser and renderer.

Impact

Codex and other color-aware terminal applications can render semantic colors, including red interruption/error text, when Unity was started from an agent or build environment. Users who intentionally set NO_COLOR from a normal interactive terminal keep that preference.

Validation

  • cargo test -p unterm --lib --locked — 58 passed, 1 ignored
  • repository CI-equivalent cargo clippy -p unterm --lib --bins --tests --locked with the workflow's documented legacy-lint allowances — passed
  • focused rustfmt --edition 2021 --check unterm/src/pty.rs — passed
  • independent PTY reproduction: Codex emitted 0 escape bytes with NO_COLOR=1 and 128 after NO_COLOR was unset

The repository-wide formatter and all-target example build still expose pre-existing unrelated debt (dump_selection references the removed unterm_get_pixels API); this PR does not change those paths.


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

@dudetru25 dudetru25 marked this pull request as ready for review July 14, 2026 01:45
@dudetru25 dudetru25 merged commit 2bd01c4 into main Jul 14, 2026
8 checks passed
@dudetru25 dudetru25 deleted the feat/ansi-terminal-colors branch July 14, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant