Skip to content

[WIP] Migrate to Tasks extension SDK - #2308

Draft
LucaButBoring wants to merge 16 commits into
modelcontextprotocol:mainfrom
LucaButBoring:feat/ext-tasks
Draft

LucaButBoring wants to merge 16 commits into
modelcontextprotocol:mainfrom
LucaButBoring:feat/ext-tasks

Conversation

@LucaButBoring

@LucaButBoring LucaButBoring commented Sep 9, 2026

Copy link
Copy Markdown

Following discussion on Discord, this uses the extracted Tasks implementation (see modelcontextprotocol/ext-tasks#21) to replace the implementation here.

Publishing as a draft for reference and comments; this is unusable until the actual extension SDK is merged and published to NPM (after which point I'll swap the new dependency to not be a local path). I'm keeping this PR in sync with the Tasks extension one, and once the Tasks extension one is merged, this PR can either be merged directly or used as the basis for a separate implementation.

Copilot AI balanced review requested due to automatic review settings September 9, 2026 20:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Connection lifecycle, degraded-mode tool calls, legacy timeouts, and bounded task-input handling have unresolved regressions.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Migrates Inspector task handling to the extracted ext-tasks SDK while retaining generation-neutral task APIs.

Changes:

  • Adds and externalizes the new Tasks SDK dependency.
  • Replaces custom requester/receiver task orchestration with SDK sessions.
  • Updates task types and refactors related test coverage.
File summaries
File Description
package.json Adds the local Tasks SDK dependency.
package-lock.json Locks the local package.
core/mcp/types.ts Defines neutral Inspector task types.
core/mcp/modernTaskSchemas.ts Re-exports SDK schemas and identifiers.
core/mcp/messageTrackingTransport.ts Simplifies raw-response consumption.
core/mcp/inspectorClientProtocol.ts Updates task API types and capabilities.
core/mcp/inspectorClientEventTarget.ts Migrates task event payload types.
core/mcp/inspectorClient.ts Integrates requester and receiver task sessions.
clients/web/tsup.runner.config.ts Externalizes the Tasks SDK.
clients/web/src/test/integration/mcp/inspectorClient.test.ts Removes superseded task tests.
clients/web/src/test/integration/mcp/inspectorClient-tasks-era.test.ts Removes the task input-round limit test.
clients/web/src/test/integration/mcp/inspectorClient-modern-era.test.ts Accepts the SDK’s revised error wording.
clients/web/src/test/integration/mcp/inspectorClient-coverage-backfill.test.ts Removes tests for deleted internals.
clients/web/src/test/core/mcp/modernTaskSchemas.test.ts Removes tests for replaced schemas.
clients/web/src/test/core/mcp/inspectorClient-raw-wire.test.ts Adds SDK-boundary and raw-dispatch tests.
clients/web/src/test/core/mcp/inspectorClient-peer-handler-timing.test.ts Updates session lifecycle tests.
clients/tui/tsup.config.ts Externalizes the Tasks SDK.
clients/cli/tsup.config.ts Externalizes the Tasks SDK.
Review details
  • Files reviewed: 16/18 changed files
  • Comments generated: 4
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread core/mcp/inspectorClient.ts
Comment thread core/mcp/inspectorClient.ts
Comment thread core/mcp/inspectorClient.ts Outdated
Comment thread core/mcp/inspectorClient.ts Outdated
Copilot AI review requested due to automatic review settings September 10, 2026 01:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Modern task calls currently regress progress delivery, timeout behavior, and protocol-error preservation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 16/18 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread core/mcp/inspectorClient.ts Outdated
Comment thread core/mcp/inspectorClient.ts Outdated
Comment thread core/mcp/inspectorClient.ts
Copilot AI review requested due to automatic review settings September 10, 2026 18:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The draft depends on an unpublished SDK and still has unresolved timeout and SDK-watch integration issues.

Review details
  • Files reviewed: 17/19 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread package.json
"@modelcontextprotocol/client": "2.0.0",
"@modelcontextprotocol/core": "2.0.0",
"@modelcontextprotocol/ext-apps": "^1.7.4",
"@modelcontextprotocol/ext-tasks": "file:../mcp-ext-tasks/packages/ext-tasks",
Comment thread core/mcp/inspectorClient.ts
Copilot AI review requested due to automatic review settings September 10, 2026 21:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Core protocol lifecycle changes still contain duplicate failure events and a disconnect race, while depending on an unpublished draft SDK.

Review details
  • Files reviewed: 17/19 changed files
  • Comments generated: 1
  • Review effort level: Balanced

},
);
await this.closeTaskSession();
this.taskSession = createTaskSessionFromClient(client, {
Copilot AI review requested due to automatic review settings September 10, 2026 23:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new dependency breaks the SDK watch invariant, and concurrent task calls can misattribute progress events.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

package.json:94

  • Adding this scoped package makes the nightly SDK watch fail immediately: scripts/sdk-watch.mjs:250-259 rejects every root @modelcontextprotocol/* dependency absent from SDK_GROUPS, which currently contains only the TypeScript SDK packages and ext-apps. Add ext-tasks as its own upstream group and update the sdk-watch fixtures/tests so releases of this new dependency are tracked instead of breaking the workflow.
    "@modelcontextprotocol/ext-tasks": "file:../mcp-ext-tasks/packages/ext-tasks",
  • Files reviewed: 18/20 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread core/mcp/inspectorClient.ts
Copilot AI review requested due to automatic review settings September 11, 2026 00:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Auth recovery can duplicate remote tasks, SDK-watch registration is missing, and the dependency remains an unpublished local path.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

package.json:94

  • Adding another @modelcontextprotocol/* dependency without registering it in SDK_GROUPS makes the nightly SDK watch fail in assertEveryPackageWatched (scripts/sdk-watch.mjs:250-258) before it can check any releases. Add an independent ext-tasks group (it has its own repository/release cadence) and update the watcher tests as part of this dependency addition.
    "@modelcontextprotocol/ext-tasks": "file:../mcp-ext-tasks/packages/ext-tasks",
  • Files reviewed: 18/20 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread core/mcp/inspectorClient.ts
@cliffhall

cliffhall commented Sep 11, 2026

Copy link
Copy Markdown
Member

Hi @LucaButBoring, could you create an issue for this PR? We manage the milestones via Issues on the project board, so every PR needs an issue.

@LucaButBoring

Copy link
Copy Markdown
Author

@cliffhall Opened an issue: #2316

Copilot AI review requested due to automatic review settings September 22, 2026 06:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread core/mcp/inspectorClient.ts
Copilot AI review requested due to automatic review settings September 22, 2026 17:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot AI review requested due to automatic review settings September 22, 2026 17:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Timeout cancellation, task capability routing, dependency alignment, and the unpublished local SDK remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 5 High severity

Open (5)
Previously missed (2)

In code that hasn't changed since last review

Medium severity Reuse SDK task types instead of duplicating contracts

core/​mcp/​types.ts:49

The extracted SDK already exposes generation-neutral TaskState and TaskView; introducing a second project-owned status union and near-copy of that view creates another contract that can drift whenever ext-tasks evolves. It also conflicts with the repository rule not to introduce InspectorTaskStatus. Reuse or alias the SDK-neutral types, adding only a narrowly documented normalized overlay if required by existing UI state.

Low severity Update SDK header to document ext-tasks

scripts/​sdk-watch.mjs:104

Adding this third upstream leaves this file’s header inaccurate: lines 21–26 still state “Two upstreams, not one” and describe only TypeScript SDK plus ext-apps. Update that design rationale to include ext-tasks so the source documentation matches SDK_GROUPS.

Comment thread core/mcp/inspectorClientProtocol.ts Outdated
Copilot AI review requested due to automatic review settings September 22, 2026 21:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread scripts/sdk-watch.mjs
Copilot AI review requested due to automatic review settings September 23, 2026 01:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The cross-cutting protocol migration still depends on an unpublished local package and its upstream SDK pull request remains a blocked draft.

Review effort: Balanced
Findings: 4 High severity

Open (4)
Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Test known-handles branch re-polls seeded task

core/​mcp/​state/​managedRequestorTasksState.ts:155

The new known-handles branch is only tested with an empty store, so the test would still pass if this path returned immediately and never called getRequestorTask. Seed one known task before switching the fake to known-handles, then assert refresh re-polls that ID and still avoids listRequestorTasks; this is the behavior this branch is intended to protect.

Copilot AI review requested due to automatic review settings September 23, 2026 02:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

It rewires task execution and lifecycle behavior around an unpublished draft SDK and still uses a non-portable local dependency.

Review effort: Balanced
Findings: 4 High severity

Open (4)
Previously missed (1)

In code that hasn't changed since last review

Low severity Update security rationale to document all three upstreams

AGENTS.md:132

Adding the third upstream leaves the security rationale stale: AGENTS.md:165 and .github/workflows/sdk-watch.yml still say the analysis reads “both upstreams” and enumerate only TypeScript SDK and ext-apps. Update both to include ext-tasks so the documented first-party-input threat model matches what the workflow now analyzes.

Copilot AI review requested due to automatic review settings September 23, 2026 02:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The dependency currently references an unavailable sibling checkout, preventing clean installs and publication.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 5 High severity

Open (5)

Comment thread package.json
"@modelcontextprotocol/client": "2.0.0",
"@modelcontextprotocol/core": "2.0.0",
"@modelcontextprotocol/ext-apps": "^1.7.4",
"@modelcontextprotocol/ext-tasks": "file:../mcp-ext-tasks/packages/ext-tasks",

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Raw progress handling and task recovery currently contain correctness regressions, while the dependency remains unpublished.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 4 High severity · 2 Medium severity

Open (6)
Resolved since last review (1)

Comment on lines +1084 to +1089
if (message.method !== "notifications/progress") return;
const params = message.params as Progress & {
progressToken?: ProgressToken;
};
const progressToken = params.progressToken;
if (progressToken === undefined) return;
Comment on lines +4021 to +4025
? await session.resumeTask<CallToolResult>(recovery.reference, {
resultCodec: taskToolResultCodec,
declaration: toolDeclarationFromMcpTool(tool),
signal,
})

This branch has not been deployed

No deployments
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.

4 participants