Skip to content

feat(web): hide 'Run as task' on modern-era connections - #2687

Merged
cliffhall merged 1 commit into
v2/mainfrom
v2/fix/2674-hide-run-as-task-modern
Oct 12, 2026
Merged

cliffhall merged 1 commit into
v2/mainfrom
v2/fix/2674-hide-run-as-task-modern

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Closes #2674

What changed

Under SEP-2663, task creation on a modern (2026-07-28) connection is server-directed: the server decides per request whether to return a task handle, so the client has no per-call choice to offer. The Run as task switch is now legacy-only.

  • New pure helper offersRunAsTask(protocolEra, capabilities) (clients/web/src/utils/toolUtils.ts): true only for a non-modern connection whose server advertises tasks.requests.tools.call. App.tsx feeds it into serverSupportsTaskToolCalls. Living in utils/ keeps it inside the coverage gate, unlike App.tsx.
  • ToolDetailPanel: the modern branches are gone. showRunAsTask / effectiveRunAsTask are back to the legacy rule: optional → user choice, required → forced on and disabled, forbidden → hidden.
  • modernTasks prop removed from ToolDetailPanel, ToolsScreen and InspectorView. Nothing else used it.
  • Tests: the two ToolDetailPanel tests for the modern switch are removed. offersRunAsTask gets its own cases, including a legacy capability on a modern connection, which still offers no choice.

Routing: no change needed (the issue asked to check first)

On a modern connection, InspectorClient.callTool already dispatches through the ext-tasks pipeline (attemptToolCall → callTaskToolAndSettle(…, "allow")). That path declares the extension on the request and follows a returned handle to completion. It emits the same toolCallTaskUpdated / requestorTaskUpdated events and progress as callToolStream. In @modelcontextprotocol/ext-tasks 0.2.2 on the v2 generation, "allow" and "prefer" are identical on the wire, and retentionMs (the TTL) only reaches the v1 wire. So without the switch, a modern call loses nothing, and it keeps callTool's cancel support. The existing integration test auto-polls an unsolicited task handle on the ordinary callTool path (inspectorClient-tasks-era.test.ts) already pins this, including the requestorTaskUpdated event. The routing comment in useServerCommands now says so.

Other clients

  • TUI: no per-call task option; it always calls callTool, which already follows a modern task.
  • One-shot CLI: no --task flag.
  • mcpdo: has --task. Its command tree is static, so the flag can't be hidden per era. On modern it changes nothing on the wire, so its help text now says it applies to legacy servers.

Screenshots

tasks-modern (modern era, tasks extension), tool modern_task. Before: the switch is offered. After: gone.

Before After
tools-modern-before tools-modern-after

After, executing modern_task with no switch: the server returns a task, and it appears on the Tasks panel with live working status, a Cancel control and the status toast. (Shot at 1680px with a 640px Monitor sidebar so the task card isn't clipped.)

tools-modern-after-executed

tasks-legacy (legacy era, tasks.requests.tools.call), tool simple_task (taskSupport: required). Unchanged: forced on and disabled.

Before After
tools-legacy-before tools-legacy-after

npm run local:gate passes.

🤖 Generated with Claude Code

Under SEP-2663 task creation is server-directed: the server decides per
request whether to return a task handle, so the client has no per-call
choice to offer. The switch is now legacy-only, gated by a new pure
offersRunAsTask(protocolEra, capabilities) helper, and the modernTasks
prop is gone from ToolDetailPanel / ToolsScreen / InspectorView.

No routing change is needed: on a modern connection InspectorClient.callTool
already dispatches through the ext-tasks pipeline (preference "allow"),
which declares the extension and follows a returned handle to completion
with the same Tasks-screen events and progress as callToolStream; on v2
"allow" and "prefer" are identical on the wire and retentionMs is v1-only.

mcpdo's --task flag cannot be hidden per era (its command tree is static),
so its help text now says it applies to legacy servers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: cliffhall <[email protected]>
@cliffhall cliffhall added the v2 Issues and PRs for v2 label Oct 12, 2026
@cliffhall
cliffhall requested a balanced review from Copilot October 12, 2026 06:22

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.

🟢 Approval recommended

The implementation matches the issue requirements and retains focused coverage for the new visibility rule.

0 open findings

What changed in this PR

Hides the legacy-only Run as task control on modern connections while preserving automatic handling of server-directed tasks.

Changes:

  • Adds and tests era-aware task-control visibility.
  • Removes the obsolete modernTasks prop and modern UI branches.
  • Clarifies modern task routing and mcpdo --task help.
File Description
clients/​web/​src/​utils/​toolUtils.ts Adds the visibility helper.
clients/​web/​src/​utils/​toolUtils.test.ts Tests legacy and modern behavior.
clients/​web/​src/​hooks/​useServerCommands.tsx Documents existing modern routing.
clients/​web/​src/​components/​views/​InspectorView/​types.ts Clarifies the task-support prop.
clients/​web/​src/​components/​views/​InspectorView/​InspectorView.tsx Removes modernTasks forwarding.
clients/​web/​src/​components/​screens/​ToolsScreen/​ToolsScreen.tsx Removes the obsolete prop.
clients/​web/​src/​components/​groups/​ToolDetailPanel/​ToolDetailPanel.tsx Restores legacy-only toggle rules.
clients/​web/​src/​components/​groups/​ToolDetailPanel/​ToolDetailPanel.test.tsx Removes obsolete modern-toggle tests.
clients/​web/​src/​App.tsx Applies era-aware visibility.
clients/​mcpdo/​src/​connection/​mcp.ts Clarifies --task semantics.

🧠 Review effort: Balanced


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

@cliffhall

Copy link
Copy Markdown
Member Author

Copilot review loop closed: round 1 was clean (0 inline comments, approval recommended, no suppressed findings).

@cliffhall
cliffhall merged commit 4440ea1 into v2/main Oct 12, 2026
8 checks passed
@cliffhall
cliffhall deleted the v2/fix/2674-hide-run-as-task-modern branch October 12, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Issues and PRs for v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hide the 'Run as task' switch for modern-era servers (task creation is server-directed)

2 participants