fix: exit connector when the app service disconnects - #47
Conversation
|
Independent agent review approves exact head The reviewer read all three changed files, unchanged connect_stdio I/O, locked Tokio runtime/stdin source, positive/negative real-process tests and the independent baseline/candidate matrix. The private helper consumes a runtime only at the two terminating connector entrypoints. Desktop, capture, direct stdio/HTTP and non-macOS managed modes retain their prior lifecycle. Successful response flushing, request half-close, error propagation and normal backpressure are preserved; no shared FD flags, automatic reconnection or request replay are introduced. Tests keep ChildStdin open throughout the process-exit assertion and fail on the old implementation. They also verify backpressured upload, large exact final responses and explicit reconnect after fixture-service replacement. The independent matrix confirms the idle-stdin failure/fix distinction and same-host replacement behavior. No blocking finding or scope expansion was identified. All 135 safe tests and six PR CI jobs passed at this head (run |
Summary
When Nova.app closed its socket while host stdin remained open and idle, the CLI connector finished forwarding but hung during Tokio runtime destruction, waiting for an uncancellable blocking stdin read. The host could keep seeing a live connector after the service was gone.
Route the pure
mcp(macOS) /--connectentrypoints through a helper that consumes their dedicated runtime, waits for the existing forwarding/flush result, then releases the runtime immediately before the connector process exits. Remaining stdin resources are reclaimed by process exit. This helper is deliberately unsuitable for resident/embedded runtimes; no FD flags, app-service I/O, desktop lifecycle or Windows native-stdio behavior change.Closes #40. No request replay, automatic reconnection, restored MCP session, permission, browser or packaging changes.
Test Plan
Screenshots
No UI change. Process exit, exact forwarded bytes and host/service identities provide the acceptance evidence.