History

Harden requestState binding, add inbound rollback switch, fix CLI bridge era handling

Rhys Sullivan committed 3 months ago

Commit ce870831 parent c25ace226 files · +556 −83Browse files

Showing the changes to apps/cloud (3 of 26 files). Show all

Unified · Split

3 files
  1. apps/cloud/src/env-augment.d.ts +2 −0
  2. apps/cloud/src/mcp/agent-handler.ts +4 −0
  3. apps/cloud/wrangler.jsonc +3 −0
apps/cloud/src/env-augment.d.ts+2−0
@@ -69,6 +69,8 @@ declare global { · 68 unmodified lines
69 MCP_PAUSED_SESSION_IDLE_TIMEOUT_MS?: string;69 MCP_PAUSED_SESSION_IDLE_TIMEOUT_MS?: string;
70 /** HMAC key for MCP 2026-07-28 continuation state (32+ byte secret). */70 /** HMAC key for MCP 2026-07-28 continuation state (32+ byte secret). */
71 MCP_REQUEST_STATE_KEY?: string;71 MCP_REQUEST_STATE_KEY?: string;
72 /** Emergency rollback for inbound MCP 2026-07-28 traffic only. */
73 MCP_2026_07_28_ENABLED?: string;
72 NODE_ENV?: string;74 NODE_ENV?: string;
73 75
74 // Shared with frontend76 // Shared with frontend
apps/cloud/src/mcp/agent-handler.ts+4−0
@@ -4,6 +4,7 @@ import { Effect, Predicate } from "effect"; · 3 unmodified lines
4import {4import {
5 McpAuthProvider,5 McpAuthProvider,
6 jsonRpcErrorBody,6 jsonRpcErrorBody,
7 mcpModernDisabledResponse,
7 defaultMcpResource,8 defaultMcpResource,
8 UNAVAILABLE_RETRY_AFTER_SECONDS,9 UNAVAILABLE_RETRY_AFTER_SECONDS,
9 type AuthOutcome,10 type AuthOutcome,
@@ -174,6 +175,9 @@ export const makeCloudMcpAgentHandler = () => { · 164 unmodified lines
174 const parsedBody = await Effect.runPromise(requestBodyFromRequest(request));175 const parsedBody = await Effect.runPromise(requestBodyFromRequest(request));
175 const era = await classifyMcpProtocolEra(request, parsedBody);176 const era = await classifyMcpProtocolEra(request, parsedBody);
176 if (era === "modern") {177 if (era === "modern") {
178 if (env.MCP_2026_07_28_ENABLED === "false") {
179 return mcpModernDisabledResponse();
180 }
177 const resource = resourceFromPath(request);181 const resource = resourceFromPath(request);
178 const props = await runTraced(182 const props = await runTraced(
179 request,183 request,
apps/cloud/wrangler.jsonc+3−0
@@ -101,6 +101,9 @@ · 100 unmodified lines
101 // secret for both with `wrangler secret put MCP_REQUEST_STATE_KEY`.101 // secret for both with `wrangler secret put MCP_REQUEST_STATE_KEY`.
102 // It must never be placed in `vars` or generated independently per isolate.102 // It must never be placed in `vars` or generated independently per isolate.
103 "vars": {103 "vars": {
104 // MCP_2026_07_28_ENABLED is intentionally absent: unset enables modern
105 // inbound serving. Set the Worker var to "false" for emergency rollback;
106 // legacy serving remains available.
104 "VITE_PUBLIC_SITE_URL": "https://executor.sh",107 "VITE_PUBLIC_SITE_URL": "https://executor.sh",
105 "VITE_PUBLIC_POSTHOG_KEY": "phc_nNLrNMALpRsfrEkZovUkfMxYbcJvHnsJHeoSPavprgLL",108 "VITE_PUBLIC_POSTHOG_KEY": "phc_nNLrNMALpRsfrEkZovUkfMxYbcJvHnsJHeoSPavprgLL",
106 // Browser OTLP spans → same-origin, forwarded to Axiom by the worker109 // Browser OTLP spans → same-origin, forwarded to Axiom by the worker

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t