Skip to content

Add cancel control for task polling - #1729

Closed
HarperZ9 wants to merge 1 commit into
modelcontextprotocol:v1/mainfrom
HarperZ9:agent/cancel-task-polling
Closed

Add cancel control for task polling#1729
HarperZ9 wants to merge 1 commit into
modelcontextprotocol:v1/mainfrom
HarperZ9:agent/cancel-task-polling

Conversation

@HarperZ9

Copy link
Copy Markdown

Summary

Adds a cancel control for tool calls that are running as MCP tasks and currently being polled from the Tools tab.

Root cause

The app already exposed tasks/cancel through the Tasks tab, but a user who launched a tool as a task from the Tools tab only saw the disabled Polling Task... button. The active polling task ID was not stored in a way that Tools could cancel, and the polling loop could continue into tasks/get after a user wanted to stop it.

Changes

  • Track the active polling task ID/run in App.
  • Pass pollingTaskId and cancelTaskPolling into ToolsTab.
  • Render a scoped Cancel Task button while a tool task is actively polling.
  • Wake and stop the local polling delay after successful cancellation.
  • Guard against late tasks/get / tasks/result responses overwriting the cancelled state.
  • Add regression coverage for direct cancellation and an in-flight polling response race.

Closes #1039.

Validation

  • npm.cmd test -- --runTestsByPath src/__tests__/App.taskPolling.test.tsx --runInBand
  • npm.cmd run build-client
  • npm.cmd run lint
  • npx.cmd prettier --check client/src/App.tsx client/src/components/ToolsTab.tsx client/src/__tests__/App.taskPolling.test.tsx
  • git diff --check

@cliffhall
cliffhall changed the base branch from main to v1/main July 28, 2026 03:03
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@HarperZ9
HarperZ9 force-pushed the agent/cancel-task-polling branch from 829ad3a to d471394 Compare July 29, 2026 03:38
@cliffhall

cliffhall commented Jul 31, 2026

Copy link
Copy Markdown
Member

Closing: v1 is deprecated.

Thank you for this contribution, and apologies for the long wait for a response.

v1 will receive security fixes only. We reviewed every open v1 PR for security impact before closing — see the backlog triage in #1819 — and a small number were retained for a final 1.0.5 patch release. This one is a functionality, compatibility, or cleanup change rather than a vulnerability fix, so it is being closed unmerged. This is not a judgment on the quality of the work — it's a consequence of the branch it targets being frozen.

If the underlying problem still exists in v2, we'd genuinely like to know. Please open an issue describing it against v2. Note that we accept external contributions as issues rather than pull requests — maintainers handle design and implementation through a prompt-driven workflow. See CONTRIBUTORS.md.

Thanks again for taking the time to contribute to the Inspector.

@cliffhall cliffhall closed this Jul 31, 2026
@cliffhall cliffhall added the closed-v1-deprecated Closed: v1 is deprecated and accepting security fixes only label Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

closed-v1-deprecated Closed: v1 is deprecated and accepting security fixes only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't cancel the polling task

2 participants