Bug: /copy fails with "Connection refused" — snap package missing x11/wayland plug
- 主要語言
- Shell
- 星號
- 11.2k
- 分支
- 1.9k
- 平均合併
- 14 小時 16 分鐘
- 30 天內合併 PR
- 6
描述
### Describe the bug
On Linux, the `/copy` command in GitHub Copilot CLI fails with:
`Failed to copy to clipboard: Error: Failed to create clipboard context: Connection refused (or error 111)`
### Root Cause
The Linux distribution of Copilot CLI is packaged as a **snap**, and the snap's declared interfaces do not include `x11` or `wayland`. Clipboard access on Linux requires a direct connection to the X11 (or Wayland) display server socket, which snap's confinement blocks unless the snap explicitly declares and connects one of those interfaces. Since neither is declared, there is no `snap connect` command available to fix this — the plug simply doesn't exist in the snap's metadata.
### Affected version
1.0.70 (Install method: snap `/snap/copilot-cli/53/bin/copilot`)
### Steps to reproduce the behavior
1. Install/run GitHub Copilot CLI via the snap package on a Linux desktop with an active X11 session.
2. Start an interactive session and let the assistant produce any response.
3. Run `/copy` to copy the last response to the system clipboard.
### Expected behavior
The last assistant response is copied to the system clipboard, as documented in `/help`:
`/copy - Copy the last response to the clipboard`
### Additional context
#### OS/Environment
- **OS/session:** Ubuntu-based Linux desktop, X11 session (`XDG_SESSION_TYPE=x11`, `DISPLAY=:1`)
- **Desktop Environment:** GNOME desktop (`gnome-terminal-server`)
- **Streaming Protocol:** Amazon DCV/WSP streaming protocol (AWS WorkSpaces), accessed via the AWS WorkSpaces client on macOS (Apple Silicon MacBook Pro)
- **Terminal emulator:** gnome-terminal
---
#### Diagnostic Steps & Evidence
1. **Clipboard Works Separately:** Copy/paste between other applications in the same session (terminal, text editor, browser) works correctly. This rules out broken X11 sessions, window manager clipboard mechanisms, or remote-desktop bridging problems. The issue is unique to the Copilot CLI process.
2. **Snap Confinement Restrictions:** Running commands inside the CLI's shell tool environment yields permission blocks:
- `/usr/bin/snap` returns `Permission denied` (exit code 126).
- Running a normal executable (`venv/bin/python`, mode `0755` owned by current user) returns `Permission denied` (exit code 126).
- `xset q` reports the X server as unreachable when run from inside the CLI's shell tool.
3. **Missing Plugs:** `snap connections copilot-cli` shows the snap only requests `desktop` / `desktop-legacy` but lacks `x11` and `wayland`:
貢獻指南
研究方向
先定位 snap 套件的中繼資料,並檢查 `snap connections copilot-cli` 公開的介面;該 issue 指出缺少 `x11` 和 `wayland` plugs 是疑似原因。在 Linux 桌面工作階段中重現 `/copy`,然後確認 snap 是否公開了必要的顯示存取權,以及該命令是否成功複製最後一個回應。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- linux
- 領域
- cli, devops, operating-systems
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 52/100