fix: harden native Windows runtime - #1994
Draft
sethkarten wants to merge 3 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This draft hardens native Windows support after #1982. It keeps Git Bash as the default shell and does not use WSL.
.cmdand.batshims through a controlledcmd.execommand string with exact metacharacter testsshellPathPRIME_AGENT_SESSION_TMP,TMP,TEMP, andTMPDIRSafety boundaries
PATHshell: trueipykernelLocal validation
~/.bun/bin/bun run checkgit diff --checkNative Windows validation
Final run: https://github.com/PrimeIntellect-ai/prime-agent/actions/runs/33650350794
D:\a\_temp\Prime Agent ø\kernel-venv: 19 passed, 2 skipped0x86640xAA640.9.1, update, and uninstall: passedpi.exe --version(0.9.1) andpi.exe --help: passedStack
Base:
feat/windows-supportfrom #1982. This PR does not modify #1982 and should be reviewed after it.Note
Harden Windows runtime for bootstrap locks, shell resolution, leases, and atomic file writes
acquireBootstrapLockto claim the lock via atomic candidate-directory rename, reclaim stale locks safely, and retry bounded Windows release failures; adds aproper-lockfileguard around lock updatesgetShellConfigon Windows to the two canonical Git for Windows paths, rejecting PATH-discovered Cygwin/MSYS2/WSL shells with install guidanceacquireSessionLeaseto classify rename contention per-platform, reject live owners, retry stale-target races, and quarantine-then-delete stale lease directorieswindowsHide; bootstrap subprocesses getPYTHONUTF8=1and.cmd/.batfiles go through a validatedcmd.exeshimStdinBuffer.processand strips leading UTF-8 BOM innormalizeNewlinesreadLeaseOwnernow throws on corrupt or inaccessible owner metadata instead of treating it as unowned;getShellConfigon Windows no longer falls back to PATH bash, so environments without canonical Git Bash will failMacroscope summarized 6e85243. (Automatic summaries will resume when PR exits draft mode or review begins).