@@ -555,10 +555,17 @@ export function generateDockerCompose(
555555 SQUID_PROXY_PORT : SQUID_PORT . toString ( ) ,
556556 HOME : homeDir ,
557557 PATH : '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
558- // Disable ANSI color output from CLI tools (Rich, Chalk, etc.) inside the container .
559- // Tools like Rich inject ANSI escape codes that break test assertions expecting plain text .
558+ // Color output control: when --tty is set, enable color output for tools that support it .
559+ // When tty is off (default), disable colors to avoid ANSI escape codes in log output .
560560 // NO_COLOR is a standard convention (https://no-color.org/) supported by many libraries.
561- NO_COLOR : '1' ,
561+ // FORCE_COLOR is used by Chalk, Rich, and other tools to enable color output.
562+ ...( config . tty ? {
563+ FORCE_COLOR : '1' ,
564+ TERM : 'xterm-256color' ,
565+ COLUMNS : '120' ,
566+ } : {
567+ NO_COLOR : '1' ,
568+ } ) ,
562569 // Configure one-shot-token library with sensitive tokens to protect
563570 // These tokens are cached on first access and unset from /proc/self/environ
564571 AWF_ONE_SHOT_TOKENS : 'COPILOT_GITHUB_TOKEN,GITHUB_TOKEN,GH_TOKEN,GITHUB_API_TOKEN,GITHUB_PAT,GH_ACCESS_TOKEN,OPENAI_API_KEY,OPENAI_KEY,ANTHROPIC_API_KEY,CLAUDE_API_KEY,CODEX_API_KEY' ,
@@ -668,7 +675,8 @@ export function generateDockerCompose(
668675 // it gets a placeholder value set earlier (line ~362) for credential isolation
669676 if ( process . env . COPILOT_GITHUB_TOKEN && ! config . enableApiProxy ) environment . COPILOT_GITHUB_TOKEN = process . env . COPILOT_GITHUB_TOKEN ;
670677 if ( process . env . USER ) environment . USER = process . env . USER ;
671- if ( process . env . TERM ) environment . TERM = process . env . TERM ;
678+ // When --tty is set, we use TERM=xterm-256color (set above); otherwise inherit host TERM
679+ if ( process . env . TERM && ! config . tty ) environment . TERM = process . env . TERM ;
672680 if ( process . env . XDG_CONFIG_HOME ) environment . XDG_CONFIG_HOME = process . env . XDG_CONFIG_HOME ;
673681 // Enterprise environment variables — needed for GHEC/GHES Copilot authentication
674682 if ( process . env . GITHUB_SERVER_URL ) environment . GITHUB_SERVER_URL = process . env . GITHUB_SERVER_URL ;
0 commit comments