[Bug] Resumed session injects COLORTERM=truecolor and changes prompt highlight color
还没有人认领这个 Issue。
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
描述
Describe the bug
Resuming a Copilot CLI session can inject COLORTERM=truecolor into the spawned session process even though the launching shell and parent Copilot process have COLORTERM unset. This changes the submitted-user-prompt highlight from the terminal-palette green rendering to a gray truecolor background.
The result is inconsistent UI rendering between two Copilot sessions launched by the same WSL user, with the same global theme: "github" setting, the same Windows Terminal profile, and TERM=xterm-256color.
Process inspection showed:
- Direct launch from Bash:
- process is a direct child of the login shell;
COLORTERMis unset;- submitted user prompts have a green highlight.
- Resumed session:
copilot --allow-all --remote --resumespawns a child Copilot process with--session-id;- the shell and parent Copilot process have
COLORTERMunset; - the spawned child has
COLORTERM=truecolor; - submitted user prompts have a gray highlight.
There is no repository-local Copilot setting or Git color configuration explaining the difference. copilot help config exposes only whole-theme presets and no prompt-background setting.
Affected version
GitHub Copilot CLI 1.0.76-3
The long-running resumed session was originally started on an earlier 1.0.76 build and survived CLI updates, but the current process/executable reports 1.0.76-3.
Steps to reproduce the behavior
-
Open a fresh WSL2 Bash shell in Windows Terminal.
-
Confirm the variable is absent:
printenv COLORTERM -
Launch Copilot directly:
copilot --allow-all --remote -
Submit a prompt and observe the user-message highlight.
-
In another fresh shell with
COLORTERMstill unset, resume a saved session:copilot --allow-all --remote --resume -
Select a session, submit a prompt, and observe that the highlight color differs.
-
Inspect the processes:
ps -eo pid,ppid,args | grep '[c]opilot' tr '\0' '\n' </proc/<copilot-pid>/environ | grep -E '^(TERM|COLORTERM|WT_SESSION)=' -
Observe that the resumed child has
COLORTERM=truecolor, while its parent Copilot process and launching Bash shell do not.
Expected behavior
Copilot CLI should preserve the launching terminal's color-capability environment consistently across direct, resumed, and restarted sessions.
A resumed child process should not inject or change COLORTERM relative to its launching shell/parent. With the same terminal and theme setting, submitted user prompts should render with the same highlight colors.
Additional context
- OS: WSL2 Linux, x86_64
- Terminal: Windows Terminal
- Shell: Bash login shell
TERM=xterm-256colorin both sessions- Same Windows Terminal profile ID in both sessions
- User setting:
"theme": "github" - No repository-local theme/config override found
- The only observed discriminator was
COLORTERM=truecoloron the resumed child
Related open issues:
- #3591 — user prompt visual distinction/configuration
- #4292 — truecolor-related rendering differences
- #4212 — prompt/highlight rendering differs by terminal context
This report is narrower: it concerns Copilot CLI's resumed-session process launch changing COLORTERM, producing different rendering without any terminal, user, repository, or theme-setting change.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
在 WSL2 Bash 中重现直接启动和恢复启动,然后按照描述使用 ps 和 /proc//environ 检查恢复的子进程。跟踪带有 --session-id 的子进程是如何启动的,并确保它保留启动它的 shell 的 COLORTERM 状态;当直接、恢复和重新启动的会话在相同的终端设置下呈现相同的提示符高亮时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- bash, linux, shell
- 领域
- cli, operating-systems
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100