fix: agent config panel resolves Claude MCP paths from CLAUDE_CONFIG_DIR - #3502
Open
1nderboi wants to merge 1 commit into
Open
fix: agent config panel resolves Claude MCP paths from CLAUDE_CONFIG_DIR#35021nderboi wants to merge 1 commit into
1nderboi wants to merge 1 commit into
Conversation
…ONFIG_DIR The agent config panel read Claude Code's MCP server list and file attribution from ~/.claude/settings.json and ~/.claude.json unconditionally, ignoring an agent's own CLAUDE_CONFIG_DIR. An isolated agent's runtime was correctly scoped, but its config panel still showed the operator's personal MCP servers, making the isolation look broken when it wasn't. claude::read_config_file and reader::mcp_config_file_path_for_runtime now resolve settings.json/.claude.json against the agent's effective CLAUDE_CONFIG_DIR (record.env_vars) when set, matching Claude Code's own resolution. Fixes block#3493 Signed-off-by: 1nderboi <201919958+1nderboi@users.noreply.github.com>
7 tasks
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.
Summary
clauderuntime always read~/.claude/settings.json+~/.claude.json, ignoring an agent's ownCLAUDE_CONFIG_DIR.CLAUDE_CONFIG_DIR(to isolate it from the operator's personal Claude Code config) genuinely spawns isolated — but the panel kept showing the operator's MCP servers, which reads as "the isolation didn't work" and is alarming when the personal config has mail/drive/database connectors.Fix
claude::read_config_filenow takes an optionalconfig_dirand resolves bothsettings.jsonand.claude.jsonunder it when given (matching Claude Code's ownCLAUDE_CONFIG_DIRresolution, which relocates both files together) — falling back to~/.claude/settings.json+~/.claude.jsonotherwise.reader::mcp_config_file_path_for_runtimeresolves the same way for the panel's file-attribution path.CLAUDE_CONFIG_DIRfrom the agent's ownrecord.env_vars.Why this scope
The confirmed root cause (and the issue title) is specifically the per-agent
CLAUDE_CONFIG_DIRoverride — the most common way to isolate an agent today. Threading the fully layered effective env (global defaults + persona + per-agent) through would require wideningread_config_surface's signature across ~25 call sites for a case the issue doesn't demonstrate a concrete repro for; happy to follow up if that's wanted.Test plan
claude.rs: isolatedCLAUDE_CONFIG_DIRreads settings/MCP servers from that dir; an empty isolated dir does not fall back to~/.claude.json;claude_config_pathsnests both files under an explicit dir.reader_tests.rstest assertingread_config_surfacesurfaces MCP extensions and themcp_config_file_pathfrom the per-agentCLAUDE_CONFIG_DIR, not the default.cargo test --manifest-path desktop/src-tauri/Cargo.toml --lib managed_agents::config_bridge— 84 passed, 0 failed.cargo clippy --manifest-path desktop/src-tauri/Cargo.toml --all-targets— clean.cargo fmt --manifest-path desktop/src-tauri/Cargo.toml --all -- --check— clean.🤖 Generated with Claude Code