fix(agent): resolve the home directory on Windows - #3732
Open
sumit-m wants to merge 2 commits into
Open
Conversation
hints.rs and auth.rs read $HOME directly, which Windows does not define outside shells like Git Bash — the desktop spawns agents from a GUI process without it. Global skill directories were never scanned and every OAuth provider failed with "oauth cache: $HOME not set". Use dirs::home_dir, and compare path components instead of a forward-slash substring in the cache-path test. Signed-off-by: sumit-m <33051892+sumit-m@users.noreply.github.com>
Signed-off-by: sumit-m <33051892+sumit-m@users.noreply.github.com>
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.
Problem
Two sites read the home directory straight out of
$HOME:hints.rs—home_dir()returnsNone, so the global skill directories (~/.agents/skills,~/.goose/skills,~/.claude/skills) are silently never scanned.auth.rs—cache_path_forhard-fails withoauth cache: $HOME not set, breaking every OAuth-cached provider.Windows does not define
HOME. It exists only inside shells that export it, such as Git Bash — and the desktop spawns agents from a GUI process, which sets no such variable. Verified on a Windows 11 host:HOMEis empty at both User and Machine scope and empty in a GUI-launched process, whileUSERPROFILEis populated.Change
Both sites go through
dirs::home_dir(), which consults the platform's own notion of the profile directory.dirs = "6"is already the convention inbuzz-clianddesktop/src-tauri.The
.configpath segment is deliberately kept on every platform. Switching Windows to%APPDATA%— or macOS todirs::config_dir(), which would resolve to~/Library/Application Support— would relocate caches that already exist. That is a separate decision from fixing the failure, and I did not want to fold a migration into a bug fix. Happy to follow up if you'd prefer the idiomatic locations.Tests
home_dir_resolves_on_this_platform— would have failed on Windows before.cache_path_is_rooted_at_the_platform_home— likewise; previouslyErr.cache_path_includes_namespace_and_hashcompared against the literal"/buzz-agent/oauth/demo/", which can never match on Windows. It now compares path components.cargo clippy -p buzz-agent --all-targetsclean; 301 pass on Windows. One pre-existing Windows failure is left untouched:hints::tests::discover_skills_dedup_by_nameasserts.agents/wins over.goose/, which depends on directory iteration order — it fails identically onmain.