Skip to content

docs(runtime): record the dated deferral of task-augmented MCP tool calls (#369) - #394

Merged
ScriptedAlchemy merged 1 commit into
mainfrom
feat/369-mcp-tasks
Sep 3, 2026
Merged

docs(runtime): record the dated deferral of task-augmented MCP tool calls (#369)#394
ScriptedAlchemy merged 1 commit into
mainfrom
feat/369-mcp-tasks

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

Issue #369 asked for task-augmented MCP tool calls (CreateTaskResulttasks/get / tasks/result, tasks/cancel into the renderer AbortSignal) — the #96 acceptance remainder. The assessment lands on the honest-deferral branch: the installed SDK has no task runtime to build on, so this PR records the deferral precisely and makes it impossible to go stale silently, instead of hand-rolling the protocol outside the SDK's typed surface.

  • Spec + SDK audit: conformance revision 2025-11-25; generated servers use @modelcontextprotocol/server@2.0.0 / client@2.0.0 / core@2.0.0. The SDK declares task methods "2025-11-25 wire vocabulary with no SDK runtime" — request(), setRequestHandler(), ctx.mcpReq.send() exclude tasks/*; runtime exports are only RELATED_TASK_META_KEY and a @deprecated isTaskAugmentedRequestParams; no TaskStore / experimental.tasks. The 2026-07-28 revision moved tasks into the io.modelcontextprotocol/tasks extension (SEP-2663) and removed tasks/result. Upstream tracker: typescript-sdk#2189 (+ #2598, #2637).
  • Fail-closed behaviour, proven: generated servers never advertise tasks (even to a client that negotiated it); a task-augmented tools/call is processed as an ordinary request with no task handle (the 2025-11-25 fallback MUST); tasks/get|result|list|cancel answer -32601. feat(runtime): MCP progress projector and warm-runtime proofs (#96) #175's progress/final contract is untouched.
  • Sentinels: packages/rsc-runtime/tests/mcp-tasks-deferral.test.ts pins the audited SDK version and asserts each fact against the installed packages; mcp-in-memory.test.ts carries the two behavioural proofs on the generated server plus a @ts-expect-error on the typed setRequestHandler('tasks/get', …) overload (verified load-bearing: removing it fails tsc).
  • Docs: new dated section in docs/mcp-conformance.md with the SDK pin, spec facts, upstream links, and the exact unblock condition; docs/entry-conventions.md stdio lifecycle shell; runtime README; changeset for @agent-bundle/runtime.

No production code changes. Closes nothing — #369 stays open with the unblock condition.

Evidence

  • pnpm typecheck ✅ (and negative check: dropping the @ts-expect-error yields TS2345: '"tasks/get"' is not assignable to parameter of type 'RequestMethod')
  • pnpm lint ✅ 0 errors / 0 warnings
  • rstest packages/rsc-runtime/tests/mcp-tasks-deferral.test.ts ✅ 6/6
  • pnpm test:projection ✅ 65/65 (post-rebase)
  • pnpm test:unit 2673 passed; 4 files failed on 5 s timeouts / 150 ms elapsed budgets under load ~120 (event-ipc, mcp-probe-service, dispatcher, native-claude-contract); first three pass in isolation, native-claude-contract still hits its 5 s cap in isolation on this loaded box — untouched by this PR, left to CI.
  • pnpm test:route-unit 34 passed, 1 timeout (lifecycle-replay) → passes in isolation
  • pnpm build && pnpm test:integration:run ✅ 938/938
  • pnpm test:mcp-conformance ✅ (official runner, 2025-11-25, no unexpected failures)

Test plan

  • Sentinel test green against the installed SDK
  • Projection pool green
  • Conformance lane green
  • CI green on this PR

@changeset-bot

changeset-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a98a7a8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@agent-bundle/runtime Patch

Not sure what this means? Click here to learn what changesets are.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-03T06:59:15.299800Z a98a7a8 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Sep 3, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle@394
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/create-agent-bundle@394
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@394

commit: a98a7a8

…alls (#369)

The installed MCP SDK (@modelcontextprotocol/server 2.0.0) ships only the
2025-11-25 Tasks wire vocabulary with no task runtime, and the 2026-07-28
revision moves tasks into the io.modelcontextprotocol/tasks extension
(SEP-2663) with tasks/result removed. Rather than hand-roll the protocol
outside the SDK's typed surface, record the deferral with its SDK pin,
spec facts, and upstream tracker, and enforce it:

- rsc-runtime sentinel test pins the audited SDK version, asserts the SDK
  exposes only task wire vocabulary, that the typed client cannot issue
  tasks/*, that createRscMcpServer never advertises `tasks` even to a
  tasks-negotiating client, that a task-augmented tools/call is processed
  as an ordinary request, and that tasks/* answer -32601.
- mcp-in-memory projection tests prove the generated server stays
  fail-closed the same way, plus a @ts-expect-error sentinel on the typed
  setRequestHandler('tasks/get') overload so `pnpm typecheck` fails the
  day the SDK admits task methods.
- docs/mcp-conformance.md, docs/entry-conventions.md, and the runtime
  README record the deferral and the exact unblock condition.
@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: a98a7a8d5a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ScriptedAlchemy
ScriptedAlchemy merged commit 055edf1 into main Sep 3, 2026
9 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the feat/369-mcp-tasks branch September 3, 2026 07:00
ScriptedAlchemy added a commit that referenced this pull request Sep 4, 2026
…get, tasks/result, tasks/cancel, tasks/list (#369)

Tool routes opt in with config.execution.taskSupport ('optional' | 'required',
validated as AB4836 and advertised in tools/list). The generated server answers
a task-augmented call with a CreateTaskResult at once and keeps the Flight
render behind the task: tasks/get reports status and the last render progress,
tasks/result blocks for the same CallToolResult the ordinary call returns,
tasks/cancel interrupts the render through its AbortSignal, tasks/list lists the
session's tasks. Clients that never ask for a task see no change; a server whose
tools never opted in advertises no tasks capability.

Replaces the dated #394 deferral sentinels with the lifecycle proofs at the
unit, mcp-in-memory, and packed-stdio levels.
ScriptedAlchemy added a commit that referenced this pull request Sep 4, 2026
ScriptedAlchemy added a commit that referenced this pull request Sep 4, 2026
…get, tasks/result, tasks/cancel, tasks/list (#369) (#550)

* feat(mcp): serve task-augmented tools/call — CreateTaskResult, tasks/get, tasks/result, tasks/cancel, tasks/list (#369)

Tool routes opt in with config.execution.taskSupport ('optional' | 'required',
validated as AB4836 and advertised in tools/list). The generated server answers
a task-augmented call with a CreateTaskResult at once and keeps the Flight
render behind the task: tasks/get reports status and the last render progress,
tasks/result blocks for the same CallToolResult the ordinary call returns,
tasks/cancel interrupts the render through its AbortSignal, tasks/list lists the
session's tasks. Clients that never ask for a task see no change; a server whose
tools never opted in advertises no tasks capability.

Replaces the dated #394 deferral sentinels with the lifecycle proofs at the
unit, mcp-in-memory, and packed-stdio levels.

* feat(workbench): drive task-augmented tool calls from the MCP page — run as task, poll tasks/get, fetch tasks/result, cancel, list (#369)

The browser session controller, the dev session routes, and the dev McpSession
gain the typed task operations (callToolTask, getTask, getTaskResult,
cancelTask, listTasks) over the same epoch-bound operation vocabulary; the MCP
page offers a Run-as-task toggle for tools that advertise
execution.taskSupport, folds every task answer from the invocation history into
a Tasks panel, and polls working tasks at the server's suggested interval.

The host-test example gains a task-capable slow probe (execution.taskSupport
optional) so a host's handling of long-running tools can be observed; the new
desktop browser acceptance drives it through the real generated stdio server.

* docs(mcp): document long-running tools as tasks, record per-host task-call evidence, lift the #394 deferral (#369)

* build(agent-bundle): emit mcp-tasks as its own rslib entry so the bundled mcp-server-runtime chunk stays free of the rslib runtime import

A generated artifact bundles dist/mcp-server-runtime.js; when rslib
concatenated the task module into that chunk it added an
`import { __webpack_require__ } from './rslib-runtime.js'` whose identifiers
shadow the artifact bundler's own runtime, and the packed stdio entry failed
at load (`__webpack_modules__[moduleId] is not a function`). Proven by the
packed-stdio proof, which now also drives the task journey.

* chore: reference #550 in the changeset

* test(workbench): drop the failure-screenshot debugging hook from the task e2e

* fix(mcp): keep required tools callable on a session without the core Tasks utility; clear a task's stale error on a later successful answer

Codex review of 3928a61: the required-tool rejection now applies only on a
task-capable session (2025-11-25 with the capability declared) — elsewhere
every call, required tools included, is the ordinary request and task metadata
is ignored; the Workbench task fold drops a prior error when a later tasks/get,
tasks/list, or tasks/result succeeds, so polling resumes.

* docs(agent-bundle): record the task-augmented lifecycle proof in the README testing story (#369)
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