Files
orca/cloud/apps
Neil 1376ac6e92 feat(cloud): CODEX-FIREWALL-SWAP Codex's hot calls swap at the sandbox firewall
chatgpt.com answers the sandbox's own egress (probed on a throwaway sandbox: a bogus token gets
ChatGPT's JSON 401, and the firewall's header transform, path and method matchers all work), so the
Codex account token no longer needs the Worker + Cloud Run relay hop for Codex's hot calls.

- Policy compiler: claims scoped by path (exact/prefix, query ignored) and method; transforms can
  set extra headers; path-only forwards (no placeholder header).
- With CODEX_EGRESS_SWAP=firewall (dev on), the owner's Codex token is swapped at the firewall for
  POST /backend-api/codex/responses(/compact), GET /backend-api/codex/models and GET
  /backend-api/wham/usage, with chatgpt-account-id. Exact paths only: a prefix rule was walked out of
  live with an encoded dot segment that the upstream normalises. Every other placeholder call still
  goes through the egress proxy, whose pinning rejects that; then the 403.
- Same eligibility as the proxy (owner's own account, not shared, provider on, token usable); none:
  proxy route only, which answers the signed-out cases. Every policy write path carries the swap
  (boot, create, git refresh, env refresh, egress hosts via rewriteLivePolicy); a wake rewrites it.
- Central refresh (already single-flight per person, compare-and-swap) now pushes a refreshed token
  to the person's running sandboxes' policies, including refreshes the egress 401 path starts.
- Codex refreshing its placeholder login (POST auth.openai.com/oauth/token) is forwarded by path to
  the proxy, which answers with the placeholder again (never a real token) and refreshes centrally.
- VM: the placeholder auth.json's last_refresh is 2099-01-01 (Codex never refreshes it itself);
  the orca_chatgpt provider (supports_websockets = false) is also written to /etc/codex/config.toml
  (best effort, passwordless sudo); [features] plugins = false while the Orca account applies,
  unless the person's own config has a [features] table (CODEX-PS-CALLS: ~170 catalog calls per
  session start).
- Off by default: CODEX_EGRESS_SWAP unset keeps every call on the proxy (and the relay).
2026-11-15 02:34:31 -08:00
..