fix(core): reset request timeout on progress without an onprogress handler - #2224
Conversation
🦋 Changeset detectedLatest commit: aa47d06 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@modelcontextprotocol/client
@modelcontextprotocol/codemod
@modelcontextprotocol/core
@modelcontextprotocol/server
@modelcontextprotocol/server-legacy
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
|
Gentle ping on this when you have review bandwidth. CI is green, the regression test covers #2076, and the change is scoped to preserving Happy to adjust if you prefer the timeout-reset ordering handled differently. |
57a2c9a to
aa47d06
Compare
|
Revived and rebased onto current |
What
resetTimeoutOnProgress: trueis documented to keep a long-running request alive as progress notifications arrive. In practice it only worked when anonprogresscallback was also passed on the samerequest()call.Without
onprogress, the request did not advertise_meta.progressToken, and_onprogresstreated any manually delivered progress as an unknown token before the timeout-reset code could run. (#2076)Fix
_meta.progressTokenwhen eitheronprogressorresetTimeoutOnProgressis enabled.This preserves the existing task-progress path, where a progress handler may remain after the response handler is gone, and still reports genuinely unknown tokens.
Test plan
Protocol.request()regression coveringresetTimeoutOnProgress: truewithoutonprogress.pnpm exec vitest run test/shared/protocol.test.ts: 40 passed.pnpm --filter @modelcontextprotocol/core-internal test: 1,434 passed.pnpm --filter @modelcontextprotocol/core-internal check: passed.Scope
This PR targets
main(SDK v2). The stablev1.xbranch requires a separate backport PR if maintainers want the same fix there.Fixes #2076