fix(agent): a failed build's report carries its output, and Windows says where Python's temp files go #28

Merged
HumanBean merged 1 commit from HumanBean/Beanstalk:fix/build-log-tail into main 2026-11-15 23:39:25 +00:00
Owner

Why: Windows testers' jobs stop before building with PermissionError: [WinError 5] Access is denied: '…\\Beanstalk\\work\\longshot\\tmpXXXX' (Longshot #910: rp_402f6c1a7128222f on nightly-30, and rp_20587bc9f76c5c3f on nightly-46, which has #25).

  • Python tried the sandbox's own TEMP first. It found it unusable and fell back to the working folder, the Longshot checkout, where making a folder was refused too.
  • The grants look right in the code, so we need to see what happens on the PC. The reports couldn't tell us: a failed build's report carried no log, because the log tail only ever came from the scenarios.

What changed

  • Workspace: keeps the last 300 lines its sandboxed commands printed (RecentOutput). JobPipeline sends them as the log tail when the build failed before any scenario ran. They go through the usual scrubber.

  • Workspace.ProbeTempAsync (Windows only): before the base build, it runs a short Python script in the same sandbox, with the same folders, home and environment. It prints, as @@probe lines:

    • the TEMP, TMP, TMPDIR and USERPROFILE variables;
    • for each place Python's tempfile tries, whether a file and a folder can be made there, and the exact error when not;
    • where gettempdir() settles.

    If the probe can't run, that is logged and the build goes on.

Testing:

  • The agent checks pass (1608), and the win-x64 build compiles.
  • I ran the probe's logic with Python 3.14 on Linux.
  • The probe has not run on Windows; the next Windows job after this ships will show its output.

Next: with the probe lines in a failed report we can fix the cause (likely the sandbox's grant or label on its home or the checkout). This PR doesn't change behaviour.

**Why:** Windows testers' jobs stop before building with `PermissionError: [WinError 5] Access is denied: '…\\Beanstalk\\work\\longshot\\tmpXXXX'` (Longshot #910: [rp_402f6c1a7128222f](https://beanstalk.magicbean.dev/reports/rp_402f6c1a7128222f) on nightly-30, and [rp_20587bc9f76c5c3f](https://beanstalk.magicbean.dev/reports/rp_20587bc9f76c5c3f) on nightly-46, which has #25). - Python tried the sandbox's own `TEMP` first. It found it unusable and fell back to the working folder, the Longshot checkout, where making a folder was refused too. - The grants look right in the code, so we need to see what happens on the PC. The reports couldn't tell us: a failed build's report carried no log, because the log tail only ever came from the scenarios. **What changed** - `Workspace`: keeps the last 300 lines its sandboxed commands printed (`RecentOutput`). `JobPipeline` sends them as the log tail when the build failed before any scenario ran. They go through the usual scrubber. - `Workspace.ProbeTempAsync` (Windows only): before the base build, it runs a short Python script in the same sandbox, with the same folders, home and environment. It prints, as `@@probe` lines: - the TEMP, TMP, TMPDIR and USERPROFILE variables; - for each place Python's tempfile tries, whether a file and a folder can be made there, and the exact error when not; - where `gettempdir()` settles. If the probe can't run, that is logged and the build goes on. **Testing:** - The agent checks pass (1608), and the `win-x64` build compiles. - I ran the probe's logic with Python 3.14 on Linux. - The probe has not run on Windows; the next Windows job after this ships will show its output. **Next:** with the probe lines in a failed report we can fix the cause (likely the sandbox's grant or label on its home or the checkout). This PR doesn't change behaviour.
fix(agent): a failed build's report carries its output, and Windows says where Python's temp files go
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
587eebfbf5
Windows testers' base builds stop on "Access is denied" making a
temporary folder in the Longshot checkout (Longshot #910's reports, on
nightly-30 and nightly-46): Python had found the sandbox's own TEMP
unusable and fell back to the working folder. The reports could not
say why: a failed build's report carried no log at all, since the log
tail came from the scenarios only.

- The workspace keeps the last 300 lines its sandboxed commands
  printed, and a report whose build failed before any scenario ran
  sends them as its log tail.
- On Windows, before the base build, a short probe in the same sandbox
  prints the TEMP variables and, for each place Python tries, whether a
  file and a folder can be made there (and the error when not), then
  where tempfile settles.

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!28
No description provided.