Skip to content

Own MCP HTTP response lifecycle - #144

Merged
lynnswap merged 1 commit into
mainfrom
codex/mcp-response-lifecycle-v2-pr
Aug 22, 2026
Merged

Own MCP HTTP response lifecycle#144
lynnswap merged 1 commit into
mainfrom
codex/mcp-response-lifecycle-v2-pr

Conversation

@lynnswap

@lynnswap lynnswap commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Purpose

Keep every MCP HTTP response source, heartbeat, physical write, and response-end acknowledgement owned until completion or shutdown.

Changes

  • Extend each admitted RequestOperation with explicit response-end lifecycle state while keeping NIO as the request-order owner.
  • Remove the unbounded tracked-stream producer and active-stream singleton.
  • Run source consumption, heartbeat, and writer work as structured children of the registered request task.
  • Use a one-body rendezvous so the source cannot read the next chunk until the previous physical write is acknowledged, with response bodies prioritized over heartbeats.
  • Await non-stream response writes and physical close acknowledgements for non-keepalive and error responses.
  • Remove the unsafe direct streaming seam and retain a validation-only test seam.

Testing

  • Twelve focused response lifecycle tests
  • Strict MCP and Host suites with warnings as errors
  • swift test --build-system swiftbuild --no-parallel
  • Compatibility consumer, API, and MCP gates
  • ReviewMonitor xcodebuild test (15 tests)
  • Independent concurrency and root scope/API/test 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 lynnswap changed the title fix(mcp): own HTTP response lifecycle Own MCP HTTP response lifecycle Aug 22, 2026
@lynnswap

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 7791ee9b66

ℹ️ 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 21bc9aa 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