Skip to content

refactor(dev)!: delete the runtime provider MCP contract - #855

Merged
ScriptedAlchemy merged 4 commits into
mainfrom
chore/remove-provider-mcp-contract
Sep 25, 2026
Merged

ScriptedAlchemy merged 4 commits into
mainfrom
chore/remove-provider-mcp-contract

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

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' app binding. This PR deletes that provider contract and reworks examples/rsc-agent-runtime, its only implementer. It is breaking, so the changeset is agent-bundle minor.

Deleted from agent-bundle

  • dev/runtime-mcp-registry.ts, the whole RuntimeMcpRegistry, and its test.
  • createRuntimeMcpRegistry, DevRuntimeProviderMcpRegistry, and the RuntimeMcp* store contracts. createRuntimeGenerationStore and the generation store contracts stay.
  • DevRuntimeSession.mcpRegistry, DevRuntimeSession.clientSurface(), and DevRuntimeClientSurfaceEndpoint.
  • DevRuntimeInspectionEnvelope.app (mcpBinding, resourceUri, surfaceId) and every DevRuntimeMcp* protocol type.
  • From DevRuntimeEventInput and the root RuntimeEvent: the runtime.mcp.* event types and the mcpRegistryRevision, mcpSessionId, and mcpSessionRevision fields.
  • The DevRuntimeController registry facade and clientSurface forwarding.
  • The matching agent-bundle/api exports (34 names) and internal dev/index.ts re-exports.
  • Workbench: the runtime client no longer parses app. A run inspection that still carries it is rejected as an unknown key (AB8206).
  • No diagnostic rows change. Registry errors used 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.

  • Dev provider (src/dev/rsbuild-runtime-session.ts, about 625 lines removed):
    • No in-process MCP registry or connector, and no per-run App broker session.
    • No #executeMcp server, no App client surface or reload subscription.
    • Activation commits only the generation store. The test seam now runs inside the bounded generation-store phase, so the wedged-activation timeout test still exercises a real budget.
    • reconcilePreparedRuntime re-derives surfaces directly, with no registry-digest short-circuit, and recovers from a failed reconcile once a later one succeeds.
    • MCP tool runs no longer return app, and workers still cannot smuggle one in.
  • Generation metadata: the registry server descriptors and the definitionDigest, transportDigest, serverDigest, and environmentHashes fields are gone. The store's manifest digest and per-asset sha256 still pin the bytes.
  • Rsbuild config: the App reload plugin and hash plumbing are gone. onAppReload only fed the client surface.
  • README: the dev-session paragraph matches the code.
  • Still demonstrated: hooks and MCP tools share the durable kernel; Workbench route invocation renders Agent Documents; the RSC generation compiles, activates, and hot-swaps; AB8206 compile errors appear and recover; and real hosts get the built artifact MCP server and App (dist/runtime, dist/app, dist/plugins).

Why this design (and what is deferred)

  • Rejected for this PR: splitting the 3,000-line session into four modules. Mixing moves into a deletion hides behavior changes.
  • Deferred to their own PR: removing the whole App dev plane. That means readAsset and /api/runtime/assets, whose only browser caller was the deleted Playground; the example's surfaceAssets, App dev capture, and prepared apps; status.hmrReady; the mcp-app surface kind; the transport and credential fields of DevRuntimePreparedMcpServer; and unused diagnostic phases. None of these are the MCP contract, so they stay here.

Browser acceptance (1440×900)

I ran agent-bundle dev on the example and drove the Workbench.

  • The tool/after event 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.
  • Stale-diagnostic flow: breaking src/rsc/worker.tsx produced 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.
  • Repair flow: restoring the file activated generation 2 with no diagnostics, and Problems returned to 0.
  • New lifecycles.e2e step: it runs a Claude hook, then mcp.render_edit_timeline, and asserts that the MCP result carries the hook's edit (the shared kernel) and has no app. It calls /api/runtime/runs directly because the example's MCP server is a prebuilt entry, so the Application tree has no tool leaf for it; the timeline group lists 0 leaves.

Local gate

All runs are on the branch merged with current origin/main.

  • pnpm build, pnpm typecheck, and pnpm lint ✅
  • pnpm test:unit ✅ (306 files; 4,296 passed)
  • Full integration pool 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 ✅
  • After the review fixes, I re-ran build, typecheck, lint, unit, examples:check, and lifecycles.e2e plus discovery.e2e ✅

Review

change-risk-reviewer (Claude Opus 5.5) found no blockers.

  • Should-fix, fixed: the changeset now names the root RuntimeEvent removals.
  • Should-fix, fixed: a failed prepared reconcile stayed degraded forever. It now recovers on the next successful reconcile, without clearing unrelated compile diagnostics, and a test covers it.
  • Nit, fixed: a throwing test seam leaked a prepared activation.
  • Nit, fixed: added back an active-session provider-path latch test.
  • Nit, fixed: the README understated what the dev session serves.
  • Nit, not changed: a negative "createRuntimeMcpRegistry is not exported" assertion. The type check already enforces the removal.
  • Nit, answered above: the e2e calls the API instead of the UI because there is no tool leaf.

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-bot

changeset-bot Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0474847

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

This PR includes changesets to release 2 packages
Name Type
agent-bundle Minor
create-agent-bundle 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 25, 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-25T05:42:29.244619Z 4fc4eba PR opened
ℹ️ 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.

@ScriptedAlchemy
ScriptedAlchemy merged commit 116ea16 into main Sep 25, 2026
3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@github-actions github-actions Bot mentioned this pull request Sep 25, 2026
@ScriptedAlchemy
ScriptedAlchemy deleted the chore/remove-provider-mcp-contract branch September 25, 2026 20:20
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