"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.
The desktop minted billing tokens with an empty body, so auth picked the team from the cloud
profile's active team, which every device of the same user shares: one device switching teams made
the other read (and act on) that team's plan, hours and usage. mintBillingToken now sends {orgId}
for this device's team (auth #761), refuses a token whose org claim is any other team (fail
closed: billing_org_mismatch), and falls back to {} on an older auth (400) with the claim still
checked. Mirrors the sandbox mint (#634).
Billing test: two teams of one owner on one Stripe customer each read only their own plan/hours.
Only the first build and the failed-build retry used autoConfig(); a golden refresh reused the active
build's stored (pre-#660) config, and a manual Rebuild built a default config, so neither got
ORCA_AUTO_INSTALL (and a Rebuild lost the blobless clone). startBuild now derives both from the
environment's kind: every build of an automatic environment, whatever started it, clones blobless and
installs from the lockfile. Tests for create, retry, golden refresh and manual Rebuild.
Stripe's portal on API 2025-09-30.clover cancels by setting cancel_at, not cancel_at_period_end,
so billing never saw the cancellation: no 'Plan ends', no grant end. The mirror now stores
cancel_at (migration 0009); cancel_at_period_end is the 'cancelling' flag for either form; grants
end at cancel_at; entitlements carry cancelAt; the desktop's 'Plan ends' uses it.
Test: two teams of one owner (separate customers), one cancels via cancel_at: its own plan shows
ending on that date, the other is untouched; un-cancelling clears it.
* fix(cloud): validate ORCA_PLATFORM_HOST_SUFFIXES up front; smoke boots use the configured hosts
A malformed suffix now refuses every request (503 platform_hosts_misconfigured,
naming the bad entries) and skips scheduled work, instead of failing each
limited-mode create later. Golden-image and environment-build smoke boots
use the workspace base allowlist, so they follow the configured platform
hosts rather than the built-in *.onorca.dev.
* fix(cloud): narrow the platform-host guard to what compiles an allowlist
A malformed ORCA_PLATFORM_HOST_SUFFIXES no longer takes the Worker down.
GET /v1/health (no auth, for the post-deploy smoke) returns 503
platform_hosts_misconfigured; limited-mode creates, wakes and resumes,
new environment builds and the golden rotation refuse or skip. Reads,
sleep, stop, delete and the reconcile cron keep working; open-mode
creates compile no allowlist and are unaffected.
* fix(cloud): platform_hosts_misconfigured responses carry the code only
/v1/health is public, so the bad entries stay in the config_error log
line; the authenticated refusals return the same bare code.