fix: isolate subprocess stdin and decouple startup to prevent MCP stdio deadlocks

- Set stdin=subprocess.DEVNULL across runtime, client, and utility subprocess calls to avoid hijacking the parent process's stdin.
- Run awake service initialization asynchronously on a daemon thread in MCP server startup.
- Redirect logger header printing to stderr to ensure stdio JSON-RPC purity.
- Add unit and lifecycle tests for MCP stdio protocol handshake and stdin isolation.
This commit is contained in:
somew1nd committed 2026-08-26 23:26:10 -07:00
1 parent 8fdecf23d7
commit e984d17635
12 files changed
+237 -13

No files matched your search

+4 -1
View File
@@ -19,6 +19,7 @@ import os
from pathlib import Path
import re
import sys
import threading
import tomllib
from typing import Annotated
@@ -724,7 +725,9 @@ def mcp_command(
console.print(syntax)
raise typer.Exit(0)
start_awake_service()
threading.Thread(
target=start_awake_service, daemon=True, name="artemis-awake-init"
).start()
try:
st = server_type.lower()
if st in ("agent", "mobile", "artemis", "default"):