Skip to content

Conversation

@michaelneale
Copy link
Collaborator

@michaelneale michaelneale commented Nov 20, 2025

fixes: #5777

setx seems like it is not a great thing to call, it should not mess with users env, even if it limits what it can do.

@jamadeo not sure who is best equipped with windows to think on this, but it seems like we shoulen't be messing with PATH that exists outside of goose.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the persistPathForUser function that was permanently modifying the Windows user's PATH environment variable using setx commands. The change ensures that PATH modifications only affect the Goose application and its child processes, not the user's persistent shell environment.

Key changes:

  • Removed the persistPathForUser function and its PowerShell script that used setx
  • Removed the unused spawn import from child_process
  • Added uv.exe to the list of shims to copy
  • Updated comments to clarify that PATH changes are temporary and process-scoped only

);

// Prepend to PATH **for this process & all children**.
// Make sure our bin directory is at the VERY BEGINNING of PATH
Copy link

Choose a reason for hiding this comment

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

This comment explains it - it injects at the beginning of PATH and as such is the first valid command, as PATH search path is executed from left to right. If it would just append at the end it wouldn't make such problem, but not changing PATH environment variable w/o user consent would be even greater.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yep, thanks for bringing it up @klonuo (and goose made it clear it was bad, and even when I switched models a few times, as I didn't believe that it would do that!). Its been decades since I was a windows dev and the registry gives me chills (not the good kind).

}
}

// Optional: Persist PATH for user's external PowerShell/CMD sessions
Copy link
Collaborator

Choose a reason for hiding this comment

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

The "Optional" here says it all: this was probably inserted by llm and barely glanced at. We should definitely not be adding these to the user's PATH.

@DOsinga DOsinga merged commit 6e511d1 into main Nov 20, 2025
25 of 26 checks passed
@DOsinga DOsinga deleted the micn/winShim-no-setx branch November 20, 2025 18:35
michaelneale added a commit that referenced this pull request Nov 24, 2025
* main: (48 commits)
  [fix] generic check for gemini compat (#5842)
  Add scheduler to diagnostics (#5849)
  Cors and token (#5850)
  fix sessions coming back with empty messages (#5841)
  markdown export from URL (#5830)
  Next camp refactor live (#5706)
  Add out of context compaction test via error proxy (#5805)
  fix: Add backward compatibility for conversationCompacted message type (#5819)
  Add /agent/stop endpoint, make max active agents configurable (#5826)
  Handle 404s (#5791)
  Persist provider name and model config in the session (#5419)
  Comment out the flaky mcp callers (#5827)
  Slash commands (#5718)
  fix: remove setx calls to not permanently edit the windows shell PATH (#5821)
  fix: Parse maas models for gcp vertex provider (#5816)
  fix: support Gemini 3's thought signatures (#5806)
  chore: Add Adrian Cole to Maintainers (#5815)
  [MCP-UI] Proxy and Better Message Handling (#5487)
  Release 1.15.0
  Document New Window menu in macOS dock (#5811)
  ...
BlairAllan pushed a commit to BlairAllan/goose that referenced this pull request Nov 29, 2025
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.

Please isolate your environment

5 participants