buzz icon indicating copy to clipboard operation
buzz copied to clipboard

fix(agent): resolve the home directory on Windows

Open sumit-m opened this issue 4 months ago • 0 comments

Problem

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

  • hints.rs — home_dir() returns None, so the global skill directories (~/.agents/skills, ~/.goose/skills, ~/.claude/skills) are silently never scanned.
  • auth.rs — cache_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 avatar Jul 30 '26 12:07 sumit-m