Skip to content

fix: run results-inspector MCP server from any launcher (CWD-config + JAX stdout)#19

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/mcp-server-cwd-jax-stdout
Jul 21, 2026
Merged

fix: run results-inspector MCP server from any launcher (CWD-config + JAX stdout)#19
Jammy2211 merged 1 commit into
mainfrom
feature/mcp-server-cwd-jax-stdout

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

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

  1. CWD-dependent configautonerves.conf defaults its config dir to os.getcwd()/config (PyAutoNerves/autonerves/conf.py:290) and autofit reads config at import (fitness.py:32). A foreign CWD scanned a Windows desktop.ini → configparser InterpolationSyntaxError on %windir%\System32\....
  2. JAX stdout at importjax._src.xla_bridge logged its backend probe to stdout during import 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() (pins conf.instance to this assistant’s own config/, independent of CWD), and wrap the tools import in contextlib.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_searches stdio handshake from /tmp with a minimal env (PATH+HOME+PYTHONPATH — no cd, no JAX_PLATFORMS/cache vars): gaussian ranked first, zero stdout noise. test_mcp_tools.py passes (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

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>
@Jammy2211
Jammy2211 merged commit 417bb1a into main Jul 21, 2026
1 check passed
@Jammy2211
Jammy2211 deleted the feature/mcp-server-cwd-jax-stdout branch July 21, 2026 13:55
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.

fix: results-inspector MCP server runs from any launcher (CWD-config + JAX stdout)

1 participant