Skip to content

fix: resetTimeoutOnProgress does nothing without onprogress callback#2136

Open
malventano wants to merge 1 commit into
modelcontextprotocol:v1.xfrom
malventano:fix/reset-timeout-without-onprogress
Open

fix: resetTimeoutOnProgress does nothing without onprogress callback#2136
malventano wants to merge 1 commit into
modelcontextprotocol:v1.xfrom
malventano:fix/reset-timeout-without-onprogress

Conversation

@malventano
Copy link
Copy Markdown

@malventano malventano commented May 21, 2026

Refs #2076.

There's a setting in the MCP client library that keeps long-running tasks from timing out. By default, requests die after 60 seconds. With this setting turned on, every time the server reports "I'm still working," that 60-second timer resets so the task can continue. But it only works if the client also provides an onprogress callback alongside it. If the client passes resetTimeoutOnProgress: true without also passing onprogress, the progress notifications arrive but are silently dropped and the timer never resets. The option claims to work on its own — it doesn't.

Why it happens

_onprogress() looks up the handler in _progressHandlers first, and that map is only populated when onprogress is provided (in request()). If no handler exists, the method errors and returns before reaching the timeout reset code.

The fix

Move the timeout reset before the handler lookup. Guard only handler(params).

After

  • resetTimeoutOnProgress: true works standalone — no onprogress needed
  • Existing callers with both options work identically
  • Unknown tokens still error after attempted reset

@malventano malventano requested a review from a team as a code owner May 21, 2026 03:25
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 21, 2026

⚠️ No Changeset found

Latest commit: dd05570

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 21, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@modelcontextprotocol/sdk@2136

commit: dd05570

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.

1 participant