Skip to content

fix(mcp): isolate stdio parsing from process pools#648

Merged
tirth8205 merged 1 commit into
mainfrom
codex/port-mcp-stdio-executor
Jul 17, 2026
Merged

fix(mcp): isolate stdio parsing from process pools#648
tirth8205 merged 1 commit into
mainfrom
codex/port-mcp-stdio-executor

Conversation

@tirth8205

@tirth8205 tirth8205 commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

Safe current-main replacement for #615, retaining Minxi Hou as co-author.

  • Marks stdio transport explicitly while the in-process FastMCP server is running.
  • Uses thread parsing only for active MCP stdio, on every platform.
  • Preserves the process-pool default for ordinary Unix CLI, redirected CI, and cron automation.
  • Preserves the existing Windows non-TTY compatibility fallback and explicit environment override.
  • Restores the prior transport state even when startup, auto-watch, prewarm, or server execution fails.

Source reconciliation

The source head no longer contains its claimed production executor change. Its added test invokes a module without the real entry point, forces thread mode, supplies too few files to enter the parallel path, detects descendants only after the parent exits, uses pgrep on Windows, and accepts crashes or nonzero exit codes.

This replacement uses the real python -m code_review_graph serve entry point and a JSON-RPC initialize plus full-build tool call over stdio. It builds 10 files so parallel parsing is entered, verifies the complete response and database, closes stdin, and requires a clean zero exit.

Overlap resolution

The branch is based exactly on main 4f9f035. Its incremental.py changes auto-merged with #650 NUL-path discovery. The only textual conflict was CHANGELOG ordering; both independent entries were retained.

Verification

  • 102 focused incremental, transport, and real stdio shutdown tests passed after the final rebase.
  • 1,657 broader non-daemon tests passed, with 1 expected skip and 2 existing xpasses.
  • Ruff and git diff checks passed.
  • Graph review found no affected execution flows; explicit transport/executor and end-to-end regressions cover the changed boundary.
  • Full hosted Python and native Windows CI are the merge gates.

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

code-review-graph review

Overall risk: 0.60 (MEDIUM) — 14 changed function(s)/class(es), 0 affected flow(s), 8 test gap(s)

Risk-scored changes

Risk Level Symbol Location Tested
0.60 medium code_review_graph/main.py::main code_review_graph/main.py:1046 no
0.50 medium tests/test_main.py::TestServeMainTransport.test_http_calls_mcp_run_with_host_port tests/test_main.py:112 (test)
0.40 medium code_review_graph/incremental.py::full_build code_review_graph/incremental.py:873 no
0.40 medium tests/test_mcp_stdio_shutdown.py::_send tests/test_mcp_stdio_shutdown.py:16 no
0.40 medium tests/test_mcp_stdio_shutdown.py::_read_response tests/test_mcp_stdio_shutdown.py:22 no
0.35 low code_review_graph/incremental.py::_select_executor_kind code_review_graph/incremental.py:34 no
0.30 low tests/test_incremental.py::TestParseExecutorSelection tests/test_incremental.py:28 no
0.30 low tests/test_incremental.py::TestParseExecutorSelection.test_stdio_mcp_uses_threads_on_unix tests/test_incremental.py:29 (test)
0.30 low tests/test_incremental.py::TestParseExecutorSelection.test_non_mcp_unix_automation_keeps_process_default tests/test_incremental.py:39 (test)
0.30 low tests/test_incremental.py::TestParseExecutorSelection.test_explicit_process_override_wins_in_stdio_mcp tests/test_incremental.py:49 (test)

Test gaps

  • code_review_graph/incremental.py::_select_executor_kind (code_review_graph/incremental.py:34)
  • code_review_graph/incremental.py::full_build (code_review_graph/incremental.py:873)
  • code_review_graph/main.py::main (code_review_graph/main.py:1046)
  • tests/test_incremental.py::TestParseExecutorSelection (tests/test_incremental.py:28)
  • tests/test_main.py::TestServeMainTransport (tests/test_main.py:92)
  • ...and 3 more without direct tests

Token savings: this graph-backed report used ~51,552 fewer tokens (~94%) than reading every changed file in full (estimated, chars/4 approximation).


Powered by code-review-graph — local-first analysis; no code leaves the CI runner.

@tirth8205
tirth8205 force-pushed the codex/port-mcp-stdio-executor branch from ea24c6f to fd320ad Compare July 17, 2026 17:29
Use threads only while FastMCP runs over stdio, preserving the process-pool default for ordinary Unix CLI and CI automation. Add a real parallel-build JSON-RPC shutdown regression.

Reconciles PR #615.

Co-authored-by: Minxi Hou <houminxi@gmail.com>
@tirth8205
tirth8205 force-pushed the codex/port-mcp-stdio-executor branch from fd320ad to dc56741 Compare July 17, 2026 19:45
@tirth8205
tirth8205 merged commit 11ea234 into main Jul 17, 2026
15 checks passed
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.

1 participant