Skip to content

fix(config): honor XDG directory overrides - #119

Closed
abouchard11 wants to merge 1 commit into
ActivityWatch:masterfrom
abouchard11:abouchard11-embedded-captions
Closed

abouchard11 wants to merge 1 commit into
ActivityWatch:masterfrom
abouchard11:abouchard11-embedded-captions

Conversation

@abouchard11

Copy link
Copy Markdown

Local ActivityWatch server API keys were not discovered when XDG directory overrides were set on platforms where platformdirs ignores those variables. This prevented authenticated requests from using the configured local server key.

The config directory helpers now honor XDG_DATA_HOME, XDG_CONFIG_HOME, and XDG_CACHE_HOME when set, while preserving platformdirs behavior otherwise. This also keeps local auth lookup consistent with the test and runtime directory layout.

Tests: python -m pytest tests/test_auth.py tests/test_profile_config.py -q (21 passed)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Sep 17, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge with no actionable correctness, security, or repository-rule violations identified.

Summary

This PR makes ActivityWatch’s data, configuration, and cache directory helpers honor explicit XDG home-directory overrides before falling back to platformdirs.

  • Restores local API-key discovery where platformdirs ignores XDG variables.
  • Applies consistent override handling to data, configuration, and cache roots.
  • Preserves existing default behavior when overrides are unset.

Reviews (1) · Last reviewed commit: "fix(config): honor XDG directory overrid..."

@abouchard11

Copy link
Copy Markdown
Author

Checking in on this one — anything you need from me to move it along?

@ErikBjare

Copy link
Copy Markdown
Member

Thanks, but platformdirs already honors XDG_* on Linux, and on macOS/Windows the server (aw-server-rust via the dirs crate, aw-server/aw-core via platformdirs) ignores XDG_*, so the key is never written under $XDG_CONFIG_HOME there. Honoring it only in the client would make key lookup miss the server config for any macOS/Windows user with XDG vars set. Directory resolution has to stay identical across aw-core, aw-server and aw-server-rust (now documented in #120 and ActivityWatch/aw-core#160). If the problem is test isolation on macOS, the fix belongs in the test fixtures (patch the _user_*_dir wrappers, as fake_platform_dirs already does), not in runtime code.

@ErikBjare ErikBjare closed this Sep 25, 2026
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.

2 participants