Skip to content

Commit 743a887

Browse files
committed
fix: inject progressToken when resetTimeoutOnProgress is set
Previously, _meta.progressToken was only injected into the outgoing JSON-RPC request when options.onprogress was provided. Setting resetTimeoutOnProgress: true alone had no effect because the SDK's _onprogress handler matches incoming notifications by params.progressToken → messageId — without a token in the request, server progress notifications can never be matched, and _resetTimeout is never called. This change expands the injection condition to also fire when resetTimeoutOnProgress is true, making the flag behave as its name implies: if you want the timeout to reset on progress, the server must be able to send progress notifications that match the request. The onprogress handler registration is unchanged — a no-op progressToken injection when only resetTimeoutOnProgress is set does not register a progress handler (avoiding unnecessary memory use). Fixes: #245
1 parent 7ba58da commit 743a887

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

packages/core/src/shared/protocol.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,8 +832,10 @@ export abstract class Protocol<ContextT extends BaseContext> {
832832
id: messageId
833833
};
834834

835-
if (options?.onprogress) {
836-
this._progressHandlers.set(messageId, options.onprogress);
835+
if (options?.onprogress || options?.resetTimeoutOnProgress) {
836+
if (options.onprogress) {
837+
this._progressHandlers.set(messageId, options.onprogress);
838+
}
837839
jsonrpcRequest.params = {
838840
...request.params,
839841
_meta: {

0 commit comments

Comments
 (0)