github / github/copilot-cli

Shell tool environment does not inherit user PATH - Nix-managed binaries unavailable in sessions

Offen
#2,397 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area:tools
Vorherrschende Sprache
Shell
Sterne
11.2k
Forks
1.9k
Ø Merge
14 Std. 16 Min.
Gemergte PRs (30 T.)
6

Beschreibung

## 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)

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

No source file or test is named. Start by reproducing the worktree-backed session on macOS and compare its bash PATH with launchd.user.envVariables and /etc/profiles/per-user/$USER/bin; done means the session can reach configured user binaries such as gh, or supports a documented additional-PATH configuration.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
shell
Bereich
cli
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.