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

+1
View File
@@ -49,6 +49,7 @@ def resolve_python_executable(project_root: str | None = None) -> str:
def get_detached_process_kwargs() -> dict[str, Any]:
"""Returns kwargs for subprocess.Popen to run a fully detached background process cross-platform."""
kwargs: dict[str, Any] = {
"stdin": subprocess.DEVNULL,
"stdout": subprocess.DEVNULL,
"stderr": subprocess.DEVNULL,
}