microsoft / microsoft/vscode

Linux Remote-SSH Copilot shim blocks installer prompt and leaves CLI outside terminal PATH

Open
#335,110 0 comments 0 reactions 1 assignee Claimed by @zhichli View on GitHub
stale triage-needed
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

## Type of issue

Bug in the GitHub Copilot Chat extension's Linux Copilot CLI bootstrap shim on a VS Code Remote-SSH host.

Related Windows discovery issue: #291990. Further investigation shows that the Linux shim's CLI discovery works when the installed CLI is present later in `PATH`; the failure here is in the shim-initiated interactive installation and remote-shell PATH handoff.

## Environment

- Date reproduced: September 8, 2026
- Local client: macOS arm64
- VS Code: 1.136.1
- Remote host: Ubuntu 22.04 x64 Cloud Development Environment
- Connection: VS Code Remote-SSH
- Copilot CLI installed: `1.0.84-2`
- Shim: `~/.vscode-server/data/User/globalStorage/github.copilot-chat/copilotCli/copilot`
- Shim implementation: `copilotCLIShim.js`
- Standalone CLI: `~/.local/bin/copilot`

## Steps to reproduce

1. Connect to an Ubuntu host using VS Code Remote-SSH.
2. Open an integrated Bash terminal on the remote host where `~/.local/bin` is not currently in `PATH`.
3. Run `copilot`.
4. The extension shim reports that Copilot CLI is missing and prompts to install it.
5. Enter `y`.
6. The shim invokes the official installer, which downloads and checksum-validates the release and installs it to `~/.local/bin/copilot`.
7. The installer reaches its interactive PATH prompt:

```text
Notice: /home//.local/bin is not in your PATH
Would you like to add it to /home//.profile? [y/N]
```

8. Keyboard input is not accepted at this nested prompt.

## Actual behavior

The outer shim prompt accepts input, but the nested installer's `/dev/tty` prompt does not. The installation itself succeeds, leaving a valid executable outside the integrated terminal's active `PATH`.

A subsequent `copilot` invocation resolves to the shim again and repeats the missing/install prompt because `~/.local/bin` remains absent from the terminal PATH.

Relevant state:

```text
$ which copilot
/home//.vscode-server/data/User/globalStorage/github.copilot-chat/copilotCli/copilot

$ ~/.local/bin/copilot --version
GitHub Copilot CLI 1.0.84-2.
```

The default Ubuntu `~/.profile` already contains logic to add `~/.local/bin`, but VS Code's integrated interactive Bash terminal is non-login and does not read `~/.profile`. In this environment:

```text
bash -lc 'echo $PATH' # includes ~/.local/bin
bash -ic 'echo $PATH' # does not include ~/.local/bin
```

## Verified discovery behavior

The Linux shim **does** correctly find the standalone CLI when it is later in `PATH`:

```bash
shimdir="$HOME/.vscode-server/data/User/globalStorage/github.copilot-chat/copilotCli"
PATH="$shimdir:$HOME/.local/bin:/usr/local/bin:/usr/bin:/bin" \
"$shimdir/copilot" --version
```

Result:

```text
GitHub Copilot CLI 1.0.84-2.
```

Therefore this is not the same discovery failure as #291990.

## Likely mechanism

The generated `copilotCLIShim.js` creates a Node `readline.Interface` on `process.stdin` for its own prompts and keeps it open while synchronously launching:

```text
bash -c "curl -fsSL https://gh.io/copilot-install | bash"
```

with inherited stdio. The official installer then prompts using `read `. The observed failure is consistent with the parent shim's still-open readline consumer interfering with the nested child's terminal input.

The shim should close or pause its readline interface before launching an interactive child, then recreate it afterward if needed.

## Expected behavior

After accepting installation:

1. The installer PATH prompt accepts input, or the shim installs non-interactively and handles PATH itself.
2. The newly installed CLI is immediately launched or the user receives instructions that work for a VS Code non-login Bash terminal.
3. A subsequent `copilot` invocation does not repeat installation.

## Workaround

```bash
export PATH="$HOME/.local/bin:$PATH"
hash -r
```

For future integrated terminals, add the same export to `~/.bashrc`, not only `~/.profile`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.