chatgpt.com answers every request from Cloudflare Workers' egress IPs with a 403 "Unable to load
site" HTML page, whatever the token (verified from a throwaway Worker; the same request from
elsewhere gets a normal 401). Codex via the Orca account goes through the Worker egress proxy, so
it got that page on /responses and /wham/usage: "Working…" without an answer, and /status had no
limits.
The proxy now recognises a provider edge's own refusal (403, text/html, server: cloudflare) on
routes that define an answer for it, logs egress_upstream_blocked, and answers Codex in ChatGPT's
error shape so Codex prints a plain message. The block says nothing about the credential: no
status hook, so no refresh and no revoke. This doesn't make Codex work; routing chatgpt.com around
the Worker is a separate decision.
team-lead follow-up to #762: lookups/updates now fail at 20 s; a GET that hits the deadline is asked once more (a stalled write is never repeated: it may have landed); each stall logs provider_stall with the call's shape. orca-sandbox-control-dev turns on Workers observability so provider_stall, grant_failed and lifecycle_timing are retained.
A fresh VM pages the agent CLIs in lazily from its snapshot, so the first agent launch paid for it (OpenCode 11 s cold vs 3.75 s warm in the same VM, n71). orca-sandbox-start now reads the claude, codex and opencode packages (files over 256 KB) in the background at nice 19 / idle IO, detached, after orcad starts; never on the ready path. Best effort.
Two dev failures (n70/n71) were the Worker waiting on a stalled Vercel API connection with no
client-side deadline: a create spent ~2 min before its write-ahead insert ("Start sandbox" stuck),
and POST /v1/team/workspaces/:id/grants (opening a new workspace on this computer) hung its full
120 s (wallTime 119995 ms, no response) although its VM command is bounded at 45 s.
- Every provider request now has a deadline: 30 s for lookups and updates, 60 s to boot a VM,
5 min to snapshot, a command's own timeout + 20 s, and 3 h only for an explicit unbounded wait
on a build's exit. A stall becomes a provider error the callers already handle (grant_failed,
the create fallback), instead of an open-ended wait.
- issueGrant logs its phases (session, grant command, member git) when it takes over 10 s, and
logs grant_failed with its timings and error, so the next slow open names its phase.
A workspace on a public repo the Orca GitHub App isn't installed on gets no App token, so its git
sends no credential. When a member had connected GitHub, their placeholder rules made github.com a
credential host, and compileNetworkPolicy ended it with the firewall's 403: the doctor's
`git ls-remote origin HEAD` failed ("This workspace can't reach <repo> on GitHub right now"), and so
did every plain fetch and pull.
- With no App token, the member github.com route is allowUnclaimed. With a token the workspace git
route keeps github.com fail-closed as before. api.github.com is unchanged.
- A wake rewrites the policy when member identities apply: a resumed session keeps its last
policy, so a workspace created before this fix would otherwise keep the 403.
- cloud/infra/secrets-kms: own Terraform root and state (terraform/secrets-kms) for the Cloud KMS key
that wraps the secret-store KEK, the Worker's decrypt-only service account, KMS/Secret Manager
data-access audit logs and the KEK escrow secret. Applied to onorca-cloud-staging (dev Worker).
- SECRETS_KEK_PLAINTEXT_RETIRED_ID: in kms mode, also open rows under that id with the plaintext
SECRETS_KEK as a retired key, only after KMS handed over the active KEK. Neither dev nor prod has a
copy of its KEK outside Cloudflare, so the KEK can't be wrapped; this lets the rewrap sweep move
rows onto a new KMS-held KEK instead. Never seals, never stands in for KMS (tests).
- wrangler.dev.jsonc: SECRETS_KEK_SOURCE=kms, SECRETS_KMS_KEY, SECRETS_KEK_ID=k2.
Every Orca socket into orcad already gets a WS ping every 10-15 s (orcad's server heartbeat and the
desktop's client liveness). Share links were the gap: the in-VM share proxy piped upgraded sockets raw, so
a preview app's silent WebSocket was closed by Vercel after ~340 s (1006), well before the link's
deadline. The proxy now follows the app's frame boundaries and, after 30 s with no traffic either way,
sends the visitor an empty ping frame between two frames (never inside one). Only 101 upgrades to
websocket get pings; other upgrade protocols stay a raw pipe.
VM script: reaches live VMs through the boot-time entry-point sync (new stamp), and the next golden.
Vercel's command POST has no idempotency key, so a retry after a lost answer (dropped connection, gateway
5xx, a Worker that died mid-request) can start the command again (vercel/sandbox#363). Message delivery
did exactly that: a transient failure re-queued the message and the cron typed it into the agent again,
or launched a second agent.
- command-once.ts: an in-VM guard with a per-id ledger (mkdir claim, recorded exit + output). A repeat of
the same id waits for and replays the first run; a dead first run reports an unknown outcome; a failed
run is forgotten so a retry runs for real. runCommandOnce retries uncertain provider failures with the
same id (never a 4xx that proves the command did not start).
- deliverMessage uses msg-<id> for send/launch; an unknown outcome fails the message
(delivery_outcome_unknown) instead of re-sending.
- POST /messages and POST /sessions take Idempotency-Key (same semantics as workspace create); a session
create taking over a died attempt replays the first launch.
- The REST client keeps sending each command POST exactly once (test).
- snapshot-refs.ts: one check for what live things still boot from (goldens of any live status, pool
images, active environment builds, live workspaces' own snapshots, and a live workspace's boot image
until it has a snapshot of its own).
- Retired goldens beyond the rollback and deleted environments' builds are marked deleted only after the
provider delete succeeded (a failed delete used to be marked and leaked for good), and are deferred
while in use. A new hourly housekeeping step (sweepReleasedSnapshots) retries both.
- Team delete marks the team's environments deleted, so their build snapshots are freed (they leaked).
- Environment prune skips a build a live workspace still boots from.
- Orphan sweeps (per box and project-wide automatic) also respect pool and boot-image references.
- The golden smoke box is non-persistent: it no longer leaves a ~325 MB automatic snapshot behind.
"Plan & billing", "Upgrade to Orca Cloud", "Choose plan" and every "Compare plans" now open an
in-app plans dialog first: the team's plan and status (trial hours left, active with hours and
seats, payment failed, or no plan with the trial billing offers), then billing's plan cards (Team
with a monthly/annual toggle, Enterprise with contact sales). "Continue in browser" opens the
console's billing page through the existing sign-in ticket. Members see the same plan info with
"Ask a team admin to upgrade" (Plan & billing is back in their account menu, read-only). Read-only:
no checkout, usage history or admin settings return to the desktop.
Everything shown is billing's: names, Stripe prices, seat pricing, feature bullets and trial terms
from GET /v1/plans, now also each plan's tagline, feature-list lead and button label (new optional
catalog `marketing`, unversioned copy, plus `omitFeatures` so Enterprise stops advertising egress
controls). Main's lenient parse keeps a newer or older service safe; without the catalog the
entitlement's offers stand in, and with neither the dialog says plans didn't load and still offers
the console. While billing loads the title is neutral, so a paying team never sees an upsell flash.
Settings > Account's billing row opens the dialog ("View plans"); "Update payment method" still
goes straight to the console.
One Checkout sends checkout.session.completed, customer.subscription.created and invoice.paid,
often concurrently; each that re-read the row before another wrote it saw the plan start and
pushed billing.plan_started with its own 'at', so the event ids differed and the team's audit
log showed it twice. A plan starting or ending now carries a once key (subscription id and
period start), so every racer pushes the same event id and the control plane's INSERT OR IGNORE
keeps one.
POST /v1/billing/checkout and /portal accept returnTo: 'console'. The return URL is built from
this Worker's CONSOLE_URL (else the setup pages' auth origin, which forwards /console) and the
caller's own team, never from the request. Desktop-started flows keep the /return handoff page.
GET /v1/internal/accounts/:accountId/subscription adds cancelling / endsAt / periodEnd (additive);
new POST .../subscription/cancel-now (membership-sync token) cancels the team's subscription
immediately (invoice_now: reported overage is billed; prorate false: no refund) but only one
already set to end (cancel_at_period_end or a portal cancel_at); a renewing plan gets 409
not_cancelling. Idempotent; a Stripe failure is a 502 and changes nothing, so auth must not
delete the team. Mirror re-read from Stripe, grants revoked.