Repository navigation
Windows: run commands in Git Bash, and open SQLite stores on Windows paths - #1882
Merged
Merged
Conversation
The factory check stage put its shell in a process group with Setpgid and killed it with syscall.Kill(-pid), neither of which exists on Windows, so app/v3 stopped compiling for GOOS=windows. It now uses internal/processgroup, which is the same Setpgid/SIGKILL on Unix and taskkill /T on Windows. make app-sidecar APP_GOOS=windows APP_GOARCH=amd64 now builds dist/app/codeaf-x86_64-pc-windows-msvc.exe. Windows has no pinned furrow, so, as release.yml does, it skips the fetch and builds without one. It also skips garble: Microsoft Defender quarantined the garbled binary on first run as a virus or potentially unwanted software. app-sidecars still builds the four macOS and Linux triples only. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
On the native Windows desktop every shell door ran exec.Command("bash", ...),
and Windows resolves "bash" to C:\Windows\System32\bash.exe: WSL's launcher,
not a bash. It hands the command line to a Linux shell that parses it once
more before /bin/bash sees it, so the commands ran in another OS and were
evaluated twice. A chat's `for n in 1 2 3; do gh pr view $n; done` ran with
an empty $n, and (next commit) every task command failed outright.
internal/shell now chooses the bash for every engine door. On Windows it is
CODEAF_BASH, else Git for Windows found beside git.exe, else the standard
install folders, else a bash.exe on PATH that is not WSL's launcher; with
none, nothing runs and the door says how to fix it. Unix argv is unchanged.
Git Bash also exits 1 without writing anything when its stdout is Go's
append-only Windows handle, which killed every background job and detached
service, so shell.OpenLog opens their logs writable and seeks to the end
on Windows. The skills and rtk shelves go on PATH in bash's /c/... form.
A few exec, factory and session tests used syscall.Kill and Unix-only
fixtures, so their test binaries could not be built for Windows; those
helpers are split by platform with the Unix bytes unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…s shell
A task worker's commands carry `export PATH='<shim dir>':$PATH PLANDB_DB=...`.
Through WSL's launcher the $PATH in it was expanded early to WSL's PATH,
whose /mnt/c/Program Files (x86)/... entries ended every worker command,
even `true`, with "syntax error near unexpected token `('". On 2026-10-19 a
desktop session lost nine tasks and its $5 task budget to it.
With a real bash that line parses, but a C:\ entry in a PATH list splits at
the colon, so the shim directory and both shims' exec targets are now
written in bash's /c/... form. PLANDB_DB and PLANDB_RUN are read by
codeaf.exe and keep their Windows spelling. A bash or sh check script's
file argument is converted the same way.
On Windows the worker and chat project facts name the shell, its /c/...
drive form, and Git Bash's habit of rewriting a /route argument for a
Windows program (gh api /repos/...). The manual gains a page that answers
which bash codeaf uses on Windows, why not WSL, and what each refusal means.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Every store built its SQLite name as url.URL{Scheme: "file", Path: path},
which renders C:\Users\... as file:C:%5CUsers%5C..., and SQLite refused it
with "SQL logic error: out of memory (1)". The graph store had never opened
on the Windows desktop: its home held automations.db and no graph.db.
internal/sqlitefile spells the URI SQLite accepts on Windows
(file:///C:/Users/..., and file:////server/share/... for a share), and is
byte-identical to the old expression on Unix. The graph, workspace,
automation and plan-reader stores and the session's read-only spend opens
use it. plandb's own store already spelled file:C:/... and opened, so it is
left alone.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The previous commit moved the plan-store readers to the escaped SQLite URI while plandb's writer kept its raw "file:" + path spelling. SQLite decodes %XX in a raw filename and stops it at #, so for a store path holding either the readers and the writer addressed different files and every spend, usage and task read came back empty, on Linux as well. plandb.StoreURI is now the one spelling every plan-store open uses, and on Unix it is the writer's bytes exactly, so existing stores stay where they are and the session readers return to their old bytes. On Windows the raw spelling never opened such a path at all, so there it is the escaped URI, which names the same file for every ordinary path. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…e paths Three edges of the Git Bash resolver: - A git.exe outside Git's own layouts (a package manager's shim) is asked `git --exec-path` once, under a three-second limit, and Git Bash is found up to four folders above the answer. A failure falls through. - A relative CODEAF_BASH is bound to the working directory, so the cached answer now includes that directory. - C:skills\bin and \tools\bin are made absolute by Windows' own rules before conversion; replacing separators alone kept the C: (which bash splits as a PATH separator) or sent bash under its own install root. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
santoshkumarradha
pushed a commit
that referenced
this pull request
Oct 24, 2026
On native Windows codeaf's bash resolved to System32\bash.exe, the WSL launcher, which parsed every line a second time inside Linux: a PATH holding Program Files (x86) broke every command and $vars came back empty. The shell now resolves CODEAF_BASH, then Git for Windows, then other standard roots, then a non-WSL bash on PATH, and every door that starts a shell uses it. Background job and service logs open writable at their end, because Git Bash exits silently on an append-only handle. With no usable bash the shell tool is absent and the manual says to install Git for Windows. This ports the Windows fixes of #1882, which landed on app/v3, to dev. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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.
What was broken
On the native Windows desktop app, a conversation that started tasks lost every one of them. Each worker command, even
true, failed with:The engine starts every shell as
exec.Command("bash", …), and on Windowsbashresolves toC:\Windows\System32\bash.exe. That is WSL's launcher, not a bash. It passes the command line to a Linux shell, which parses it once more before/bin/bash -lcsees it. So commands ran in a different OS from the engine's file tools, and every line was evaluated twice:export PATH='<shim dir>':$PATH …) had$PATHexpanded early to WSL's PATH. WSL's PATH contains/mnt/c/Program Files (x86)/…, so every worker command failed with the syntax error above. One session lost nine tasks and its whole $5 task budget to retries.for n in 1 2 3; do gh pr view $n; done,$nwas empty, sogh pr viewran three times with no number.Running the engine's own test binaries natively on Windows also turned up two more Windows-only defects, fixed here:
O_APPENDfile from Go, so every background job and detached service would have died silently.url.URL{Scheme: "file", Path: path}rendersC:\Users\…asfile:C:%5CUsers…, which SQLite rejects ("SQL logic error: out of memory (1)"). The graph store had never opened on Windows.What changed
app: a Windows sidecar…. This commit was already written but never pushed:make app-sidecar APP_GOOS=windows APP_GOARCH=amd64, and the factory check stage moves ontointernal/processgroup.Run commands in Git Bash, never in WSL's launcher. The new
internal/shellpackage chooses the bash for every engine shell door. On Windows the order is:CODEAF_BASH,git.exe,bash.exeon PATH that is not WSL's launcher.With none, nothing runs and the door names the fix. On Windows,
shell.OpenLogopens job and service logs writable and seeks to the end. The skills and rtk shelves are written into PATH in bash's/c/…form. Unix argv, environment, log flags and prompt bytes are unchanged, and tests pin them.Task workers reach their plandb shim. The shim directory and both shims' exec targets are written in
/c/…form.PLANDB_DBandPLANDB_RUNare read bycodeaf.exe, so they keep their Windows spelling. On Windows, the worker and chat project facts name the shell, the drive form, and Git Bash's habit of rewriting a/routeargument for a Windows program (gh api /repos/…). A new manual page answers "which bash does codeaf use on Windows", "can it use WSL", and what each refusal means.SQLite stores open on a Windows path.
internal/sqlitefilespells the URI SQLite accepts on Windows. Its output is byte-identical to the old expression on Unix. The graph, workspace and automation stores use it.Plan-store readers name the file the writer wrote.
plandb.StoreURIis the one spelling for every plan-store open. On Unix it is the writer's existing bytes exactly, so existing stores stay where they are. On Windows it is the escaped URI: the raw spelling never opened a path containing%XXor#there.Three resolver edges from review:
git --exec-path.CODEAF_BASHis cached per working directory.Validation contract
x=inner; echo "x=[$x]"printsx=[inner]. Multi-line text, quotes,%PATH%,$(…)and non-ASCII arrive byte for byte, and a PATH withProgram Files (x86)never breaks a command.System32/SysWOW64/Sysnativebash.exe,WindowsApps) is never chosen.CODEAF_BASHthat is missing or names WSL's launcher gets its own refusal.plandbandcodeafreach the run's own shims from any working directory.%20and#, and every plan reader reaches the file the writer wrote.How it was checked
TestWindows…passes ininternal/shell,exec,session,store,workspace,automation,plandb,manualandsqlitefile. That includes the real worker belt with both shims, the background job and service doors, and every store.app/v3pull requests get no CI run:GOOS=windows, andGOOS=darwin.go vetfor both OSes on the touched packages, gofmt, the packed manual, the manual gates, carried help, belt pages and tooling.app/v3, not touched here:make test-laws:TestNoRoadInTheMemoryEngineHasMoreEndingsThanTheCeiling(automation.Store.MadeInTeam, 30 decisions against a ceiling of 15). It reproduces on0bf1f2fd8.changelog-check: 144 problems in existingdocs/changes/unreleased/entries.TestPlandbCliConcurrentWritersLandEveryTaskandTestEightyConcurrentAddsFromSeparateHandlesAllLandas already failing on the base under load, andTestUntrustedWorkAsksAndTheLadderClimbsas flaky.Not in this PR
internal/store's full suite run natively on Windows still has 9 failures out of 327 tests. None involve the shell or opening a store. One is a real product gap: a worker report that names a file asC:\…does not get that file carried as a deliverable. The others are Unix-shaped test assumptions (chmod,~/display, timing).internal/seniordev's$VIRTUAL_ENV/binPATH prefix (a Windows venv usesScripts), and the v1 resident'ssh -c, are left as they were./cygdrive/prefix is not supported, and the manual says so.🤖 Generated with Claude Code