Skip to content

UPSTREAM PR #17174: fix(mcp): complete command captures exit code instead of erroring#41

Open
loci-dev wants to merge 2 commits intomainfrom
loci/pr-17174-mcp-work
Open

UPSTREAM PR #17174: fix(mcp): complete command captures exit code instead of erroring#41
loci-dev wants to merge 2 commits intomainfrom
loci/pr-17174-mcp-work

Conversation

@loci-dev
Copy link

@loci-dev loci-dev commented Feb 2, 2026

Note

Source pull request: nushell/nushell#17174

Summary

This is really jank and I feel there is almost certainly a better way, but it does fix the issue I was having.

Fixes #17173

The MCP server now spawns a separate worker process for nushell evaluation, communicating via unix socket instead of stdio. This isolates external commands from the MCP JSON-RPC transport.

  • Worker runs with --no-config-file (and apparently needs this or some reason)
  • Worker has isolated stdio (Stdio::null()) so external commands don't mix with JSON-RPC

Test plan

  • let a = (^ls nonexistent | complete); $a now returns {stdout:"",stderr:"...",exit_code:2} instead of erroring

andrewgazelka and others added 2 commits December 13, 2025 18:09
… (#17173)

The MCP server now spawns a separate worker process for nushell evaluation,
communicating via unix socket instead of stdio. This isolates external commands
from the MCP JSON-RPC transport.

Key changes:
- Added worker process architecture: parent handles MCP transport, child evaluates code
- Worker communicates via unix socket at a temp path based on parent PID
- Worker runs with --no-config-file to avoid config interference with error handling
- Added integration test that spawns actual worker binary

The root cause was that config file loading interfered with how external command
errors are handled. Skipping config files ensures clean, predictable behavior.

Fixes #17173

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The nushell project disallows unwrap() via clippy::unwrap_used.
Use expect() with a clear message explaining the invariant.
@loci-dev loci-dev force-pushed the main branch 18 times, most recently from da22582 to 3f38f88 Compare February 3, 2026 13:30
@loci-dev loci-dev force-pushed the main branch 7 times, most recently from 64bcc48 to d0a8c7a Compare February 17, 2026 03:26
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.

2 participants

Comments