Skip to content

fix: allow cancelling task polling#1399

Open
qybaihe wants to merge 1 commit into
modelcontextprotocol:mainfrom
qybaihe:fix-1039-cancel-task-polling
Open

fix: allow cancelling task polling#1399
qybaihe wants to merge 1 commit into
modelcontextprotocol:mainfrom
qybaihe:fix-1039-cancel-task-polling

Conversation

@qybaihe
Copy link
Copy Markdown

@qybaihe qybaihe commented Jun 1, 2026

Summary

  • Add cancellable task polling for run-as-task tool calls.
  • Show a Cancel Polling button in the Tools tab while task polling is active.
  • Preserve related task metadata in the cancellation result so the task can still be inspected separately.

Note: Inspector V2 is under development to address architectural and UX improvements. During this time, V1 contributions should focus on bug fixes and MCP spec compliance. See CONTRIBUTING.md for more details.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Refactoring (no functional changes)
  • Test updates
  • Build/CI improvements

Changes Made

  • Track the active task-polling loop with an AbortController.
  • Make the polling delay and tasks/get / tasks/result requests observe the abort signal.
  • Add a destructive Cancel Polling action next to the disabled run button while polling.
  • Add component and App-level tests for the cancel-polling path.

Related Issues

Fixes #1039

Testing

  • Tested in UI mode
  • Tested in CLI mode
  • Tested with STDIO transport
  • Tested with SSE transport
  • Tested with Streamable HTTP transport
  • Added/updated automated tests
  • Manual testing performed

Test Results and/or Instructions

  • npm test — 517 passed
  • cd client && npm run lint — passed
  • npm run build-client — passed

Checklist

  • Code follows the style guidelines (ran npm test / Prettier check)
  • Self-review completed
  • Code is commented where necessary
  • Documentation updated (README, comments, etc.)

Breaking Changes

None.

Additional Context

This cancels client-side polling. The server-side task may continue running and can still be inspected or cancelled through task APIs.

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.

Can't cancel the polling task

1 participant