refactor(dev)!: delete the runtime provider MCP contract - #855
Conversation
Nothing in the host consumes a provider's MCP registry, clientSurface(), or run results' app binding since the runtime App path was removed (#852). Delete them from agent-bundle: the RuntimeMcpRegistry implementation and createRuntimeMcpRegistry, DevRuntimeSession.mcpRegistry and clientSurface(), DevRuntimeInspectionEnvelope.app, the runtime.mcp.* events and their fields, and every DevRuntimeMcp*/RuntimeMcp* type. The Workbench runtime client now rejects an app field in run inspections. Rework examples/rsc-agent-runtime so its dev provider no longer hosts an in-process MCP registry or App client surface: activation commits only the generation store, generation metadata drops the registry descriptors and digests, and MCP tool runs no longer return an App binding. Hooks and MCP tools still share the durable kernel, which a new lifecycles e2e step checks end to end.
Return the runtime to active once a reconcile succeeds after a failed one, abort a prepared activation when the test seam throws, cover a provider-path latch on an active session, and describe what the dev session still serves.
🦋 Changeset detectedLatest commit: 0474847 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4fc4ebaf18
ℹ️ 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".
| "agent-bundle": minor | ||
| --- | ||
|
|
||
| Remove the runtime provider MCP contract from `agent-bundle/api`. `DevRuntimeSession` no longer has `mcpRegistry` or `clientSurface()`, `createRuntimeMcpRegistry` and the `DevRuntimeMcp*`, `RuntimeMcp*`, `DevRuntimeProviderMcpRegistry`, and `DevRuntimeClientSurfaceEndpoint` types are gone, run inspections (`DevRuntimeInspectionEnvelope`) no longer carry `app`, and `DevRuntimeEventInput` and the root `RuntimeEvent` type drop the `runtime.mcp.*` events with their `mcpRegistryRevision`, `mcpSessionId`, and `mcpSessionRevision` fields. The Workbench rejects a run inspection that still includes `app` (`AB8206`). `createRuntimeGenerationStore` and the generation store contracts are unchanged. |
There was a problem hiding this comment.
Append the PR reference to the changeset summary
This new publishable-package changeset does not end with the required (#PR) reference, so its generated release note loses the repository's mandated traceability. Append the actual PR number to the summary.
AGENTS.md reference: AGENTS.md:L124-L125
Useful? React with 👍 / 👎.
Follow-up to #852. Since the host-side runtime App path was deleted, nothing in the dev server or Workbench consumes a runtime provider's MCP registry,
clientSurface(), or run results'appbinding. This PR deletes that provider contract and reworksexamples/rsc-agent-runtime, its only implementer. It is breaking, so the changeset isagent-bundleminor.Deleted from
agent-bundledev/runtime-mcp-registry.ts, the wholeRuntimeMcpRegistry, and its test.createRuntimeMcpRegistry,DevRuntimeProviderMcpRegistry, and theRuntimeMcp*store contracts.createRuntimeGenerationStoreand the generation store contracts stay.DevRuntimeSession.mcpRegistry,DevRuntimeSession.clientSurface(), andDevRuntimeClientSurfaceEndpoint.DevRuntimeInspectionEnvelope.app(mcpBinding,resourceUri,surfaceId) and everyDevRuntimeMcp*protocol type.DevRuntimeEventInputand the rootRuntimeEvent: theruntime.mcp.*event types and themcpRegistryRevision,mcpSessionId, andmcpSessionRevisionfields.DevRuntimeControllerregistry facade andclientSurfaceforwarding.agent-bundle/apiexports (34 names) and internaldev/index.tsre-exports.app. A run inspection that still carries it is rejected as an unknown key (AB8206).RUNTIME_MCP_REGISTRY_*strings, not AB codes.How the example changed
I designed this with the architect skill: grounding, then two structurally distinct sketches on Claude Opus 5.5 (in-place subtraction, and re-deriving the provider from its live consumers), then a synthesis. The in-place design won; the reasons are below.
src/dev/rsbuild-runtime-session.ts, about 625 lines removed):#executeMcpserver, no App client surface or reload subscription.generation-storephase, so the wedged-activation timeout test still exercises a real budget.reconcilePreparedRuntimere-derives surfaces directly, with no registry-digest short-circuit, and recovers from a failed reconcile once a later one succeeds.app, and workers still cannot smuggle one in.definitionDigest,transportDigest,serverDigest, andenvironmentHashesfields are gone. The store's manifest digest and per-asset sha256 still pin the bytes.onAppReloadonly fed the client surface.dist/runtime,dist/app,dist/plugins).Why this design (and what is deferred)
readAssetand/api/runtime/assets, whose only browser caller was the deleted Playground; the example'ssurfaceAssets, App dev capture, and preparedapps;status.hmrReady; themcp-appsurface kind; the transport and credential fields ofDevRuntimePreparedMcpServer; and unused diagnostic phases. None of these are the MCP contract, so they stay here.Browser acceptance (1440×900)
I ran
agent-bundle devon the example and drove the Workbench.tool/afterevent leaf ran "via runtime" with a native Claude PostToolUse payload. It rendered a populated document ("Recorded acceptance.txt from claude. Shared state now contains 1 edit.") with no page errors, captured after all loading and running states cleared.src/rsc/worker.tsxproduced AB8206 (source/build, with the file and line), and generation 1 kept serving. Problems showed "Build failed", with the last good build kept and the source error listed.lifecycles.e2estep: it runs a Claude hook, thenmcp.render_edit_timeline, and asserts that the MCP result carries the hook's edit (the shared kernel) and has noapp. It calls/api/runtime/runsdirectly because the example's MCP server is a prebuilt entry, so the Application tree has no tool leaf for it; thetimelinegroup lists 0 leaves.Local gate
All runs are on the branch merged with current
origin/main.pnpm build,pnpm typecheck, andpnpm lint✅pnpm test:unit✅ (306 files; 4,296 passed)pnpm test:integration:run✅ (104 files; 1,165 passed, 4 skipped)pnpm test:packed✅ (16 files; 46 passed, 1 skipped)pnpm examples:check✅ (every example's check; rsc-agent-runtime 164 + 3 tests)pnpm docs:site:build✅ (0 broken links; en and zh parity)pnpm check:runtime-topology✅examples:check, andlifecycles.e2eplusdiscovery.e2e✅Review
change-risk-reviewer(Claude Opus 5.5) found no blockers.RuntimeEventremovals.degradedforever. It now recovers on the next successful reconcile, without clearing unrelated compile diagnostics, and a test covers it.createRuntimeMcpRegistryis not exported" assertion. The type check already enforces the removal.