@@ -536,10 +536,17 @@ export function generateDockerCompose(
536536 SQUID_PROXY_PORT : SQUID_PORT . toString ( ) ,
537537 HOME : homeDir ,
538538 PATH : '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
539- // Disable ANSI color output from CLI tools (Rich, Chalk, etc.) inside the container .
540- // Tools like Rich inject ANSI escape codes that break test assertions expecting plain text .
539+ // Color output control: when --tty is set, enable color output for tools that support it .
540+ // When tty is off (default), disable colors to avoid ANSI escape codes in log output .
541541 // NO_COLOR is a standard convention (https://no-color.org/) supported by many libraries.
542- NO_COLOR : '1' ,
542+ // FORCE_COLOR is used by Chalk, Rich, and other tools to enable color output.
543+ ...( config . tty ? {
544+ FORCE_COLOR : '1' ,
545+ TERM : 'xterm-256color' ,
546+ COLUMNS : '120' ,
547+ } : {
548+ NO_COLOR : '1' ,
549+ } ) ,
543550 // Configure one-shot-token library with sensitive tokens to protect
544551 // These tokens are cached on first access and unset from /proc/self/environ
545552 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' ,
@@ -649,7 +656,8 @@ export function generateDockerCompose(
649656 // it gets a placeholder value set earlier (line ~362) for credential isolation
650657 if ( process . env . COPILOT_GITHUB_TOKEN && ! config . enableApiProxy ) environment . COPILOT_GITHUB_TOKEN = process . env . COPILOT_GITHUB_TOKEN ;
651658 if ( process . env . USER ) environment . USER = process . env . USER ;
652- if ( process . env . TERM ) environment . TERM = process . env . TERM ;
659+ // When --tty is set, we use TERM=xterm-256color (set above); otherwise inherit host TERM
660+ if ( process . env . TERM && ! config . tty ) environment . TERM = process . env . TERM ;
653661 if ( process . env . XDG_CONFIG_HOME ) environment . XDG_CONFIG_HOME = process . env . XDG_CONFIG_HOME ;
654662 // Enterprise environment variables — needed for GHEC/GHES Copilot authentication
655663 if ( process . env . GITHUB_SERVER_URL ) environment . GITHUB_SERVER_URL = process . env . GITHUB_SERVER_URL ;
0 commit comments