Skip to content

Own MCP connection request shutdown - #140

Merged
lynnswap merged 1 commit into
mainfrom
codex/mcp-connection-request-owner-pr
Aug 22, 2026
Merged

Own MCP connection request shutdown#140
lynnswap merged 1 commit into
mainfrom
codex/mcp-connection-request-owner-pr

Conversation

@lynnswap

@lynnswap lynnswap commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Purpose

Prevent an MCP listener generation from shutting down its SwiftNIO event loop while accepted connections or already-admitted HTTP request tasks are still active.

Changes

  • Add one network resource owner per listener generation and register accepted child channels before pipeline or task dispatch.
  • Reserve each HTTP request operation and cancellation-aware work lease before creating its task.
  • Preserve the first terminal cause across server stop, peer close, and transport failure.
  • Close connection and request admission and signal child shutdown before awaiting close acknowledgements and shutting down the generation event-loop group.
  • Add deterministic coverage for child close acknowledgement, pre-dispatch cancellation, late admission rejection, peer and error draining, generation replacement, and joined stop failures.

Testing

  • MCP tests with SWIFTNIO_STRICT=1 (39 tests)
  • Owner suite repeated 10 times
  • Joined-stop failure test repeated 10 times
  • Host tests (48 tests)
  • swift test --build-system swiftbuild --no-parallel
  • scripts/check-compatibility.sh
  • ReviewMonitor xcodebuild test (15 tests)
  • Independent concurrency and root scope audits

Screenshots

Not applicable.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@lynnswap

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: a9f341ea45

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lynnswap
lynnswap merged commit 1c4d04e into main Aug 22, 2026
2 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