Skip to content

fix(agent): resolve the home directory on Windows - #3732

Open
sumit-m wants to merge 3 commits into
block:mainfrom
sumit-m:windows-agent-home
Open

fix(agent): resolve the home directory on Windows#3732
sumit-m wants to merge 3 commits into
block:mainfrom
sumit-m:windows-agent-home

Conversation

@sumit-m

@sumit-m sumit-m commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Problem

Two sites read the home directory straight out of $HOME:

  • hints.rshome_dir() returns None, so the global skill directories (~/.agents/skills, ~/.goose/skills, ~/.claude/skills) are silently never scanned.
  • auth.rscache_path_for hard-fails with oauth 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: HOME is empty at both User and Machine scope and empty in a GUI-launched process, while USERPROFILE is 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 in buzz-cli and desktop/src-tauri.

The .config path segment is deliberately kept on every platform. Switching Windows to %APPDATA% — or macOS to dirs::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; previously Err.
  • cache_path_includes_namespace_and_hash compared against the literal "/buzz-agent/oauth/demo/", which can never match on Windows. It now compares path components.

cargo clippy -p buzz-agent --all-targets clean; 301 pass on Windows. One pre-existing Windows failure is left untouched: hints::tests::discover_skills_dedup_by_name asserts .agents/ wins over .goose/, which depends on directory iteration order — it fails identically on main.

@sumit-m
sumit-m requested a review from a team as a code owner July 30, 2026 12:59
sumit-m added 2 commits August 1, 2026 01:28
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>
@sumit-m
sumit-m force-pushed the windows-agent-home branch from 91674ef to 05da58c Compare July 31, 2026 20:03
dirs::home_dir ignores $HOME on Windows in favour of USERPROFILE, so an
explicitly set HOME was silently overridden and hints_integration's temp-dir
isolation stopped working there. Fall back to dirs::home_dir instead of
replacing the variable; Unix behaviour is unchanged.

Signed-off-by: sumit-m <33051892+sumit-m@users.noreply.github.com>
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