Public inbound-processing completion seam for reusable bounded admission

オープン
#3,020 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
18/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript
領域
api, backend

調査の方向性

This is a public API design question, so start by asking the maintainers whether the seam fits, not by coding. Read how Protocol._onrequest removes its abort-controller entry in its finally, and how serveStdio routes inbound messages to onmessage. Done would mean agreed API shape plus lifecycle tests covering cancellation, rejected handlers, invalid envelopes, unknown methods and failed sends.

索引モデルが issue の本文から書いたものです。

説明

v1 v2

Problem

A transport can bound concurrently admitted requests, but its public onmessage callback returns void. It cannot observe when the corresponding inbound SDK handler has finished result validation/encoding, response sending and internal cleanup.

Releasing admission on transport.send is premature: Protocol._onrequest deletes its abort-controller entry in a later finally. Cancellation can suppress sending entirely while an asynchronous handler is still running. Keeping all request IDs and reservations for the connection lifetime avoids premature reuse, but prevents a bounded, indefinitely usable connection.

Reproduction

Use a Server with a handler held by a deferred promise and a transport whose send is separately deferred. Dispatch a request, cancel it while the handler is held, and observe that no response is sent. The handler can still be running after cancellation. For a successful request, hold send: neither handler return nor entry into send establishes final processing completion.

This applies to ordinary SDK resource accounting, independently of SSH or application-specific authorization. It does not propose any wire-protocol change or claim that local completion proves remote-effect rollback.

Proposed public seam

An optional transport-side per-message processing-completion callback, propagated through serveStdio opening/queue routing and invoked once after actual SDK processing and owned response sends settle. A request's callback must run after its handler controller is removed, including cancellation, rejected handlers, invalid envelopes, unknown methods and failed response sends. Notifications need their own actual handler completion. Connection close alone must not complete unfinished handlers.

The callback is local metadata, never a JSON-RPC field. Applications keep admission policy and physical downstream-operation accounting; the SDK retains negotiation, dispatch, framing and cleanup. Existing callers without the callback retain their behavior.

I would like to contribute a focused implementation and adversarial lifecycle tests. Would this transport-side completion seam fit the SDK's public API direction?

主要言語
TypeScript
スター
13.8k
フォーク
2.5k
平均マージ
6日 23時間
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

modelcontextprotocol/typescript-sdk のほかの issue

modelcontextprotocol/typescript-sdk の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。