feat(runtime): thread transport-observed identity into generated MCP tool scopes (#223) - #276
Merged
Merged
Conversation
…opes (#223) Generated MCP tool, resource, and prompt request scopes now observe the negotiated client identity as a native host and derive workspace from the server process cwd, alongside the existing native session and authInfo actor, forwarding all four axes into the Flight worker. Typed unavailability is preserved where a transport genuinely lacks an axis (bare stdio supplies no sessionId or authInfo). The in-memory projection level mirrors the worker boundary so mcp-in-memory stays faithful, with the harness context seam still winning. Proof assertions flip from honest absence to the positive contract at the generated-server integration, mcp-in-memory, and packed journey levels; also repairs the packed listTools assertion left stale when #273 added the context fixture route.
🦋 Changeset detectedLatest commit: 2661ae8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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. |
5 tasks
This was referenced Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Delivers the remaining #223 transport slice for the generated MCP server: tool, resource, and prompt request scopes now observe the transport-known identity axes and forward them into the Flight worker, so compiled bundles' handlers read
(await agent()).host/.session/.actor/.workspaceinstead of typed-unavailable axes the transport actually knew. Mirrors the rsc-runtime wiring PR #273 landed:server.server.getClientVersion()?.name, sourcenative), resolved per request after the initialize handshake;sessionIdwhere one exists (unchanged wiring — bare stdio supplies none, so it stays honestlyunavailable('not-provided'));http.authInfo.clientIdwhere present (unchanged — stdio has no authInfo, honestly unavailable);available({ root: process.cwd() }, 'derived')), the established CLI derivation.No Flight-worker changes:
createFlightWorkerHostalready probesagent()and forwards all four axes; the generated worker template already re-installs them. The gap was purely the host-scope installation. The in-memory projection level (agent-bundle/test) now mirrors the worker boundary — its in-process stand-in forwards the host-scope axes into the render scope with the documented harness context seam still winning — somcp-in-memorystays faithful to the artifact.Observed axes per transport after this change
Assertions flipped from honest absence to the positive contract at all three proof levels (generated-server integration
inspect,mcp-in-memorytool:harness/context— now also proving lookalikehost/sessioninput fields cannot alter observed axes — and a new packed-journey context assertion inside the existing first session, no new spawns). Honest-absence assertions stay for the axes stdio genuinely lacks.Also repairs two stale packed
listToolsexpectations: #273 addedtool:harness/contextand #275 addedtool:harness/mutation-probeto the shared route-harness fixture without updating the packed journey's strict list (the packed pool is not a per-PR gate, so main drifted red there).Event scopes' actor mounting and Workbench provenance stay out per the recorded #269/#233 and Workbench deferrals on #223.
Changeset: minor for
agent-bundle.Gates (local, on the rebased branch at f06a91c)
pnpm build+pnpm typecheck— passpnpm lint— 0 errors / 0 warnings (939 files)pnpm test:unit— 2454 passed / 0 failed (one pool-level flake observed and re-run green twice; isolated file runs green with and without this diff)pnpm test:route-unit— 18/18pnpm test:projection— 57/57 (includes feat(cli): project MCP tools into the routed CLI via routes.mcpCommands (#102 stage 4) #275's new cli-dispatch-mcp suite)run-packed-tests.mjs) — every assertion through both packed sessions passes including the new context axes proof; the suite then fails at the pre-existingrequestEventRuntimeIPC step, reproduced byte-identical on unchanged origin/main (A/B with only the stale listTools repair applied), unrelated to this change.Refs #223, #273, #233, #269.