Skip to content

sandboxes: nothing says a WebSocket reaches an egress filter as a GET, and a POST-only filter breaks Codex on a ChatGPT plan token #5

Backlog

Description

@eastlondoner

A sandbox egress filter that allows POST https://api.openai.com/v1/responses and nothing else breaks Codex when it pays with a ChatGPT plan token. Nothing in the contract or the template says that a WebSocket reaches the filter as a GET.

What happened (2026-11-26). A Dash agent ran Codex in a sandbox with its own filter, written from the itx.sandboxes contract. The filter passed POST /v1/responses with the plan token's placeholder and refused the rest. Codex printed:

warning: Falling back from WebSockets to HTTPS transport. unexpected status 403 Forbidden: Unknown error, url: wss://api.openai.com/v1/responses
ERROR: { "error": { "code": "subscription_sharing_unsupported_capability", "message": "User subscription sharing currently supports only text, image, and file messages, …", "param": "input", "type": "invalid_request_error" } }

The agent read that as OpenAI refusing the plan, and reported Codex as blocked for four days.

Cause. Codex opens the Responses WebSocket with GET https://api.openai.com/v1/responses carrying upgrade: websocket. The filter's method check refused it. Codex then fell back to HTTPS, and OpenAI refuses a plan token's request there. With an API key the fallback works, so the same filter goes unnoticed with /secrets/openai.

Reproduction. Codex 0.171.0, -m gpt-6.2-sol, CODEX_API_KEY='getSecret("/secrets/chatgpt", { field: "accessToken" })', in a sandbox started from the coding snapshot:

Sandbox egress Result
no filter works
POST /v1/responses only, other headers dropped fails as above
POST /v1/responses only, the request passed on unchanged fails as above
POST, or GET with upgrade: websocket, on /v1/responses works

Suggested change.

  • In the itx.sandboxes description (core/mind-worker/src/sandbox/contract.ts), after "which carries WebSockets too", say that a WebSocket reaches the module as a GET with upgrade: websocket, so a filter that checks the method must let it through.
  • In core/configs/default/sandboxes.md, give one worked filter module for a coding CLI. This is the one we now keep in our mind's sandboxes.md:
import { WorkerEntrypoint } from "cloudflare:workers";
const AUTH = 'Bearer getSecret("/secrets/chatgpt", { field: "accessToken" })';
export default class extends WorkerEntrypoint {
  async fetch(request) {
    const url = new URL(request.url);
    const socket =
      request.method === "GET" && (request.headers.get("upgrade") || "").toLowerCase() === "websocket";
    if (
      url.origin === "https://api.openai.com" &&
      url.pathname === "/v1/responses" &&
      !url.search &&
      (request.method === "POST" || socket) &&
      request.headers.get("authorization") === AUTH
    )
      return this.env.ITX.fetch(request); // the request itself: it carries the WebSocket
    return new Response("refused by this sandbox's egress filter", { status: 403 });
  }
}

Checked against main at b54968a.


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions