Shell tool environment does not inherit user PATH - Nix-managed binaries unavailable in sessions
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
描述
## Describe the bug
In worktree-backed sessions, the bash tool runs with a minimal PATH that does not include paths configured via `launchd.user.envVariables` or `/etc/profiles/per-user/$USER/bin`.
On macOS with Nix (nix-darwin + home-manager), binaries like `gh` are installed at `/etc/profiles/per-user/daniel/bin/gh` but are not reachable inside sessions. The shell only sees:
```
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
```
The `environment_context` block in sessions also documents this limitation explicitly:
```
Available tools: git, curl
```
There is currently no way to extend or configure additional paths for the session shell.
## Affected version
## Steps to reproduce the behavior
1. Install `gh` via Nix on macOS (nix-darwin + home-manager), binary lands at `/etc/profiles/per-user/$USER/bin/gh`
2. Open a Copilot CLI worktree session
3. Run `which gh` or `gh --version` in the bash tool
4. Command fails with `command not found`
## Expected behavior
The session shell should inherit the user's launchd environment PATH (set via `launchd.user.envVariables`), or provide a way to configure additional PATH entries (e.g. via `.copilot/config.json`).
## Additional context
- macOS aarch64 (Apple Silicon)
- Package manager: nix-darwin + home-manager
- `gh` present at `/etc/profiles/per-user/daniel/bin/gh`
- PATH is correctly set for all other GUI apps and terminals after `launchd.user.envVariables` is only Copilot CLI sessions are affectedconfigured
- Workaround: call binaries via absolute path (fragile, not documented)
贡献指南
调研方向
未指定源文件或测试。首先在 macOS 上复现基于 worktree 的会话,并将其 bash PATH 与 launchd.user.envVariables 和 /etc/profiles/per-user/$USER/bin 进行比较;当该会话能够访问已配置的用户二进制文件(例如 gh),或支持有文档说明的额外 PATH 配置时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- shell
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100