fix(windows): resolve junctions behind work drive and check git cwd (#111) #180

Merged
HumanBean merged 1 commit from cfw34683/Beanstalk:fix/111-resolve-work-drive-links into main 2026-12-05 00:03:30 +00:00
Contributor

Summary

Addresses the Beanstalk side of #111 by resolving intermediate junctions/symlinks behind the work drive (Z:) and verifying git -C . working-directory readability in sandbox-check.

Cause

When home.Data (or any intermediate directory above it) is behind a Windows junction or symlink, Python (Failed to find real location of Z:\...) and MSYS2 git (Unable to read current working directory: Permission denied) resolve Z:\... to the final target path. Previously, WindowsSandbox only granted WinAccess.List along the lexical WinDrive.Above(home.Data) path, and GitInside() in sandbox-check only ran git --version (which does not exercise getcwd()).

Changes

  • agent/Core/WindowsPlan.cs, agent/Core/WindowsNative.cs: Added WinDrive.ResolveRealPath and WinWorkDrive.RealPath to resolve any intermediate reparse points/junctions along home.Data (plus WinDrive.SafeAbove so TooWide() folders are skipped).
  • agent/Core/WindowsSandbox.cs: Grants WinAccess.List along SafeAbove for both home.Data and WinWorkDrive.RealPath(home.Data).
  • agent/Core/WindowsSelfTest.cs: Extends GitInside() to run git -C . rev-parse --git-dir and fail with a clear diagnostic if Unable to read current working directory / Permission denied occurs.
  • agent/tests/agent_core/WindowsChecks.cs: Added unit test for WinDrive.ResolveRealPath.

Verification

  • dotnet build agent\tests\agent_core\AgentCoreTests.csproj --configuration Release succeeded (0 Warning(s), 0 Error(s)).
### Summary Addresses the Beanstalk side of #111 by resolving intermediate junctions/symlinks behind the work drive (`Z:`) and verifying `git -C .` working-directory readability in `sandbox-check`. ### Cause When `home.Data` (or any intermediate directory above it) is behind a Windows junction or symlink, `Python` (`Failed to find real location of Z:\...`) and MSYS2 `git` (`Unable to read current working directory: Permission denied`) resolve `Z:\...` to the final target path. Previously, `WindowsSandbox` only granted `WinAccess.List` along the lexical `WinDrive.Above(home.Data)` path, and `GitInside()` in `sandbox-check` only ran `git --version` (which does not exercise `getcwd()`). ### Changes - **`agent/Core/WindowsPlan.cs`, `agent/Core/WindowsNative.cs`**: Added `WinDrive.ResolveRealPath` and `WinWorkDrive.RealPath` to resolve any intermediate reparse points/junctions along `home.Data` (plus `WinDrive.SafeAbove` so `TooWide()` folders are skipped). - **`agent/Core/WindowsSandbox.cs`**: Grants `WinAccess.List` along `SafeAbove` for both `home.Data` and `WinWorkDrive.RealPath(home.Data)`. - **`agent/Core/WindowsSelfTest.cs`**: Extends `GitInside()` to run `git -C . rev-parse --git-dir` and fail with a clear diagnostic if `Unable to read current working directory` / `Permission denied` occurs. - **`agent/tests/agent_core/WindowsChecks.cs`**: Added unit test for `WinDrive.ResolveRealPath`. ### Verification - `dotnet build agent\tests\agent_core\AgentCoreTests.csproj --configuration Release` succeeded (`0 Warning(s), 0 Error(s)`).
fix(windows): resolve junctions behind work drive and check git cwd (#111)
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Coordinator tests (pull_request) Blocked by required conditions
CI / Agent build and checks (pull_request) Blocked by required conditions
CI / Coordinator image (pull_request) Blocked by required conditions
8eb163422b
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Coordinator tests (pull_request) Blocked by required conditions
CI / Agent build and checks (pull_request) Blocked by required conditions
CI / Coordinator image (pull_request) Blocked by required conditions
Some workflows are waiting to be reviewed.
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!180
No description provided.