Skip to content

fix(desktop): keep windows process PATH for managed agents - #2354

Closed
Chessing234 wants to merge 1 commit into
block:mainfrom
Chessing234:fix/windows-runtime-path
Closed

fix(desktop): keep windows process PATH for managed agents#2354
Chessing234 wants to merge 1 commit into
block:mainfrom
Chessing234:fix/windows-runtime-path

Conversation

@Chessing234

Copy link
Copy Markdown
Contributor

Summary

  • on Windows, login_shell_path() returns None on purpose so children inherit the real PATH
  • build_augmented_path still returned a managed-only PATH (~/.local/bin + exe parent), and runtime overwrote the child PATH with it
  • system Node then disappeared ('"node"' is not recognized)
  • when shell PATH is missing, append the process PATH; add regression tests

Closes #2327

Test plan

  • unit tests for process-PATH fallback / shell-path preference
  • on Windows with system Node only: launch a Claude Code managed agent and confirm harness starts

Made with Cursor

@Chessing234
Chessing234 requested a review from a team as a code owner July 22, 2026 10:58
@Chessing234

Copy link
Copy Markdown
Contributor Author

when login-shell path is missing on windows we now append the process path so system node stays visible.

@Chessing234
Chessing234 force-pushed the fix/windows-runtime-path branch 2 times, most recently from 5871768 to 3b92074 Compare July 22, 2026 11:01
Signed-off-by: Taksh <takshkothari09@gmail.com>
@Chessing234
Chessing234 force-pushed the fix/windows-runtime-path branch from 3b92074 to 01119a3 Compare July 22, 2026 11:02
@wpfleger96

Copy link
Copy Markdown
Member

🤖 hey @Chessing234 — thank you for this contribution. You diagnosed this correctly: Command::env("PATH", …) replaces rather than extends, so on Windows the child was losing every system binary and npm shims died with 'node' is not recognized.

The fix landed in #2563 (cca16635d) while your PR was open, so I'm going to close this as superseded. Worth calling out that main ended up going a bit further than your version: you gated the inherited-PATH fallback on #[cfg(windows)], and main applies it on Unix too, because a login shell that exits non-zero or prints nothing hits the same failure mode there and leaves the child without curl/sh/tar. The logic now lives in should_use_inherited() and compose_path_entries() in desktop/src-tauri/src/managed_agents/runtime/path.rs, with a truth table in the compose_tests module.

I'd welcome more Windows work from you if you're up for it — nvm-windows discovery is still genuinely broken (find_nvm_default_bin only understands POSIX ~/.nvm) and that one's wide open.

@wpfleger96 wpfleger96 closed this Jul 26, 2026
@Chessing234

Copy link
Copy Markdown
Contributor Author

not really looking forward to more windows work, but happy to help

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] Windows: managed-agent harness fails to launch — runtime PATH override drops system Node ("node" is not recognized)

2 participants