Codespaces ships Copilot CLI 1.0.3 and `copilot update` only installs with `sudo`
还没有人认领这个 Issue。
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
描述
Describe the bug
A newly opened GitHub Codespace starts with GitHub Copilot CLI 1.0.3 installed at /usr/local/bin/copilot.
Running copilot update reports that version 1.0.80 was downloaded, but the installed binary is not replaced and copilot --version continues to report 1.0.3, even after opening a new terminal or restarting the Codespace.
Running sudo copilot update does successfully install the update. This indicates that the normal updater cannot replace the root-owned binary in /usr/local/bin, but still prints a success message.
Affected version
- Preinstalled version in the Codespace: 1.0.3
- Version reported as downloaded by the updater: 1.0.80
Steps to reproduce the behavior
- Open a GitHub Codespace.
- Run
copilot --versionand confirm that it reports GitHub Copilot CLI 1.0.3. - Run
copilot update. - Observe the message:
Copilot CLI version 1.0.80 downloaded. - Run
copilot --versionagain. - Open a new terminal or restart the Codespace and run
copilot --versionagain. - Run
sudo copilot updateand observe that the update succeeds.
Actual output
$ copilot --version
GitHub Copilot CLI 1.0.3.
Run 'copilot update' to check for updates.
$ copilot update
Checking for updates...
Copilot CLI version 1.0.80 downloaded.
$ copilot --version
GitHub Copilot CLI 1.0.3.
Run 'copilot update' to check for updates.
The version remains 1.0.3 after opening a new terminal and after restarting the Codespace. The update succeeds only when run as sudo copilot update.
Investigation
which -a copilotreturns a single path:/usr/local/bin/copilot.ls -la /usr/local/bin/copilotshows that the file is still dated March 9 after the non-sudo update, so the installed binary was not overwritten.- The normal updater appears unable to write to the root-owned
/usr/local/bin/copilotbinary. - Despite not replacing the binary, it prints a successful download message instead of reporting the installation failure.
- Running
sudo copilot updatesuccessfully performs the update.
Expected behavior
- New GitHub Codespaces should start with the current supported stable Copilot CLI version (1.0.80 at the time of this report, or the latest stable version), rather than the outdated 1.0.3 binary.
copilot updateshould actually replace the installed binary.- If the updater cannot write to
/usr/local/bin/copilot, it should exit with a non-zero status and clearly explain that elevated permissions are required, for example by suggestingsudo copilot update. - It should not display a success message unless the installed binary has been replaced and the new version can be verified.
Workaround
$ sudo copilot update
Environment
- GitHub Codespaces (devcontainer)
- Linux Codespace
- Initial Copilot CLI version: 1.0.3
- Update version reported by the CLI: 1.0.80
- Installed binary:
/usr/local/bin/copilot - Exact
uname -aoutput was not captured
Related issue
- #4405 — the stale preinstalled binary and failed non-sudo update prevented verification with the newer CLI version suggested there.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先在 GitHub Codespace 中复现 copilot update,并检查 copilot update 的入口点以及 /usr/local/bin/copilot 中的安装。比较普通运行和使用 sudo 的运行,包括它们的退出状态和版本输出。当受支持的版本可在新的 Codespaces 中使用、替换失败时能得到清晰报告,并且只有在已安装版本发生变化后才显示成功时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- linux, shell
- 领域
- cli, devops
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100