Skip to content

fix(desktop): Windows goose discovery, install PATH, and hidden consoles#2247

Closed
tzarebczan wants to merge 6 commits into
block:mainfrom
tzarebczan:fix/windows-runtime-install-and-console
Closed

fix(desktop): Windows goose discovery, install PATH, and hidden consoles#2247
tzarebczan wants to merge 6 commits into
block:mainfrom
tzarebczan:fix/windows-runtime-install-and-console

Conversation

@tzarebczan

Copy link
Copy Markdown

Summary

Fixes Windows onboarding/runtime install friction reported in #2239 and #2238.

#2239 — Goose shows Installed but Next stays blocked

  • Goose's official Windows installer writes to %USERPROFILE%\goose and does not put it on PATH.
  • Buzz never searched that directory, so rediscovery stayed NotInstalled after a successful install.
  • Onboarding showed Installed from local installSuccess while Next requires availability === available.
  • Fix: probe %USERPROFILE%\goose, post-install resolve verification, only show Installed after discovery confirms (Checking while waiting).

#2238 — Codex ACP install fails on Windows

  • Install shells replaced PATH with only the Buzz managed npm prefix when login_shell_path() is None (always on Windows).
  • System Node/npm (nvm4w, etc.) disappeared → npm: command not found.
  • Fix: fall back to the process PATH on Windows install shells (managed bins still prepended).

Console focus-steal

  • Discovery probes, git, shell tool, auth/version probes lacked CREATE_NO_WINDOW.
  • Fix: hide those consoles on Windows.

Test plan

  • Unit: windows_well_known_dirs include goose path
  • Unit: install shell PATH falls back to process PATH without login shell
  • Manual: Windows onboarding → Install Goose → Installed + Next enabled (existing %USERPROFILE%\goose should be found without reinstall)
  • Manual: Install Codex adapter without manual codex-acp install (system npm present)
  • Manual: setup/rediscovery no longer steals focus with Git Bash windows

Closes #2239
Closes #2238

