Skip to content

ANSI escape codes leak into redirected output #1391

@Hweinstock

Description

@Hweinstock

CLI commands emit raw ANSI escape characters when output is redirected to a file or piped to another program.

Reproduction:

agentcore import --source my-agent.yaml 2> log.txt
cat log.txt

Expected:

[error] Import failed: Source file not found: my-agent.yaml

Actual:

\x1b[31m[error]\x1b[0m Import failed: Source file not found: my-agent.yaml

This affects any non-TUI command that writes colored output (e.g. agentcore import). The NO_COLOR (https://no-color.org/) environment variable is also not respected.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions