Skip to content

fix: cancel and bound upstream runtime requests - #156

Merged
gaojude merged 2 commits into
mainfrom
codex/fix-runtime-cancellation
Sep 9, 2026
Merged

gaojude merged 2 commits into
mainfrom
codex/fix-runtime-cancellation

Conversation

@gaojude

@gaojude gaojude commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

An MCP client timeout currently leaves upstream network requests running. Protocol probes also return after headers without releasing their response bodies, so a server that sends headers and keeps its body open can retain connections after the caller gives up.

Pass the MCP request's abort signal through discovery and runtime calls, bound upstream requests (including response-body reads) to 60 seconds, and cancel status-only probe bodies. An internal timeout option lets regression tests exercise the same deadline path quickly. Update the README and add a patch changeset.

Validation:

  • Five new lifecycle assertions failed against the original implementation; the healthy control passed.
  • pnpm build, pnpm typecheck, and the complete pnpm exec vitest run: 39 tests passed.
  • Real loopback HTTP tests cover stalled headers, stalled bodies, a 100 ms request deadline, probe-body release, pre-aborted callers, and successful requests.
  • A real SDK stdio client timed out a request to an indefinitely streaming endpoint. Both upstream responses closed, and the same MCP connection then successfully queried a real Next.js 16.3.4 server.

Local validation used macOS arm64, Node.js 24.19.0, and pnpm 9.15.9. The uploaded GitHub-signed commit has the same Git tree as the tested checkout.

@gaojude
gaojude force-pushed the codex/fix-runtime-cancellation branch from 30cabab to 920778c Compare September 9, 2026 17:16
@gaojude
gaojude merged commit ec7987b into main Sep 9, 2026
5 checks passed
@gaojude
gaojude deleted the codex/fix-runtime-cancellation branch September 9, 2026 17:18
@github-actions github-actions Bot mentioned this pull request Sep 9, 2026
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.

2 participants