fix: run results-inspector MCP server from any launcher (CWD-config + JAX stdout)#19
Merged
Merged
Conversation
Pin the server config to the assistant own config/ and force JAX onto CPU + guard stdout, all before importing autofit, so the stdio server no longer depends on the launch directory or extra environment. Fixes two defects surfaced by the Claude Desktop acceptance walkthrough (autofit_assistant#17): - autonerves.conf defaults its config dir to os.getcwd()/config and autofit reads config at import, so a foreign CWD (Desktop -> wsl.exe in a Windows folder) scanned a desktop.ini and crashed configparser interpolation. - jax._src.xla_bridge logged its backend probe to stdout during import, corrupting the JSON-RPC channel. Verified: both servers complete an MCP stdio handshake from a neutral CWD with a minimal env (PATH+HOME+PYTHONPATH) — gaussian-first ranking, zero stdout noise. Docs: Windows/WSL launch note. Core kept mirrored across both assistants. Closes #18 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Fixes two defects (surfaced by the Claude Desktop acceptance walkthrough, autofit_assistant#17) that stopped the results-inspector MCP server from running when launched from a foreign CWD / minimal env (Claude Desktop →
wsl.exe).Root causes
autonerves.confdefaults its config dir toos.getcwd()/config(PyAutoNerves/autonerves/conf.py:290) and autofit reads config at import (fitness.py:32). A foreign CWD scanned a Windowsdesktop.ini→ configparserInterpolationSyntaxErroron%windir%\System32\....jax._src.xla_bridgelogged its backend probe to stdout duringimport autofit, corrupting the JSON-RPC channel; the existing_route_logging_to_stderr()missed it (JAX handler installed first).Fix
In
server.py, before importing the autofit-backed tool modules:os.environ.setdefault("JAX_PLATFORMS","cpu"),_pin_config()(pinsconf.instanceto this assistant’s ownconfig/, independent of CWD), and wrap the tools import incontextlib.redirect_stdout(sys.stderr). Core kept byte-identical with the autolens mirror (PyAutoLabs/autolens_assistant#PENDING).Verification
Both servers complete a real MCP
initialize+list_searchesstdio handshake from/tmpwith a minimal env (PATH+HOME+PYTHONPATH — nocd, noJAX_PLATFORMS/cache vars): gaussian ranked first, zero stdout noise.test_mcp_tools.pypasses (10/10). Per the no-JAX-in-unit-tests rule this launcher behaviour is an integration handshake, not a new unit test.Post-merge: revert the live + staged Claude Desktop configs to the plain launch line (the
cd/env workarounds become unnecessary).Closes #18
🤖 Generated with Claude Code