Windows: shell tool and git fail with "Access is denied. (os error 5)" when the CLI runs inside an AppContainer (named pipes in the global namespace)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 47/100
Hướng nghiên cứu
Start by locating the shell tool and git helper code that creates the copilot-command- and copilot-askpass- named pipes; the issue does not identify their source files. Read the Tokio Windows named pipe implementation and compare its behavior with libuv’s AppContainer change cited in the issue. Reproduce the failure in an AppContainer and check whether using the LOCAL pipe namespace fixes both server and client connections.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version: GitHub Copilot CLI 1.0.117 (copilot-win32-x64), Windows 11 build 26300, x64.
What happens
We run copilot.exe in a Windows AppContainer (a sandbox for coding agents: CreateProcessW with
PROC_THREAD_ATTRIBUTE_SECURITY_CAPABILITIES, one custom capability, loopback exemption for a local model endpoint). The CLI starts,
talks to the model (BYOK via COPILOT_PROVIDER_BASE_URL) and receives a tool call. Every attempt to start a child process then fails at once:
- the shell tool returns
<error: Access is denied. (os error 5)>and<shellId: 0 completed with exit code 1>; - the log shows
[rust:rt_git] … "error":"Failed to spawn git: Access is denied. (os error 5)"many times. (In this run git was
not on thePATHof the AppContainer process; the CLI still reports error 5, not "not found".)
The same copilot.exe with the same arguments and environment, started outside the AppContainer under the same user, runs the shell
tool and finishes normally.
What we measured
- Child processes as such work inside the same AppContainer. A small Rust program (rustc 1.98.0, same
stdcode for child pipes as
rustc 1.100.0) succeeds in the AppContainer with:std::process::CommandwithStdio::piped()for stdin, stdout and stderr (cmd.exe /c echo,git --version), also with
Stdio::null(),Stdio::inherit()and a pipe fromstd::io::pipe();- the exact
stdchain for child pipes:NtOpenFile("\Device\NamedPipe\", SYNCHRONIZE|GENERIC_READ), then an unnamed
NtCreateNamedPipeFilerelative to that handle, thenNtOpenFileof the client end: allSTATUS_SUCCESS; portable-pty0.9.0 (openpty,spawn_command) and the same ConPTY chain by hand (CreatePipe,CreatePseudoConsole,
UpdateProcThreadAttribute(PSEUDOCONSOLE),CreateProcessW).
- Only a named pipe in the global namespace fails inside the AppContainer:
CreateNamedPipeW(L"\\\\.\\pipe\\test-<pid>", PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE, PIPE_REJECT_REMOTE_CLIENTS, 1, 65536, 65536, 0, NULL)returnsINVALID_HANDLE_VALUE,GetLastError() == 5(ERROR_ACCESS_DENIED);NtCreateNamedPipeFilewith the absolute name\Device\NamedPipe\test-<pid>returns0xC0000022(STATUS_ACCESS_DENIED);- the same call with
\\.\pipe\LOCAL\test-<pid>succeeds, and a client opens it withCreateFileW.
Outside the AppContainer all three succeed.
runtime.nodeof 1.0.117 importsCreateNamedPipeW, contains tokio'snet/windows/named_pipe.rs, and contains the names
\\.\pipe\copilot-command-and\\.\pipe\copilot-askpass-. tokio'sServerOptions::createcallsCreateNamedPipeWwith the name
unchanged.- A file-system ETW trace (Microsoft-Windows-Kernel-File) of the failing run shows no lookup of
powershell.exeand no process start
between the tool call and the error; the error happens before any child is created. (The trace does not show named-pipe creation, so
this step is inferred, not traced.)
We therefore believe the shell tool and the git helper create their pipe servers under \\.\pipe\copilot-command-… and
\\.\pipe\copilot-askpass-…, which an AppContainer process may not do, and report the resulting error as a spawn failure.
Minimal reproduction
Any program started in an AppContainer that runs:
HANDLE h = CreateNamedPipeW(L"\\\\.\\pipe\\repro-1", PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
PIPE_TYPE_BYTE | PIPE_REJECT_REMOTE_CLIENTS, PIPE_UNLIMITED_INSTANCES,
65536, 65536, 0, NULL);
/* inside an AppContainer: h == INVALID_HANDLE_VALUE, GetLastError() == 5
with L"\\\\.\\pipe\\LOCAL\\repro-1": success */
To start it in an AppContainer: CreateAppContainerProfile, then CreateProcessW with EXTENDED_STARTUPINFO_PRESENT and
PROC_THREAD_ATTRIBUTE_SECURITY_CAPABILITIES set to the container SID.
Expected
The shell tool and git work inside an AppContainer, as other agents' child processes do.
Suggestion
When the process token is an AppContainer token (GetTokenInformation(..., TokenIsAppContainer, ...)), create the pipes under
\\.\pipe\LOCAL\ (for example \\.\pipe\LOCAL\copilot-command-…). The client side must use the same name; within the same
AppContainer LOCAL\ resolves to the same object. libuv made the same change for its child pipes in v1.53.0 (libuv issue #5178,
PR #5181).
Side note
During git root discovery the CLI walks up from the working directory and also opens the drive root (C:\), which an AppContainer
usually may not open (STATUS_ACCESS_DENIED). This looks harmless (the walk stops there), but it may be worth treating
ERROR_ACCESS_DENIED on a parent directory as "no repository" explicitly.
- Ngôn ngữ chính
- Python
- Star
- 11.5k
- Fork
- 2k
- Merge trung bình
- 6 giờ 34 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc 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
-
area:plugins
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
github/copilot-cli#5567 ·
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
github/copilot-cli#5489 ·
-
Built-in functions.view returns no content for large files despite documenting automatic truncationĐang mởarea:tools
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
github/copilot-cli#5476 ·
-
triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
github/copilot-cli#5377 ·
-
area:platform-windows area:tools
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
github/copilot-cli#5340 ·
Tất cả issue của github/copilot-cli
Issue tương tự
-
fidelity
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
backlog
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
sagemathinc/sagebrush#3434 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
marketing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
wuisabel-gif/MemWhale#576 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Status: Triage Suggestion
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
GTNewHorizons/GT-New-Horizons-Modpack#27957 ·
Maintainer thường phản hồi trong vòng 1 ngày