fix(agent): the Windows probe says why the sandbox can't start the compiler #36

Merged
HumanBean merged 1 commit from HumanBean/Beanstalk:fix/win-spawn-probe into main 2026-11-16 01:45:44 +00:00
Owner

Why

#33 worked. On nightly-65 the probe says @@probe mkdtemp ok fix, and Python's temp folder is now the sandbox's own AC\Temp (rp_7ba5ac36e47269d2, Longshot #910). The main base gets one step further, then stops on make_game.py's compiler check:

<home>\work\tools\llvm-mingw\bin\clang-23: Permission denied
The builder's own compiler (tools/llvm-mingw) could not build a test program

In the llvm-mingw zip, bin\clang.exe is 13,824 bytes, the same size as clang-target-wrapper.exe: it's the small launcher, and the compiler itself is clang-23.exe. The launcher starts it with the C runtime's _wspawnv and prints perror when that fails, so Windows refused to start clang-23.exe inside the sandbox (error 5). Python, in the same sandbox, starts python.exe without trouble.

The two start a program differently. Python's subprocess hands the child only the handles it lists; the C runtime's spawn hands it every inheritable handle. A file's grants can also differ. I can't run Windows here, so rather than guess at a fix, this makes the next run say exactly which start fails and with which Windows error.

What changed

The temp probe (#28, run before each Windows main base) gets a second part, only on Windows and only when LONGSHOT_MINGW is set. It:

  • says whether clang-N.exe and the launcher clang.exe are there and executable;
  • runs clang-N.exe --version directly, the launcher clang.exe --version, and clang-N.exe with close_fds=False (all handles inherited, like the C runtime);
  • calls CreateProcessW on clang-N.exe with handle inheritance off and on, and prints GetLastError and its message when it fails.

Each line starts with @@probe spawn, and the report's log tail keeps them.

Testing

  • Agent checks: 1685 passed.
  • The probe's Python compiles, and the whole probe runs on Linux: the temp part prints as before, and the spawn part is skipped there.
  • Not tested: the spawn part on Windows. It runs on the next Windows job once a nightly carries this, and its lines say what the fix has to be.
## Why #33 worked. On nightly-65 the probe says `@@probe mkdtemp ok fix`, and Python's temp folder is now the sandbox's own `AC\Temp` ([rp_7ba5ac36e47269d2](https://beanstalk.magicbean.dev/reports/rp_7ba5ac36e47269d2), Longshot #910). The main base gets one step further, then stops on `make_game.py`'s compiler check: ``` <home>\work\tools\llvm-mingw\bin\clang-23: Permission denied The builder's own compiler (tools/llvm-mingw) could not build a test program ``` In the llvm-mingw zip, `bin\clang.exe` is 13,824 bytes, the same size as `clang-target-wrapper.exe`: it's the small launcher, and the compiler itself is `clang-23.exe`. The launcher starts it with the C runtime's `_wspawnv` and prints `perror` when that fails, so Windows refused to start `clang-23.exe` inside the sandbox (error 5). Python, in the same sandbox, starts `python.exe` without trouble. The two start a program differently. Python's `subprocess` hands the child only the handles it lists; the C runtime's spawn hands it every inheritable handle. A file's grants can also differ. I can't run Windows here, so rather than guess at a fix, this makes the next run say exactly which start fails and with which Windows error. ## What changed The temp probe (#28, run before each Windows main base) gets a second part, only on Windows and only when `LONGSHOT_MINGW` is set. It: - says whether `clang-N.exe` and the launcher `clang.exe` are there and executable; - runs `clang-N.exe --version` directly, the launcher `clang.exe --version`, and `clang-N.exe` with `close_fds=False` (all handles inherited, like the C runtime); - calls `CreateProcessW` on `clang-N.exe` with handle inheritance off and on, and prints `GetLastError` and its message when it fails. Each line starts with `@@probe spawn`, and the report's log tail keeps them. ## Testing - Agent checks: 1685 passed. - The probe's Python compiles, and the whole probe runs on Linux: the temp part prints as before, and the spawn part is skipped there. - **Not tested:** the spawn part on Windows. It runs on the next Windows job once a nightly carries this, and its lines say what the fix has to be.
fix(agent): the Windows probe says why the sandbox can't start the compiler
Some checks are pending
CI / Coordinator tests (pull_request) Waiting to run
CI / Agent build and checks (pull_request) Waiting to run
CI / Coordinator image (pull_request) Waiting to run
CI / Conventional Commit title (pull_request) Successful in 3s
CI / Workflow lint (actionlint) (pull_request) Successful in 3s
ff2844a4fc
With Python's temp folders fixed (#33), the Windows main base gets one step
further and stops on make_game.py's compiler check: "clang-23: Permission
denied" (Longshot #910 on nightly-65). llvm-mingw's clang.exe is a small
launcher that starts clang-23.exe with the C runtime's _wspawnv, and Windows
refused that start inside the sandbox, while Python starts python.exe there.

The probe now also starts clang-23.exe directly and through the launcher,
and with CreateProcessW with and without handle inheritance, and prints
Windows' own error for each, so the next run says what to fix.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Beanstalk!36
No description provided.