github / github/copilot-cli

Fails with "posix_spawnp failed" and then misdiagnoses command as missing

未關閉
#2,736 3 則留言 6 個 reaction 已指派 0 人 在 GitHub 檢視
area:tools
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

### Describe the bug

GitHub Copilot CLI fails to launch a shell command with:

``

After that, the agent may incorrectly conclude that the command is not installed or not on `PATH`, even when the command exists and runs normally outside Copilot.

### Environment

- Copilot CLI: `1.0.27`
- macOS: `26.4` (`25E246`)
- Architecture: `arm64`
- Terminal: Reproduced in Ghostty and Terminal app

### Expected behavior

Copilot should either:
- run the shell command successfully, or
- report a shell/process-launch failure without inferring that the command is missing.

It should not translate `posix_spawnp failed` into “command not found” unless it has separately verified that.

### Actual behavior

Copilot returns:
```

```
and then incorrectly infers that the command is unavailable or not on PATH.

### Reproduction

Prompt used:
```
Run exactly: command -v teamcity && teamcity auth status. Do not explain, just use the shell tool and report the result.
```
### Observed results

#### 1. Direct shell outside Copilot

This succeeds:
```
command -v teamcity && teamcity auth status
```
Output begins with:

/opt/homebrew/bin/teamcity

and the authentication status is reported correctly.

#### 2. Copilot non-interactive without broad approval

Command:
```
copilot -p "Run exactly: command -v teamcity && teamcity auth status. Do not explain, just use the shell tool and report the result."
```
Result:

Permission denied and could not request permission from user

That is understandable for non-interactive permissions.

#### 3. Copilot non-interactive with broad approval

Command:
```
copilot -p "Run exactly: command -v teamcity && teamcity auth status. Do not explain, just use the shell tool and report the result." --allow-all-tools
```
Result:

### Why this looks like a CLI bug

The same shell command works outside Copilot in the same environment.

This suggests:

1. a shell/process-launch failure inside Copilot CLI, and
2. a reasoning/diagnostic bug where posix_spawnp failed is treated as if the command were missing from PATH.

### Affected version

1.0.27

### Steps to reproduce the behavior
```
brew install jetbrains/utils/teamcity
copilot -p "Run exactly: command -v teamcity && teamcity auth status. Do not explain, just use the shell tool and report the result."
```

### Expected behavior

_No response_

### Additional context

_No response_

貢獻指南

開啟貢獻指南

研究方向

Start by reproducing the issue with `copilot -p` using the `teamcity` command, both with and without `--allow-all-tools`, and compare it with the direct shell invocation. Trace the CLI's shell-tool process launch and error handling around `posix_spawnp failed`. Done means the command launches when permitted, or the CLI reports a process-launch failure without claiming the command is missing from PATH.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
macos, shell
領域
cli, operating-systems
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。