Skip to content

Fix Claude Desktop paths and managed check on Linux - #6883

Merged
jerm-dro merged 3 commits into
mainfrom
fix-claude-desktop-linux-paths
Oct 21, 2026
Merged

jerm-dro merged 3 commits into
mainfrom
fix-claude-desktop-linux-paths

Conversation

@jerm-dro

@jerm-dro jerm-dro commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

On Linux, ToolHive looked for Claude Desktop in the wrong places. The Claude Desktop entry set path prefixes only for macOS and Windows, so on Linux both paths were joined directly under the home directory: ~/Claude-3p/configLibrary/ instead of ~/.config/Claude-3p/configLibrary/, and ~/Claude instead of ~/.config/Claude. As a result, thv llm setup never detected an installed Claude Desktop. With --client claude-desktop it wrote a config Desktop never reads, and thv client connector add|list|rm had the same problem. The check for a managed configuration was also macOS-only, so on Linux nothing warned that /etc/claude-desktop/managed-settings.json overrides the local config.

  • Add the .config Linux prefix to Claude Desktop's configLibrary and detection paths, matching the Claude Desktop configuration reference and the other clients in config.go.
  • Make IsManaged check /etc/claude-desktop/managed-settings.json on Linux. Any entry at that path counts, including one Desktop rejects. The existing thv llm setup and thv client connector add warnings now fire on Linux.
  • Reword those warnings from "managed-preferences profile" (macOS terminology) to "managed configuration", so they're accurate on both platforms.
  • Fix TestRevertCredentialHelper_RejectsUnsafeConfigPath, which hardcoded the macOS path. On Linux it created the wrong directory and passed without reaching the guard it tests.

Fixes #6847

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

The new TestClaudeDesktopPathsResolvePerPlatform reads the prefix maps for every platform rather than only runtime.GOOS. It failed on macOS for the linux case before the fix, so the gap is caught on any runner, not just Linux CI. TestAddConnector_WarnsWhenDesktopWillNotLoadIt no longer skips the managed case outside macOS, so Linux CI now exercises the Linux managed-file check. Not tested against a real Claude Desktop install on Linux.

Does this introduce a user-facing change?

Yes, on Linux only:

  • Before: thv llm setup did not detect Claude Desktop. --client claude-desktop and thv client connector add|list|rm --client claude-desktop read and wrote ~/Claude-3p/configLibrary/, which Desktop ignores. No warning when /etc/claude-desktop/managed-settings.json is present.
  • After: Claude Desktop is detected through ~/.config/Claude, its configuration is written to ~/.config/Claude-3p/configLibrary/, and both commands warn when the managed settings file is present.

Any configuration a Linux user previously wrote to ~/Claude-3p/ is left in place and not migrated. Desktop never read it, so nothing that worked before stops working.

On macOS, the setup and connector warnings now say "managed configuration" instead of "managed-preferences profile". Detection on macOS is unchanged.

Special notes for reviewers

  • Linux managed-file detection counts any entry at the path and does not replicate Desktop's validity checks (regular file, owned by root, not group- or world-writable). Per the configuration reference, Desktop rejects a file that fails them but still treats the device as managed and disables local settings, so the local config is ignored either way. The warnings also say to fix the managed configuration if Desktop rejected it.
  • The Linux file location is a package variable (/etc) plus a relative path on the client entry. This mirrors the existing macOS managedPreferencesRoot and LLMManagedProfileDomain pair, so tests can redirect it.
  • Known limitation, same as every other client in config.go: if $XDG_CONFIG_HOME is set, Electron uses it instead of ~/.config. That's better handled for all clients in a separate change.

Found by @aponcedeleonch in review of #6840.

🤖 Generated with Claude Code

Claude Desktop's configLibrary and user-data directories live under
~/.config on Linux, but the client entry only set prefixes for macOS
and Windows, so setup never detected Desktop and wrote config it never
reads. Add the Linux prefix, and detect the Linux managed settings file
(/etc/claude-desktop/managed-settings.json) in IsManaged so setup and
connector add warn when it overrides the local config.

