Repository navigation
Description
Summary
On Windows, mcpp 2026.11.21.1 converts the home it is given (MCPP_HOME) into
a physical path. Inside a Less Privileged AppContainer (LPAC) that sees its
private tree only through a drive alias, the physical path leads through
directories the container cannot open, so mcpp cannot open its home or start
xlings from it. When the physical tree is made reachable by a diagnostic
hack, mcpp's compiler probe fails next: clang++ exits with "permission
denied", which is what clang++, clang-scan-deps and lld-link do whenever they
are started by their physical path in this sandbox.
CodeStudio Agent builds user projects inside such a sandbox. Its isolated
build test (tests/mcpp_build_integration.py in CodeStudio Agent) is suspended
until mcpp can run there.
Environment
- mcpp 2026.11.21.1, the
mcpp-2026.11.21.1-windows-x86_64release, with
xlings 2026.11.21.1 from the same release. - Windows 11 Home China 10.0.26300, x64.
- LLVM 22.1.8 (
clang++.exe,clang-scan-deps.exe,lld-link.exe,
llvm-ar.exe), used throughMCPP_TOOLCHAIN=path:<llvm>. - MSVC 19.44.35230 (VC tools 14.44.35207), for the
cl.execomparison only. - Observed on 2026-11-25 and 2026-11-26.
How the sandbox presents paths
CodeStudio Agent (src/platform/windows_sandbox.cpp) runs each build step in
an LPAC AppContainer. It stages the step's inputs in a private directory under
the host's temporary directory, <TEMP>\codestudio-sandbox-<id>\, and grants the container
access to that tree only. The ancestors of the tree (D:\, D:\Dev, ...) are
not accessible to the container.
So that a tool never needs those ancestors, the host creates a per-process
object-manager symbolic link from a free drive letter to the tree
(\??\Z: -> \??\D:\...\codestudio-sandbox-<id>, through
NtCreateSymbolicLinkObject). Every path the step receives uses that letter:
Z:\work\workspace (the project and working directory), Z:\work\home (the
home directory) and Z:\bin\<mount> (read-only tool mounts). Inside the
container, opening C:\ or D:\ fails with error 5 (access denied), and
Z:\ opens.
What happens
1. mcpp converts the home it is given into a physical path
The sandbox passes every path with the drive letter: MCPP_HOME, the
arguments, the working directory and the image path of mcpp.exe.
mcpp self env, run as a sandbox step with MCPP_HOME=Z:\work\workspace\mcpp-home
and MCPP_OFFLINE=1, printed the home and every path derived from it under the
physical tree, not under Z::
MCPP_HOME = D:/Dev/tmp/t/codestudio-sandbox-40f2ae807efaee00d014bbf8129a989b/work/workspace/mcpp-home
xlings binary = D:\Dev\tmp\t\codestudio-sandbox-40f2ae807efaee00d014bbf8129a989b\work\workspace\mcpp-home\registry\bin\xlings.exe
xlings home = D:\Dev\tmp\t\codestudio-sandbox-40f2ae807efaee00d014bbf8129a989b\work\workspace\mcpp-home\registry
config = D:\Dev\tmp\t\codestudio-sandbox-40f2ae807efaee00d014bbf8129a989b\work\workspace\mcpp-home\config.toml
An argument keeps its spelling: the bundle given as --from Z:\bin\bundle
appears as Z:/bin/bundle in mcpp's messages (section 2). We have not located
the conversion in mcpp's source. A canonicalization that follows the drive
alias (std::filesystem::canonical or GetFinalPathNameByHandleW resolve
\??\Z: to the volume path) would explain it; this is a guess.
2. The home cannot be reached
With the home outside the project (MCPP_HOME=Z:\work\home\.mcpp, the
fixture's recipe), the first step, mcpp fetch --from Z:\bin\bundle, exits 4:
error: cannot resolve home 'D:/Dev/shots/mcpp-migration-resume/tmp/codestudio-sandbox-5b87093d98da5ede3237738d2da67a2b/work/home/.mcpp': Access is denied.
With the home inside the project (MCPP_HOME=Z:\work\workspace\mcpp-home),
mcpp gets further and then cannot start xlings, for the self-init, the index
and the ninja bootstrap alike:
cannot start 'D:\Dev\tmp\t\codestudio-sandbox-7d7b84dd683ab0240ab1dca3ba141670\work\workspace\mcpp-home\registry\bin\xlings.exe' (error 2): no such file or directory; starting D:/Dev/tmp/t/codestudio-sandbox-7d7b84dd683ab0240ab1dca3ba141670/work/workspace/mcpp-home/registry/bin/xlings.exe: beneath no directory this program was given: not found
...
error: installing from Z:/bin/bundle failed (provider exit 127); the provider's report is above
note: stopped before a denied effect (network: a download is required); exit status 5
The message is the same after xlings.exe is copied into
<home>\registry\bin\. The same xlings.exe, started directly as a sandbox
step by its Z: path, runs and prints xlings 2026.11.21.1 (exit 0), both
from the home and from the read-only mcpp mount. The refusal comes from the
process layer (mcpplibs.os over openkal-windows), which starts a program only
beneath a directory the process was given: its working directory and the
drive roots it can open. In the container only Z:\ opens, and the physical
path lies beneath none of them.
3. clang++, clang-scan-deps and lld-link fail when started by their physical path
To see what follows, we started mcpp through a launcher that adds the physical
tree and Z:\ to openkal's internal preopen list (KAL_PREOPENS). This is a
diagnostic hack, not a workaround. mcpp then reached its compiler probe and
stopped there, although it names the compiler by its Z: path:
probe: explicit compiler: Z:/bin/llvm\bin\clang++.exe
error: 'Z:/bin/llvm\bin\clang++.exe --version' exited with status 1: Z:/bin/llvm\bin\clang++.exe: permission denied
A second launcher that also rewrote every Z: spelling in mcpp's arguments
and environment to the physical path ended the same way, with the physical
path in the message.
A probe step that starts each tool itself, by each spelling of the image path
and of the working directory, gave:
| image path | working directory | clang++, clang-scan-deps, lld-link | cl.exe, link.exe |
|---|---|---|---|
Z:\bin\... |
Z:\work\workspace |
start, exit 0 | start |
Z:\bin\... |
physical | start, exit 0 | start |
| physical | Z:\work\workspace |
<path>: permission denied, exit 1 |
start |
| physical | physical | <path>: permission denied, exit 1 |
start |
("start" for cl.exe and link.exe means they ran and reported their own usage
errors, D8003 missing source filename and LNK1561 entry point must be defined, because the probe gave them no input.) The LLVM tool prints the
"permission denied" itself. We believe it comes from resolving the tool's own
executable path (GetLongPathNameW walks every ancestor directory), and the
ancestors of the physical path are not accessible to the container.
So the LLVM tools fail exactly when they are started by their physical path,
and mcpp's probe fails although it prints the Z: path. Our guess is that
the process layer starts the image by its canonical (physical) path; we did
not confirm it. The plain probe reproduced openkal's start sequence (a job,
a suspended start, an explicit handle list) without a failure.
Expected
mcpp keeps the spelling of the paths it is given (environment variables such
as MCPP_HOME and MCPP_TOOLCHAIN, arguments, the working directory, the
location of mcpp.exe) when it opens files and starts programs, and starts a
tool by the path under which it found it. If canonical paths are needed for
identity (cache keys, fingerprints), they could be computed for comparison
only, or a switch could keep the given spellings.
Steps to reproduce
With CodeStudio Agent at commit 0a2711d checked out on a Windows x64 machine that has Visual Studio 2022
Build Tools (for the CLI) and LLVM 22.1.8 (all source paths and commands below are relative to the CodeStudio Agent repository root, not the mcpp repository):
-
Set
MCPPto mcpp 2026.11.21.1'sbin\mcpp.exeandMCPP_HOMEto a home
that already holdsxim:ninja@1.13.2-mcpp.1(any home that has built a
project), and pointTEMPat a local fixed drive. -
Build the CLI:
python scripts/build.py --mode debug. -
Run the isolated build test:
python tests/mcpp_build_integration.py build/windows/x64/debug/codestudio-agent.exe $env:MCPP D:\path\to\LLVM\bin\clang++.exe
The test copies
mcpp.exeandxlings.exe(the product refuses
hard-linked inputs), writes an offline bundle withmcpp fetch --to, and
asks the CLI to run the steps ofbuild.windows.jsonin the sandbox:
mcpp fetch --from Z:\bin\bundle,mcpp pack --profile release --pkg-format dir, then the built program. -
The first step fails with
cannot resolve home ... Access is denied
(section 2). The result is printed as JSON.
A reproduction without CodeStudio Agent needs the same three properties: an
LPAC AppContainer (PROC_THREAD_ATTRIBUTE_ALL_APPLICATION_PACKAGES_POLICY),
read/execute access for the container's SID on one directory tree only, and a
drive letter that the parent maps to that tree with
NtCreateSymbolicLinkObject. Then run mcpp self env in the container with
MCPP_HOME under the drive letter. CodeStudio Agent's implementation is in
src/platform/windows_sandbox.cpp.
Notes
- The program the fixture builds (
main.cpp) is freestanding C++26: it
includes no header and links no library (-nostdlib,
/entry:mainCRTStartup). Outside the sandbox the same steps work: a fresh
home seeded offline withmcpp fetch --fromthe bundle,mcpp pack --profile release --pkg-format dir, then
target/dist/hello-0.1.0-x86_64-pc-windows-msvc/hello.exeexits 0. mcpp fetch --to/--fromworked outside the sandbox: an 11 MB bundle
(one ninja archive and one index snapshot) seeded a fresh home offline.- cl.exe 19.44 rejects the fixture's C++26 pack indexing (
values...[0],
error C3520), so building the fixture with MSVC would lose that check.
Activity
speak-agent commentedon Nov 27, 2026
Addressed in mcpp 2026.11.27.1 (#1023). The home keeps the spelling it is given: drive aliases (
subst) and links are no longer resolved to physical paths to open files or start programs, and physical paths are used only to compare.mcpp.libs.path_identityholds the rule, and a shrink-only check counts what remains. It has not been run inside an LPAC AppContainer here. If a step still fails there, please reopen with the failing command's output, which shows the reader that remains.