fix(agent): skip git shims on PATH and check git in Windows self-test #93
No reviewers
Labels
No labels
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
priority
critical
priority
high
priority
low
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Beanstalk!93
Loading…
Reference in a new issue
No description provided.
Delete branch "Jer9/Beanstalk:fix/windows-git-shim"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #92
On Windows systems using Scoop or similar package managers,
git.exeonPATHis a shim launcher (e.g. accompanied bygit.shim) that executes the real binary located outside the directory granted to the Windows sandbox. BecauseMinGit.OnPathpreviously treated anygit.exeonPATHas usable,Workspace.EnsureGitAsyncskipped fetching MinGit (#62), andWinHost.Gitgranted only theshimsfolder to the AppContainer sandbox—causing commands likescripts/dev_packs.pyto fail with exit 1 inside the sandbox. In addition, setup and self-test lacked in-sandbox verification ofgitexecution.What changed
agent/Core/MinGit.cs):MinGit.FindandMinGit.ShimOfto detect and skip package-manager shims: Scoop sibling.shimfiles, Chocolatey siblingchoco.exe/chocolatey.exeorchocolatey\bindirectories, immediateshimsdirectories, and reparse points (FileAttributes.ReparsePoint), while preserving small real wrapper executables such as Git for Windows'cmd\git.exeandbin\git.exe. Safely handles quoted or emptyPATHelements.MinGit.Fetchedto verify an existing<data>\mingit\cmd\git.exeinstallation stamped by.beanstalk-mingit.agent/Core/Workspace.cs):Workspace.EnsureGitAsyncto useMinGit.Find, logging when shims are skipped and recordingWorkspace.GitPathwhen a valid non-shimgit.exeis selected onPATH.agent/Core/WindowsPlan.cs,agent/Core/WindowsSandbox.cs):WinGit.Folderfor sandbox directory determination and normalisation.PATHscan inWinHost.Git()withMinGit.OnPath(Env("PATH")), falling back toWorkspace.GitPath ?? MinGit.Fetched(Path.Combine(data, "mingit")).ModeChoice.FailWhenFailed = { "git" }sogitis not markedRequiredbefore MinGit is downloaded (allowingskipduring initial setup), while failing the mode ifgitis present in the sandbox but fails.agent/Core/WindowsSelfTest.cs):git for the sandbox:diagnostic header and scrubbed logging inWinSelfTest.WinSelfTest.Probe, addedGitInside()to resolvegiton sandboxPATHand executegit --versionwithLC_ALL=C, reporting@@check git pass|fail|skipwith detail scrubbed before writing tosandbox-check.json.agent/tests/agent_core/SetupChecks.cs,agent/tests/agent_core/WindowsChecks.cs):MinGit.Find,MinGit.ShimOf,MinGit.Fetched,WinGit.Folder, andModeChoiceevaluation ofgitpasses/skips/failures across cross-platform mock environments.How it was tested
dotnet build agent/Beanstalk.Agent.slnx -c Release -p:RestoreLockedMode=true: passed with 0 warnings and 0 errors.beanstalk-agent.dll --self-check: passed (beanstalk-agent dev, exit code 0).python -I -B agent/tests/test_release.py: passed (0 failures).sandbox-probechecks on compiled binary:@@check git pass git version 2.56.0.windows.4.@@check git skip no git on the sandbox's PATH.@@check git fail git --version: exit 1: (no output).<data>,<home>, and<user>paths, and thatsandbox-check.jsoncontains no raw personal/user paths.python -I -B agent/tests/test_agent_core.py --dotnet ... --strict:main(e431624) andfix/windows-git-shimencounter a pre-existingSetupChecks.cs:56IOException(LinuxPython.UnpackAsynctar symlink creation fails when Windows Developer Mode is disabled).setup: 58 checks,windows: 144 checks) plustest_windows_python_fix.py(6 tests OK).0xC0000142 STATUS_DLL_INIT_FAILEDdue to window station access restrictions, identical tomain.WIP: fix(agent): skip git shims on PATH and check git in Windows self-testto fix(agent): skip git shims on PATH and check git in Windows self-test