Fixes #6847

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Existing Linux E2E fixtures still use the old paths, causing both Claude Desktop specs to fail installation detection.

1 open issue
What changed in this PR

Fixes Claude Desktop’s Linux configuration paths and adds managed-settings detection to ToolHive’s setup and connector workflows.

Changes:

  • Add .config prefixes for Linux configuration and installation detection.
  • Detect Linux managed settings and use platform-neutral warnings.
  • Expand regression tests and update connector help.
File Description
pkg/​llm/​setup.go Update managed-configuration warning wording.
pkg/​llm/​setup_test.go Match the revised warning.
pkg/​client/​llm_gateway.go Pass client configuration to managed-source detection.
pkg/​client/​llm_gateway_credential_helper.go Detect regular Linux managed-settings files.
pkg/​client/​llm_gateway_credential_helper_test.go Cover platform paths and managed-file detection; repair guard fixture.
pkg/​client/​config.go Correct Linux paths and declare managed-settings location.
pkg/​client/​claude_desktop_connectors.go Update connector warning wording.
pkg/​client/​claude_desktop_connectors_test.go Exercise Linux managed-configuration warnings.
docs/​cli/​thv_client_connector_add.md Document Linux managed settings.
cmd/​thv/​app/​client_connector.go Update connector command help.

Review effort: Balanced

Comment thread pkg/client/config.go Resolved
The fixture encoded the old Linux paths without the ~/.config prefix,
so the Claude Desktop specs would fail installation detection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Oct 20, 2026
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.79%. Comparing base (56fd4df) to head (e1a8b1d).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
pkg/client/llm_gateway_credential_helper.go 71.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6883      +/-   ##
==========================================
+ Coverage   79.76%   79.79%   +0.03%     
==========================================
  Files         825      827       +2     
  Lines       84263    84553     +290     
==========================================
+ Hits        67212    67470     +258     
- Misses      17046    17078      +32     
  Partials        5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

aponcedeleonch
aponcedeleonch previously approved these changes Oct 21, 2026

@aponcedeleonch aponcedeleonch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The path fixes look right to me. They match the configuration reference for configLibrary, the user-data dir, and the managed file location on all three platforms.

My only comment is on the symlink handling in managedSettingsFileExistsUnder. The docs say a managed file that fails the checks (symlink, wrong owner, group/world-writable) is rejected, but the app then "treats the device as managed but unreadable, and local settings are also disabled". So a symlinked file still means Desktop won't read what thv writes, and today we'd skip the warning in exactly that case. I think we should count any entry at that path as managed. That also means skipping the ownership checks is fine, though not because of the false-positive reasoning in the notes. Ideally the warning for an invalid file would say to fix it rather than "add it to the managed configuration instead".

Claude Desktop rejects a managed settings file that is a symlink, not
owned by root, or group- or world-writable, but still treats the device
as managed and disables local settings. The local config ToolHive writes
is ignored either way, so count any entry at the path as managed instead
of only a regular file. The warnings now also say to fix the managed
configuration if Desktop rejected it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Oct 21, 2026
@jerm-dro

Copy link
Copy Markdown
Collaborator Author

@aponcedeleonch Agreed, thanks. Any entry at that path now counts as managed, and the warnings also say to fix the managed configuration if Desktop rejected it. Updated the reviewer notes to match. Fixed in e1a8b1d.

@jerm-dro
jerm-dro merged commit 9abf364 into main Oct 21, 2026
90 of 95 checks passed
@jerm-dro
jerm-dro deleted the fix-claude-desktop-linux-paths branch October 21, 2026 20:06
@github-actions github-actions Bot mentioned this pull request Oct 22, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Claude Desktop config and detection paths are wrong on Linux

4 participants