Repository navigation
feat(installer): save the MCP tool profile once for every launch path - #836
Conversation
The server resolved its profile only from SUMO_QA_MCP_PROFILE, so each launch path (direct CLI, the uvx plugins, installer-written host entries, JetBrains/Junie) had to carry the env var itself, and the shipped plugin .mcp.json could not carry one at all. The server now falls back to a saved profile file in the global data dir (<data dir>/sumo-qa/mcp-profile) when the env var is unset or empty; the env var still overrides it for one launch. `sumo-qa-install --profile core|full` writes the file, so the choice reaches every host and survives a restart. An unknown value in the file stops the server naming the file, and the doctor points at the installer flag to fix it. The test suite and the snapshot regen script use an empty data dir, so a developer's saved profile never changes what they build or pin. Closes #809
…ch host does - The server resolves the profile once in main() and passes it through build_mcp_server to the skill tools, load_skill_context and the skill resources, so a mid-session edit of the saved file can no longer make them disagree with tools/list or raise. - The doctor finds the saved file from the probed entry's env (XDG_DATA_HOME / LOCALAPPDATA / HOME), and the Claude Desktop probe drops the shell's XDG_DATA_HOME as the GUI app does. - The saved file is read as utf-8-sig; a non-UTF-8 file is refused naming it. - --profile is rejected with --uninstall, warns when the shell's SUMO_QA_MCP_PROFILE overrides it, writes atomically and reports an unwritable path in one line. - The suite's and the regen script's temp data dirs are removed. - Docs: --profile also configures every detected host; Junie's entry is hand-written.
…mode - resolve_profile decodes the saved file by BOM: UTF-16 (PowerShell 5.1 `>`) or UTF-8; the undecodable-file error now says how to rewrite it by hand - _required_tool_names_for builds the profile it is cached on - --profile saves through ingest's _write_atomic and gives the file the umask mode instead of the temp file's 0600 - CONFIGURATION.md: a host without the shell's XDG_DATA_HOME reads the default dir - conftest: unconfigure cleans up only when configure ran
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0033a60563
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Match env names case-insensitively (last-written spelling wins) and mirror ntpath.expanduser: USERPROFILE if present even empty, else HOMEDRIVE joined to HOMEPATH if HOMEPATH is present, else Path.home().
Merge-readiness evidence, head
|
| # | launch path | observed (each launched twice) | met |
|---|---|---|---|
| 1 | direct CLI | active_profile: core, tools/list = the 40-tool core set |
yes |
| 2 | uvx --from <wheel> (empty uv cache) |
core / 40, both launches | yes |
| 3-4 | shipped .mcp.json (Claude Code and Codex plugins both point at it) |
core / 40, both launches | yes |
| 5 | installer-written VS Code entry | core / 40, both launches | yes |
| 6 | JetBrains command the installer prints; Junie JSON from docs/INSTALL.md | core / 40, both launches | yes |
| 7 | survives restart; discovery matches tools/list |
every path, both launches | yes |
| 8 | SUMO_QA_MCP_PROFILE=full overrides for one launch |
full / 48, next launch back to core | yes |
Control: origin/main reading the same saved file serves full/48. Real agent: a headless haiku agent on the VS Code entry reported active_profile: core (40 mcp__sumo-qa__* tools in its session). Existing flow: using_sumo_qa, sumo_qa_load_classifications and sumo_qa_capabilities byte-identical on branch and origin/main with no saved profile. Evals: not run, no eval config loads the changed modules and the served skill bodies are byte-identical.
Acceptance criteria (#809): both met. One config source for every launch path (env, then the saved file, then full); a per-path smoke test (tests/test_e2e_mcp_initialize.py::test_every_launch_path_serves_the_saved_profile_across_a_restart) plus the real runs above. Drift recorded on #809: JetBrains/Junie use the direct-CLI path; the real uvx plugin launch is evidenced manually.
🤖 I have created a release *beep* *boop* --- ## [0.74.0](v0.73.1...v0.74.0) (2026-10-04) ### Features * **installer:** save the MCP tool profile once for every launch path ([#836](#836)) ([b9215a8](b9215a8)) * **release:** ship SBOM, build provenance and digests, and pin every action to a commit SHA ([#838](#838)) ([df310e6](df310e6)) ### Miscellaneous Chores * **evals:** grade a judge reply only when its verdict is unambiguous, retry once, and keep the reply ([#839](#839)) ([237ea59](237ea59)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <release-please[bot]@users.noreply.github.com>
Summary
The MCP tool profile (
core/full) could only be set per launch throughSUMO_QA_MCP_PROFILE, so each launch path (direct CLI, pip/uvx, the Claude and Codex plugins, installer-written VS Code and Claude Desktop entries, JetBrains/Junie) needed its own env, and the plugin entry could not carry one at all. There is now one saved profile file,<global data dir>/sumo-qa/mcp-profile, written bysumo-qa-install --profile core|full. Every launch reads it whenSUMO_QA_MCP_PROFILEis unset; the env var still overrides it for one launch.Related issue
Closes #809
Changes
src/sumo_qa/tool_registry.py:resolve_profile(env)reads env, then the saved file, then defaults tofull. An invalid or unreadable file is a config error naming the file. The file is read as UTF-8 (BOM tolerated) or UTF-16 with a BOM, so a PowerShell-written file works.src/sumo_qa/server.pyand the skill tools/resources/load_skill_context: the profile is resolved once inmain()and passed through, so a file changed mid-session cannot make skill tools disagree withtools/listorsumo_qa_capabilities.src/sumo_qa/paths.py:mcp_profile_path(env)/_global_root(env)resolve the data dir from a given env, so the doctor checks the file the launched server reads. On Windows theLOCALAPPDATAfallback resolves the home from that env exactly asntpath.expanduserdoes (case-insensitive names,USERPROFILE, thenHOMEDRIVE+HOMEPATH).src/sumo_qa/installer.py:--profile core|fullsaves the file (temp file in the same dir +os.replace, umask mode, works through a symlinked data dir), then configures hosts as before.--profilewith--uninstallis rejected. A warning is printed when the shell'sSUMO_QA_MCP_PROFILEdiffers from the saved value. The install verify builds the profile it is keyed on.src/sumo_qa/doctor.py: an invalid saved profile points atsumo-qa-install --profile; the Claude Desktop probe drops the shell'sXDG_DATA_HOMElike a GUI launch does.tests/conftest.py,scripts/regen_tools_list_snapshot.py: every test and the snapshot regen use an empty data dir, so a developer's saved profile cannot change what they build; temp dirs are cleaned up.docs/CONFIGURATION.md(Tool profiles: precedence, per-host coverage, plugin-only hand-written file incl. PowerShell encoding,XDG_DATA_HOMEcaveat),docs/INSTALL.md,AGENTS.md,docs/TOOLS.md.Drift from the issue text (recorded on #809): the profile was env-only before this; the installer writes no JetBrains config (it prints Settings UI steps, Junie's entry is hand-written), so those use the direct-CLI path; the plugin path launches through
uvxand needs the network, so the suite cannot run it (manual evidence below).How it was verified
tests/test_e2e_mcp_initialize.py::test_every_launch_path_serves_the_saved_profile_across_a_restart: direct CLI/JetBrains/Junie, installer-written VS Code and Claude Desktop entries, and the plugin.mcp.jsonenv, each launched twice;active_profileiscoreandtools/listequals the core set. A reviewer's five mutants (a path ignoring the file, an entry env overriding it, a redirected data dir) each fail it.--uninstall --profile, the shell-override warning, atomic save (prior file intact, no temp left), symlinked data dir, umask mode.sumo-qa-install --profile core --vscodesavedcore, the written VS Code entry launched withactive_profile=coreand 40 tools matchingtools/list; rewriting the file tofullandbogusmid-session leftcoreand no traceback; a symlinked data dir saved with mode 0644.uvx --from <checkout> sumo-qa(plugin path) from an empty uv cache, launched twice:core, 40 tools, matching.fc04e813): all 28 checks green incl. Windows; mutation gate run 37202436773 green (0 survivors); pre-push full suite and scoped mutmut passed; mypy clean.uvx, the plugin.mcp.json, the installer-written VS Code entry, the JetBrains command and Junie JSON) launched twice from a clean venv serves the savedcoreprofile with the exact 40-tool core set;SUMO_QA_MCP_PROFILE=fulloverrides for one launch;origin/mainservesfullfrom the same file. Full ledger in the proof comment./code-reviewhigh on the whole diff, then on each fix delta (6 rounds). Fixed along the way: per-call profile re-reads, the doctor's data-dir mismatch, the Claude Desktop probe, BOM/UTF-16 files,--uninstall --profile, non-atomic save, temp-dir leaks, a symlinked data dir being refused, the Windows fallback home ignoring the supplied env (review bot), and doc wording for--profileand Junie.Not changed, noted for later: if
mcp-profileitself (not its directory) is a symlink, the save replaces the link with a regular file; an interrupt (Ctrl-C) between creating the temp file and the replace can leave a harmless.mcp-profile.<id>.tmp; a re-save resets an existing file's mode to the umask default; no retry if a Windows reader briefly holds the file; no directory fsync after the replace;--uninstallremoves host configuration only and leaves the savedmcp-profile; thesumo_qa_capabilitiesactivation hint still names onlySUMO_QA_MCP_PROFILE=full;--profilesaves for the installer's own environment, so a host entry that overridesLOCALAPPDATA/USERPROFILE/XDG_DATA_HOMEreads a different file (the doctor now reports that correctly).Checklist
pytest) and lint/type checks are green (pre-commit run --all-files,python -m mypy)