fix(core): preserve relatedRequestId 0 in debounce guard#2135
fix(core): preserve relatedRequestId 0 in debounce guard#2135kiranmagic7 wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 6da1da1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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/server
@modelcontextprotocol/server-legacy
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
ab47799 to
5d11cba
Compare
|
Rebased this on current main (head
GitHub checks have now completed successfully on the refreshed head. |
5d11cba to
2b6b644
Compare
|
Rebased this on current Local verification after the rebase: GitHub now reports the branch as mergeable again; checks are running on the refreshed head. |
|
Friendly follow-up: this still looks ready for maintainer/code-owner review. Latest head |
2b6b644 to
72f0af9
Compare
|
Rebased this on current Local verification after the rebase: GitHub checks should restart on the refreshed head. |
72f0af9 to
6da1da1
Compare
|
Rebased this on current Local verification after the rebase: GitHub checks should restart on the refreshed head. |
What changed
relatedRequestIdas present unless it isundefinedwhen deciding whether a notification can be debounced.relatedRequestId: 0.@modelcontextprotocol/core.Why
0is a valid MCP/JSON-RPC request id. The previous truthiness check treatedrelatedRequestId: 0as absent, so simple request-associated notifications could be coalesced by the debounce path while non-zero ids were sent immediately.Fixes #2117.
Tests
pnpm --filter @modelcontextprotocol/core exec vitest run test/shared/protocol.test.ts -t "relatedRequestId 0"— passespnpm --filter @modelcontextprotocol/core exec vitest run test/shared/protocol.test.ts— 151 tests passpnpm --filter @modelcontextprotocol/core test— 553 tests passpnpm --filter @modelcontextprotocol/core typecheck— passespnpm --filter @modelcontextprotocol/core lint— passespnpm changeset status --since origin/main— reports@modelcontextprotocol/corepatch bumpCompatibility / risk
Small behavior fix only: notifications already associated with non-zero request ids bypass debounce; this makes request id
0follow the same path. Notifications without a related request id remain debounced as before.