Skip to content

fix(desktop): give Windows agent children a usable PATH and start dev#2506

Open
al3rez wants to merge 1 commit into
block:mainfrom
al3rez:windows-agent-path
Open

fix(desktop): give Windows agent children a usable PATH and start dev#2506
al3rez wants to merge 1 commit into
block:mainfrom
al3rez:windows-agent-path

Conversation

@al3rez

@al3rez al3rez commented Jul 23, 2026

Copy link
Copy Markdown

Two separate things stop Buzz working on Windows. Both are small, but together they make the desktop app unusable there.

Agents can't find node

Every managed agent dies the moment it starts. From %APPDATA%\xyz.block.buzz.app\agents\logs\:

'"node"' is not recognized as an internal or external command,
ERROR buzz_acp: agent initialize failed: Agent process exited unexpectedly
Error: all 24 agents failed to start — cannot continue

build_augmented_path assembles the child's PATH from Buzz's managed directories plus the user's login-shell PATH. On Windows the latter is always Nonefetch_login_shell_path_inner returns early there, correctly, since Git Bash reports POSIX colon-delimited entries (/c/Users/...) that a native child can't use.

The comment says children "inherit the real Windows PATH instead." They don't. runtime.rs does command.env("PATH", path), which replaces the inherited value rather than extending it, so the agent ends up with Buzz's managed directories and nothing else. No node, no npm, no git. The npm .cmd shims fail on their first line.

This appends the process PATH on Windows when no shell PATH was supplied. It's gated on !parts.is_empty() so callers that pass no local context still get None back, matching the existing rule about not manufacturing a PATH out of ambient state.

tauri dev doesn't start

'exec' is not recognized as an internal or external command
The "beforeDevCommand" terminated with a non-zero status code.

beforeDevCommand is exec ./node_modules/.bin/vite. exec is a POSIX shell builtin, and Tauri runs the script through cmd.exe on Windows. Calling Vite through node works everywhere.

One caveat worth a review from someone on the macOS dev loop: exec was presumably there to avoid an intermediate shell process so signals reach Vite directly. This change gives that up on Unix. If that matters more than I think, the alternative is a platform-specific config file, which is uglier but keeps the current behaviour.

Testing

Windows 11 (26100). Two new unit tests cover the PATH change: one asserts the process PATH is appended after the managed directories, the other that no PATH is manufactured without local context. cargo test -p buzz-desktop --lib managed_agents::runtime::path passes, and the existing Unix tests are untouched.

For the dev command, pnpm exec tauri dev now starts cleanly with no platform-specific config override:

Running BeforeDevCommand (`node ./node_modules/vite/bin/vite.js`)
VITE v8.0.16  ready in 984 ms

Neither change affects macOS or Linux behaviour: the PATH addition is behind #[cfg(windows)], and on Unix shell_path is always Some, so the new branch can't be reached even if the cfg were removed.

Two things stop Buzz working on Windows.

Managed agents get a PATH assembled from Buzz's own directories plus the user's
login-shell PATH. On Windows that login-shell PATH is always None, because Git
Bash reports POSIX colon-delimited entries that would be meaningless to a native
child. The comment there says the child inherits the real Windows PATH instead,
but it does not: the spawn calls `Command::env("PATH", ..)`, which replaces the
inherited value rather than extending it. The child ends up with Buzz's managed
directories and nothing else, so node, npm and git all disappear and every npm
`.cmd` shim dies immediately:

    '"node"' is not recognized as an internal or external command
    ERROR buzz_acp: agent initialize failed: Agent process exited unexpectedly
    Error: all 24 agents failed to start — cannot continue

Append the current process PATH on Windows when no shell PATH was supplied,
gated on local context so callers passing nothing still get None back instead of
a PATH manufactured out of ambient process state.

Separately, `beforeDevCommand` runs `exec ./node_modules/.bin/vite`. `exec` is a
POSIX shell builtin and Tauri runs the script through cmd.exe on Windows, so
`tauri dev` cannot start at all:

    'exec' is not recognized as an internal or external command
    The "beforeDevCommand" terminated with a non-zero status code.

Invoke Vite through node instead, which works on every platform. This does drop
the `exec` optimisation on Unix, where it saved an intermediate shell process,
so it is worth a look from someone who runs the macOS dev loop daily.

Signed-off-by: Alireza Bashiri <al3rez@gmail.com>
@al3rez
al3rez requested a review from a team as a code owner July 23, 2026 12:16
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.

1 participant