/ide finds no workspaces under the CLI sandbox: kill(pid,0) EPERM misread as a dead process
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript
- Lĩnh vực
- cli
Hướng nghiên cứu
Bắt đầu trong app.js tại hàm phát hiện IDE kB() và so sánh hft() với helper liveness b_o() hiện có. Truy vết quá trình lọc tệp khóa trước khi thăm dò socket oft()/yft(). Hoàn thành khi EPERM không còn loại bỏ một workspace đang hoạt động, để /ide phát hiện và kết nối tới IDE có thể truy cập từ sandbox; hãy xác minh bản tái hiện trong sandbox và đầu ra gỡ lỗi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
When Copilot CLI runs with its own sandbox enabled ("enabled": true), /ide always reports
"No active IDE workspaces found." — even though a compatible IDE is running, the lock file is
present and valid, and the IDE's MCP socket is reachable from inside the sandbox.
Running the exact same CLI version from the same directory outside the sandbox connects to the
IDE immediately.
Root cause
IDE discovery (kB() in app.js) filters lock files through a process-liveness check before it
ever probes the socket:
function hft(e){ try{ return process.kill(e,0), !0 } catch { return !1 } }
// ...
if(!hft(d.pid)){
C.debug(`Skipping stale lock file (PID ${d.pid} not running): ${l}`);
continue;
}
hft() swallows the error code and treats any throw as "process not running".
The bundled seatbelt profile (prebuilds/darwin-arm64/runtime.node) contains:
(allow signal (target same-sandbox))
The IDE process lives outside the CLI's sandbox, so it is not same-sandbox. process.kill(pid, 0)
therefore fails with EPERM, not ESRCH.
EPERM from kill(pid, 0) means "the process exists, but you are not permitted to signal it" —
i.e. the process is alive. It is the one error code that positively proves liveness. Treating it
as "dead" discards every lock file, and discovery returns zero entries before the socket probe
(oft() / yft()) is reached.
The CLI already has a second liveness helper elsewhere in the same bundle that handles this
correctly:
function b_o(e){
try{ return process.kill(e,0), !0 }
catch(t){ const n = t.code; return n === "ESRCH" ? !1 : n === "EPERM" }
}
So this is an inconsistency between two copies of the same check, not a design decision.
Evidence
Measured from inside the sandbox, against a live IDE lock file:
Step in kB() |
Result |
|---|---|
read ~/.copilot/ide/*.lock |
OK — lock present, workspaceFolders matches cwd |
hft(pid) → process.kill(pid, 0) |
throws EPERM (not ESRCH) |
oft(socketPath, 250) socket probe |
connects in 0–2 ms — but never reached |
curl --unix-socket <socketPath> http://localhost/ |
HTTP 404 (server alive and responding) |
The debug lines this path emits when the sandbox is on (visible with debug logging enabled):
Skipping stale lock file (PID <pid> not running): <uuid>.lock
Discovered 0 IDE workspace entries
With the sandbox off, the same lock file yields (observed at default log level):
Connecting to IDE MCP server: IntelliJ IDEA (<workspace>)
Connected to IDE MCP server: IntelliJ IDEA
Affected version
GitHub Copilot CLI 1.0.86, macOS (darwin-arm64). Reproduced with JetBrains IDEs; the discovery code
is IDE-agnostic, so VS Code should be affected identically.
Steps to reproduce the behavior
- Open a project in a compatible IDE with the Copilot CLI integration, so that a lock file appears
in~/.copilot/ide/. - Run
copilotin that same directory with sandboxing enabled (I am using Anthropic SRT). - Run
/ide. - Observe "No active IDE workspaces found."
- Re-run
copilotwith the sandbox disabled and run/ideagain — the workspace is listed and
connects.
Expected behavior
/ide should list and connect to the running IDE workspace regardless of whether the CLI is
sandboxed. Socket reachability — which already works under the sandbox — is the authoritative
liveness signal here.
Suggested fix
Treat EPERM as alive in hft(), matching the existing b_o() helper:
function hft(pid){
try { process.kill(pid, 0); return true }
catch (e) { return e.code === "EPERM" } // EPERM => exists, not signalable
}
Two alternatives, either of which also resolves it:
- Drop the PID pre-filter entirely and rely on the socket probe (
yft/oft), which is a stronger
liveness check and already sandbox-safe. - Widen the seatbelt profile to permit
kill(pid, 0)against non-sandboxed PIDs — but the code-level
fix is simpler and does not weaken the sandbox.
Notes
No user-facing sandbox setting can work around this: the (allow signal (target same-sandbox)) rule
is compiled into the runtime binary, and the network / filesystem / ignoreViolations config
keys do not cover signal delivery. The only current workaround is to run the CLI unsandboxed, which
is an unfortunate trade-off for a feature that otherwise works fine under the sandbox.
- Ngôn ngữ chính
- Shell
- Star
- 11.2k
- Fork
- 1.9k
- Merge trung bình
- 14 giờ 16 phút
- Pull request đã merge (30 ngày)
- 6
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/copilot-cli
-
triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
github/copilot-cli#4932 ·
-
triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
github/copilot-cli#4906 ·
-
triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
github/copilot-cli#4848 ·
-
area:agents area:mcp
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
github/copilot-cli#4729 ·
-
area:sessions
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
github/copilot-cli#4712 ·
Tất cả issue của github/copilot-cli
Issue tương tự
-
Issue-Enhancement Needs-Triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
PowerShell/PowerShell#28061 · 2 reaction ·
-
Feature Request: Add ability to load custom environment variables in linux-exec-server-installer.sh Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
microsoft/vscode-remote-release#11867 ·
-
AuTest Bug Tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/trafficserver#13714 ·
-
Update to NCCL 2.32 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
conda-forge/nccl-feedstock#166 ·
-
Fix codex-seed-model-cache.sh Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
vllm-project/agentic-api#358 · 1 bình luận ·