Skip to content

fix: exit connector when the app service disconnects - #47

Merged
bigduu merged 1 commit into
masterfrom
nova/fix/40-connector-disconnect
Sep 5, 2026
Merged

bigduu merged 1 commit into
masterfrom
nova/fix/40-connector-disconnect

Conversation

@bigduu

@bigduu bigduu commented Sep 5, 2026

Copy link
Copy Markdown
Owner

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) / --connect entrypoints 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

  • Real-process regression fails on base 4aebba0 and passes on this head with host stdin still open after service EOF, for both connector entrypoints.
  • Added backpressured-upload disconnection, client/service EOF with a 96 KiB request forwarded once and complete 128 KiB response plus short final tail, missing service, and replacement-service reconnection. The replacement accepts nothing until a new connector explicitly starts.
  • Independent installed-baseline/candidate fixture matrix confirms idle-stdin failure versus prompt fixed exits, retains active-upload behavior, drains final output, and reconnects two service generations under one live host. These tests use isolated owned sockets; no desktop bootstrap, OS permission or installed-service change is needed.
  • Passed 122 library + 3 CLI + 2 launcher + 8 managed tests; strict macOS and Windows ARM all-target Clippy, formatting, diff and locked full metadata. Windows is compile-checked, not desktop-tested.
  • CI runs the remaining repository checks in isolation. Ordinary stdout backpressure remains: the host must read output. This is not a promise to preserve unlimited output while a host refuses to read it.

Screenshots

No UI change. Process exit, exact forwarded bytes and host/service identities provide the acceptance evidence.

@bigduu bigduu added the review:needed Waiting for review label Sep 5, 2026
@bigduu

bigduu commented Sep 5, 2026

Copy link
Copy Markdown
Owner Author

Independent agent review approves exact head 1783083c28d17b0e0e4fb2842480ece4ffba37e5 (tree e73477c9a843f9b8f2a1502f7af4627302c42be7), based on 4aebba0. Reviewer bodhi_nova_boundary is separate from the implementation agent.

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 33967271208). This records the independent agent review rather than a GitHub human approval.

@bigduu bigduu added review:agent Agent review complete; human final review may proceed and removed review:needed Waiting for review labels Sep 5, 2026
@bigduu
bigduu merged commit 7f97daa into master Sep 5, 2026
6 checks passed
@bigduu
bigduu deleted the nova/fix/40-connector-disconnect branch September 5, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:agent Agent review complete; human final review may proceed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[nova] fix: exit connector promptly after app service disconnects

1 participant