@tzarebczan
tzarebczan requested a review from a team as a code owner July 21, 2026 18:00

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 681ed8379b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1399 to +1400
std::path::Path::new(r"C:\nvm4w\nodejs"),
std::path::Path::new(r"C:\Windows\System32"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use platform-native paths in the PATH fallback test

On Linux and macOS, this unconditionally compiled test panics before exercising the helper because std::env::join_paths rejects components containing :—both Windows drive-letter paths contain one. Consequently, the desktop Tauri unit-test suite fails on Unix CI; gate this test with #[cfg(windows)] or use platform-native sample paths and assertions.

AGENTS.md reference: AGENTS.md:L93-L94

Useful? React with 👍 / 👎.

@tzarebczan
tzarebczan force-pushed the fix/windows-runtime-install-and-console branch from 681ed83 to 9968bea Compare July 21, 2026 18:13

@wpfleger96 wpfleger96 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at head 681ed83 — full-file reads plus running the new unit tests locally on macOS. These are well-scoped fixes for three real Windows issues, and the architecture is right: pure testable helpers (install_shell_path_parts, windows_well_known_binary_dirs), post-install resolve verification that turns a false-positive "Installed" into an actionable step failure, and honest UI state (INSTALLED now means discovery confirmed it). I also verified goose's download_cli.sh upstream — line 63 confirms DEFAULT_BIN_DIR="$USERPROFILE/goose" on native Windows, so the new probe dir matches the installer exactly.

Requesting changes for two blockers:

  1. test_install_shell_path_falls_back_to_process_path_without_login_shell panics on macOS/Linux (reproduced locally, details inline) — CI's macOS just desktop-tauri-test job will fail.
  2. DCO check is failing — commits need Signed-off-by; amend/rebase with -s.

Non-blocking: the 5-line CREATE_NO_WINDOW block is now copy-pasted ~9× across the codebase (7 new here + runtime.rs:1897, process_lifecycle.rs:114) — a shared helper would make the next missed spawn site greppable to one name. Two nits inline.

Comment thread desktop/src-tauri/src/commands/agent_discovery.rs Outdated
Comment thread desktop/src-tauri/src/managed_agents/discovery.rs Outdated
Comment thread desktop/src-tauri/src/managed_agents/discovery.rs Outdated
Comment thread desktop/src/features/onboarding/ui/SetupStep.tsx Outdated
@tzarebczan
tzarebczan force-pushed the fix/windows-runtime-install-and-console branch from c8cd1d9 to 8775485 Compare July 21, 2026 18:22

@wpfleger96 wpfleger96 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at the new head 8775485 — thanks for the thorough rework, both original blockers are confirmed resolved:

  • Test portability: the new install_shell.rs tests use platform-neutral paths; I re-ran cargo test --lib install_shell_path on macOS at this head — 4 passed, 0 failed.
  • DCO: commit is signed off, DCO check is green.
  • CREATE_NO_WINDOW duplication: windows_console::hide_console() adopted across the touched spawn sites, with the tokio variant kept local in buzz-dev-mcp — exactly the right split.
  • ✅ The new windows_paths.rs module, PATH dedup, and the GOOSE_BIN_DIR=$HOME/.local/bin pin all look good — I verified the goose installer honors the GOOSE_BIN_DIR override (download_cli.sh line 69) and ~/.local/bin is already on Buzz's discovery path list.

One new blocker introduced in this revision (line comment below): the branch now reverts the Hermit-pinned lefthook change from #2241 (Justfile + CONTRIBUTING.md). Once that's dropped or split out with rationale, this is good to approve.

Comment thread Justfile
@tzarebczan
tzarebczan force-pushed the fix/windows-runtime-install-and-console branch from 9d713a9 to 0ff8a7b Compare July 21, 2026 19:01
@tzarebczan

Copy link
Copy Markdown
Author

rebased after the merge conflict. Checked the failing tests on https://github.com/block/buzz/actions/runs/29856956174/job/88727060509 and they should work now on the latest commit.

@jjgarciarovira

Copy link
Copy Markdown

Nice — this cleans up the install/probe PATH and the discovery/git/shell/auth consoles.

One console source that looks outside this PR's diff: the persistent agent-harness child spawned in crates/buzz-acp/src/acp.rs. The desktop already launches the buzz-acp sidecar windowless (CREATE_NO_WINDOW in managed_agents/runtime.rs), but AcpClient::spawn only sets a Unix process-group flag — no Windows creation flag:

// crates/buzz-acp/src/acp.rs (~line 466)
#[cfg(unix)]
cmd.process_group(0);

let mut child = cmd.spawn()?;

Because the parent is windowless, each managed agent's adapter (claude-agent-acp.cmd -> cmd.exe -> node, or buzz-agent) has no console to inherit and allocates its own — one window per agent, plus churn as sessions recycle. This is the symptom in #2292.

Minimal fix mirroring the sidecar flag (tokio's creation_flags is inherent on Windows, no extra import):

#[cfg(windows)]
{
    const CREATE_NO_WINDOW: u32 = 0x0800_0000;
    cmd.creation_flags(CREATE_NO_WINDOW);
}

Happy to fold this into this PR or open a separate one — whichever you prefer.

@tzarebczan

tzarebczan commented Jul 22, 2026

Copy link
Copy Markdown
Author

I think a separate one would be better. This one was already approved. Thanks for looking and helping!

Edit: Actually I re-read it, and yes please, fix that here if possible. If not, I can tomorrow in the am... Late here.

@keshav0479

Copy link
Copy Markdown

I ran into another Windows case that i don’t think this PR covers. I posted the details and timings in #2328: #2328 (comment)

On my machine, Buzz picks:

%LOCALAPPDATA%\Microsoft\WindowsApps\bash.exe

instead of the actual Git Bash:

C:\Program Files\Git\bin\bash.exe

The WindowsApps one launches WSL and the lookup hangs. It didn’t finish within 15 seconds, while the same lookup using Git Bash finished in about 0.5–0.7 seconds.

From what I can tell, resolve_bash_path() searches PATH for any bash.exe before checking for the Bash that comes with Git. Since git_bash.rs isn’t changed here, hiding the console will stop the popup, but the WSL lookup may still hang in the background.

Could we also prefer Git Bash here, or skip the WindowsApps/WSL alias?

@suraciii

suraciii commented Jul 22, 2026

Copy link
Copy Markdown

Building on @jjgarciarovira’s AcpClient::spawn finding: CREATE_NO_WINDOW applies per CreateProcess call, so two nested spawn sites still need the same flag:

  • crates/buzz-agent/src/mcp.rs - MCP server children
  • crates/buzz-dev-mcp/src/rg.rs - delegated system rg

My local patch covers these and the already-mentioned agent CLI spawn:

suraciii@1ec37e3

It overlaps this PR, so it is for reference rather than cherry-picking as a whole.

@jjgarciarovira

Copy link
Copy Markdown

thanks @tzarebczan, happy to help! the one-liner is already committed on my fork if it's easiest to cherry-pick into this pr:

jjgarciarovira@36fbcd4 (branch fix/windows-acp-child-no-window)

also worth folding in @suraciii's catch in the same pass: the same CREATE_NO_WINDOW flag is missing on two more spawn sites (buzz-agent/src/mcp.rs and buzz-dev-mcp/src/rg.rs), so covering all three would clear the remaining per-agent console popups in one go.

whatever's easiest on your end, and i'm glad to open a separate pr instead if you'd rather keep this one focused. thanks for the quick look!

@tzarebczan
tzarebczan force-pushed the fix/windows-runtime-install-and-console branch from 0ff8a7b to f54f15a Compare July 22, 2026 17:19
tzarebczan added a commit to tzarebczan/buzz that referenced this pull request Jul 22, 2026
Desktop launches buzz-acp windowless; without the same flag the adapter
child (cmd.exe/node, buzz-agent, …) allocates its own console per agent.

Refs: block#2292, PR block#2247 review
tzarebczan added a commit to tzarebczan/buzz that referenced this pull request Jul 22, 2026
PATH often lists %LOCALAPPDATA%\Microsoft\WindowsApps\bash.exe first;
that App Execution Alias launches WSL and can hang lookups (~15s+) while
real Git Bash is sub-second. Prefer git-derived / install / registry
paths, then PATH bash, and skip WindowsApps (and System32) on PATH.

Refs: block#2328, PR block#2247
tzarebczan added a commit to tzarebczan/buzz that referenced this pull request Jul 22, 2026
Nested CreateProcess sites still flash consoles when the parent is
windowless: buzz-agent MCP spawns and buzz-dev-mcp delegated rg.

Refs: PR block#2247 review, block#2292
@tzarebczan

Copy link
Copy Markdown
Author

Thanks again, just pushed up a commit with all the fixes mentioned recently. Tried to refactor/simplify where possible. Would be great to have another set of eyes/tests too. Much appreciated!

Goose install could report success while discovery still saw NotInstalled
(binary in %USERPROFILE%\goose off PATH), blocking onboarding Next (block#2239).
Install shells also dropped the process PATH on Windows so system npm was
invisible for Codex/Claude adapters (block#2238). Console-subsystem probes
stole focus via Git Bash.

- Probe well-known Windows Node/npm/goose paths; fall back to process PATH
  for install shells; pin goose GOOSE_BIN_DIR to ~/.local/bin on Windows.
- Post-install resolve check; SetupStep only shows Installed after discovery.
- Centralize CREATE_NO_WINDOW via windows_console::hide_console (and
  buzz-dev-mcp hide helper) on spawn sites this fix touches.

Signed-off-by: Thomas Zarebczan <thomas.zarebczan@gmail.com>
…ECK AGAIN

- Restore Justfile + CONTRIBUTING.md from main (accidental soft-reset
  squash had undone Hermit-pinned lefthook from block#2241).
- beforeDevCommand: use `pnpm exec vite` instead of Unix-only `exec`
  (tauri.conf + instance-env) so Windows cmd can start the dev server.
- After install success, reuse the existing CHECK AGAIN / CHECKING…
  pattern so rediscovery is not a permanent spinner.

Signed-off-by: Thomas Zarebczan <thomas.zarebczan@gmail.com>
Desktop launches buzz-acp windowless; without the same flag the adapter
child (cmd.exe/node, buzz-agent, …) allocates its own console per agent.

Refs: block#2292, PR block#2247 review
Signed-off-by: Thomas Zarebczan <thomas.zarebczan@gmail.com>
PATH often lists %LOCALAPPDATA%\Microsoft\WindowsApps\bash.exe first;
that App Execution Alias launches WSL and can hang lookups (~15s+) while
real Git Bash is sub-second. Prefer git-derived / install / registry
paths, then PATH bash, and skip WindowsApps (and System32) on PATH.

Refs: block#2328, PR block#2247
Signed-off-by: Thomas Zarebczan <thomas.zarebczan@gmail.com>
Nested CreateProcess sites still flash consoles when the parent is
windowless: buzz-agent MCP spawns and buzz-dev-mcp delegated rg.

Refs: PR block#2247 review, block#2292
Signed-off-by: Thomas Zarebczan <thomas.zarebczan@gmail.com>
- Route desktop spawns through windows_console::hide_console (runtime,
  taskkill); stop re-inlining CREATE_NO_WINDOW.
- Add buzz-dev-mcp windows_console for std/tokio; use from shell + rg.
- Single hide_console helper in buzz-acp and buzz-agent MCP spawn.
- Drop redundant WindowsApps also_skip; one path_looks_like check.
- Align Doctor/MCP PATH scan API + KEEP IN SYNC notes (full shared
  resolver deferred: buzz-agent forbids unsafe registry code).
- SetupStep: one CheckAgainButton for auth-unknown and post-install.

No push.

Signed-off-by: Thomas Zarebczan <thomas.zarebczan@gmail.com>

aleixrodriala commented Jul 23, 2026

Copy link
Copy Markdown

I reproduced a second Windows PATH gap on the affected v0.4.23 machine that is still present at this PR's current head (c51b9859). It affects adapter discovery/launch after the install subprocess succeeds.

End-to-end reproduction:

  1. Installed @agentclientprotocol/codex-acp 1.1.7 into Buzz's private %APPDATA%\Buzz\node-tools prefix. codex-acp.cmd --version succeeds from a normal Windows shell.
  2. Recreated the PATH produced by managed_agents/runtime/path.rs::build_augmented_path() on Windows: %USERPROFILE%\.local\bin;%APPDATA%\Buzz\node-tools;<Buzz exe dir>. Running that same shim through ProcessStartInfo(UseShellExecute=false) starts it, but exits 1 with "node" is not recognized as an internal or external command.
  3. Buzz onboarding still showed Installation failed after Retry because the version probe classified the installed adapter as outdated and attempted installation again.
  4. Added a temporary node.cmd delegate inside Buzz's managed prefix (which is already on the probe PATH). The exact probe then returned @agentclientprotocol/codex-acp 1.1.7, and clicking Retry changed the live Buzz onboarding UI to Ready.

Root cause: this PR fixes install_shell_path_parts() with well-known Windows directories and process-PATH fallback, but build_augmented_path() still drops both. Since login_shell_path() is intentionally None on Windows and managed Node is unsupported there, npm .cmd shims cannot find system Node during version/auth probes or when agents are launched.

The focused patch is now published as draft PR #2533: #2533. It is stacked on this PR and adds one commit (06e8a5e9) that:

  • appends windows_existing_well_known_path_dirs() after the managed Node/npm dirs under cfg(windows);
  • falls back to the native process PATH only when login-shell PATH is unavailable, while preserving login-shell precedence;
  • adds regression tests for the fallback and precedence behavior.

The isolated runtime/path.rs suite passes 7/7 and git diff --check passes.

@tzarebczan

Copy link
Copy Markdown
Author

Thanks for getting this into a release with your pr @wpfleger96 , will close.

@tzarebczan tzarebczan closed this Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Can't continue setup process after installation (Windows) [Bug] codex setup fails on windows

6 participants