Fix Windows dev loop: beforeDevCommand script + Vite IPv4 bind + test_acp_client.py stdin-flush#8834
Open
seydousakho-star wants to merge 2 commits intoaaif-goose:mainfrom
Open
Fix Windows dev loop: beforeDevCommand script + Vite IPv4 bind + test_acp_client.py stdin-flush#8834seydousakho-star wants to merge 2 commits intoaaif-goose:mainfrom
seydousakho-star wants to merge 2 commits intoaaif-goose:mainfrom
Conversation
added 2 commits
April 24, 2026 14:16
`just dev` / `just dev-debug` on Windows fail in three ways that are all
localised to the `beforeDevCommand.script` tauri passes to the Vite
child process. Fixed together because they share a code path.
1. The `cd ${PROJECT_DIR} && ...` prefix in the `dev` recipe breaks the
--config argv passthrough. The bare `&&` is visible to cmd.exe inside
the JSON string and truncates everything after it, so Tauri gets a
malformed config and fails before Vite starts. Dropped — cwd already
handles the working dir.
2. The leading `exec` in both recipes is a bash builtin. Tauri runs
beforeDevCommand through cmd.exe on Windows, which reports
`'exec' is not recognized as an internal or external command`.
Harmless to drop on Unix — pnpm/node handle their own lifecycles.
3. Vite 7 defaults to binding `::1` (IPv6 loopback) only on Windows.
Tauri's WebView2 resolves `localhost` to IPv4 first and fails with
"page cannot be loaded". Added `--host 127.0.0.1` to force Vite to
bind IPv4. Works on Linux + macOS as well (those still bind 127.0.0.1
by default, so the flag is a no-op there).
Also corrected `cwd` in the `dev` recipe from `.` to `..`: Tauri resolves
`beforeDevCommand.cwd` relative to `src-tauri/`, not to where `just`
was invoked. The `dev-debug` recipe already had `..`.
Tested on Windows 11 with Rust 1.92 + Node 22 + pnpm 10. `just dev`
now launches the native window, React UI renders, and `goose serve`
streams perf logs as expected. No change in behaviour on macOS/Linux.
`test_acp_client.py` times out with "Failed to initialize: None" on Windows. Three layered causes, fixed together: 1. `stderr=subprocess.PIPE` with nobody reading it. When the command is `cargo run -p goose-cli -- acp`, cargo writes several KB of compile progress to stderr. Windows' pipe buffer (~4 KB) fills up, the child blocks on stderr write, and the stdio loop deadlocks before the initialize response is ever read. Routed to DEVNULL — this test cares only about JSON-RPC framing on stdout. 2. `bufsize=0` combined with `text=True` is unreliable on Windows. Text mode always goes through io.TextIOWrapper, which does its own buffering; the prior setting made `stdin.flush()` inconsistent. Changed to `bufsize=1` (line-buffered), which matches text-mode semantics on every platform. 3. (surfaced only after (1) was fixed) Windows consoles default to cp1252, which cannot encode the unicode progress glyphs (✓ ✗ 📝) the test prints. Forced `sys.stdout.reconfigure(encoding="utf-8")` at startup so the suite runs uniformly on Windows, Linux, macOS. Also added an optional `GOOSE_BIN` env override + automatic fallback to `target/debug/goose[.exe]` so the test can skip the cargo-run path when a pre-built binary already exists (cuts wall time from minutes to seconds, which matters when iterating on ACP behaviour). Verified on Windows 11: full 6-phase suite (initialize, session/new, session/prompt, re-initialize, session/load, prompt to loaded session) now passes end-to-end.
Bojun-Vvibe
added a commit
to Bojun-Vvibe/oss-contributions
that referenced
this pull request
Apr 26, 2026
…merge-after-nits
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
Two small, surgical fixes found while bringing goose2 up on Windows 11.
Both are no-ops on macOS/Linux — they only affect the Windows code
paths.
ui/goose2/justfile—just devfails on Windows with a malformedTauri
--configargument. Three interacting causes in thebeforeDevCommand.scriptstring, fixed together because they sharea code path:
cd ${PROJECT_DIR} && ...prefix — the unescaped&&inside aJSON value gets split by Windows' bash → npm → tauri argv
passthrough, truncating the
--configJSON. Dropped;cwdalreadysets the working directory.
exec— a bash builtin. Tauri runsbeforeDevCommandviacmd.exe on Windows, which reports
'exec' is not recognized as an internal or external command. Harmless to drop on Unix.--host 127.0.0.1— Vite 7 binds::1(IPv6 loopback)only on Windows by default, and WebView2 resolves
localhosttoIPv4 first, so the page never loads. Forcing IPv4 bind works on
every platform.
Also corrected
cwdin thedevrecipe from.to... Tauriresolves
beforeDevCommand.cwdrelative tosrc-tauri/, not to thejust-invocation dir.
dev-debugalready had...test_acp_client.py— times out withFailed to initialize: Noneon Windows. Three layered causes:
stderr=subprocess.PIPEwith nobody reading it.cargo run -p goose-cli -- acpwrites several KB of compile progress to stderr;Windows' ~4 KB pipe buffer fills, the child blocks on stderr
write, and the stdio loop deadlocks before
initializecanresolve. Routed to
DEVNULL— the test only cares about JSON-RPCframing on stdout.
bufsize=0combined withtext=True— text mode always usesio.TextIOWrapperwhich needs at least line buffering.bufsize=0made stdout flushes unreliable on Windows. Changed to
bufsize=1.encode the unicode progress glyphs (
✓ ✗ 📝). Forcedsys.stdout.reconfigure(encoding="utf-8")so the suite runsuniformly on Windows, Linux, macOS.
Opportunistic: added an optional
GOOSE_BINenv override plusautomatic fallback to
target/debug/goose[.exe]so the test can skipthe cargo-run path when a pre-built binary exists. Cuts wall time
from minutes (recompile + cargo noise) to under a second.
Test plan
just devlaunches thenative window, React UI renders,
goose servestreams perf logs.test_acp_client.pysuite (initialize,session/new, session/prompt, re-initialize after restart,
session/load, prompt-to-loaded-session) passes end-to-end
against
target/debug/goose.exe.execis harmless,--host 127.0.0.1matches the default bind on Unix). Worth areviewer confirmation.
No new deps, no config surface changes, no doc changes needed. The
only semantic shift on non-Windows platforms is
test_acp_client.pypreferring
target/debug/gooseovercargo runwhen the binaryexists, which is a speed improvement.