Commit Graph
23448 Commits
Author SHA1 Message Date
Neil 554bf8fd98 perf(cloud): the image carries OpenCode's config-dir install; a fresh home gets a copy, so the first launch never fetches 2026-11-15 03:10:34 -08:00
Neil 77d0dfaa52 Merge pull request #778 from nwparker/cloud/nearest-region-mig
cloud: renumber environment region migration to 0062
2026-11-15 02:59:28 -08:00
Neil 55b366e468 cloud: renumber the environment region migration to 0062 (0061 landed concurrently) 2026-11-15 02:56:55 -08:00
Neil b729b1cc5f Merge pull request #777 from nwparker/cloud/nearest-region
cloud: default new workspaces and environments to the nearest served region
2026-11-15 02:56:39 -08:00
Neil 7b83e9d94b Merge pull request #775 from nwparker/cloud/opencode-prewarm-plugins
perf(cloud): OpenCode boot first run waits for the plugin dir
2026-11-15 02:49:53 -08:00
Neil 8a9e198923 cloud: log each desktop create's region order 2026-11-15 02:48:00 -08:00
Neil d1b2394a9a desktop: type the card details status as CloudWorkspaceStatus (it carries region) 2026-11-15 02:47:25 -08:00
Neil 840c8319f1 Merge pull request #770 from nwparker/cloud/create-gh-access-step
feat(cloud): CREATE-GH-STEP GitHub access step in the create wizard
2026-11-15 02:45:45 -08:00
Neil a94ca739f3 cloud: start new workspaces and environments in the served region nearest the caller
A create or new environment with nothing pinned used to start in pdx1 whatever the caller's location,
and every frame of a remote session paid that round trip. Now the sandbox-control Worker ranks the
served regions (the default and its fallbacks with an active golden) by distance from Cloudflare's
request geolocation and starts in the nearest.

- Explicit regions (request, API project) and an environment's build region stay authoritative.
- Environments record their region (migration 0061): builds, golden refreshes, staleness and the
  security floor use it, so snapshots stay bootable and workspaces from them stay together. Legacy
  environments (NULL) live in the default region as before.
- Automatic environments live where the create that made them ran.
- The capacity fallback tries the next nearest served region.
- The warm pool keeps VMs in every served region.
- VERCEL_NEAREST_REGION=off restores default-region-only.
- Desktop: the workspace card's Details shows the region (e.g. Portland (pdx1)).
2026-11-15 02:45:42 -08:00
Neil 917f44bc62 Merge pull request #759 from nwparker/cloud/settings-cloud-signins
feat(settings): Orca Cloud agent sign-ins move to Settings › Orca Cloud
2026-11-15 02:38:06 -08:00
Neil 763932e856 test: the VM create test stubs the GitHub access step 2026-11-15 02:35:25 -08:00
Neil 58aa8c02ad perf(cloud): OpenCode's boot first run waits for Orca's plugin dir, so it also installs the plugin SDK 2026-11-15 01:12:59 -08:00
Neil 0496f10bd9 Merge pull request #774 from nwparker/cloud/entry-points-before-start
fix(sandbox-control): current entry points before start on older environment snapshots
2026-11-15 01:08:49 -08:00
Neil d88c87f17d fix(sandbox-control): a boot from an older environment snapshot starts with this Worker's entry points (probe folded into the runtime refresh command; install only when behind) 2026-11-15 01:06:08 -08:00
Neil 8f38bcf3ce Merge pull request #766 from nwparker/cloud/port-forward-agent-ports
fix(ports, toasts): no toasts for agent ports; hovering a toast never moves it
2026-11-15 01:03:26 -08:00
Neil dec0dd1463 Merge pull request #773 from nwparker/cloud/sc-phase-deadlines
fix(sandbox-control): bound create pre-insert phases, log phase_timeout
2026-11-15 00:51:16 -08:00
Neil 8efca5e240 test: typed deadline table 2026-11-15 00:48:28 -08:00
Neil 4886fa4d6a test: non-null deadline lookups 2026-11-15 00:45:24 -08:00
Neil a9a28e6aae fix(sandbox-control): bound a create's pre-insert phases and name a stuck one (phase_timeout log; environment/entitlement fail at 20 s, a slow pool claim is only logged) 2026-11-15 00:45:08 -08:00
Neil 7aef97258a feat(cloud): after 2 min held with no answer, "Open now, set up later" leads (not remembered as a skip) 2026-11-15 00:40:14 -08:00
Neil 3b9d44ee62 Merge pull request #769 from nwparker/cloud/chatgpt-relay
feat(cloud): CODEX-RELAY chatgpt.com egress through a Cloud Run relay
2026-11-15 00:29:57 -08:00
Neil 5879c3d988 fix: lint (no type assertions in tests, exhaustive switches) 2026-11-15 00:29:35 -08:00
Neil 9184ab4807 fix: import the registry's Entry type 2026-11-15 00:26:13 -08:00
Neil e8313a82af chore(cloud): CODEX-RELAY register the relay's vitest runner 2026-11-15 00:25:51 -08:00
Neil 5a895dcedc feat(cloud): CREATE-GH-STEP GitHub access step in the create wizard
Ask for Orca GitHub App access while the sandbox starts, not in a toast afterwards.

Server (sandbox-control):
- GET /v1/github/repo-access answers `push`: ok | not_installed | repo_not_selected |
  not_connected, with `configureUrl` (the installation's settings page) for repo_not_selected.
  A public repo that can't push now gets an install URL too.
- GitHub installation lookups (repo and new owner lookup) cached in D1 (migration 0061):
  found 60 s, 404 15 s, dropped by installation / installation_repositories webhooks and the
  setup return. The owner lookup never holds the answer (3 s cap, errors read as not_installed).

Desktop:
- "GitHub access" row after Start sandbox, checked when the create starts (parallel, so no
  latency when access is fine). Missing: Install GitHub App / Add repository on GitHub /
  Copy request for an owner, plus Skip for now ("You can pull; pushes need access later").
  Polls (2 s for 3 min, then 10 s; on focus) and auto-advances on grant.
- The create holds before Open workspace only while the step asks and the sheet is on screen.
- Skip remembered per repo on this device; later creates show it skipped (Set up) without
  holding; forgotten once the repo has access.
- A grant that lands after the sandbox started calls applyCloudGitHubAccessToSandbox, a stub
  until gh-access's live refresh lands.
2026-11-15 00:25:15 -08:00
Neil 919b6259bb feat(cloud): CODEX-RELAY chatgpt.com egress through a Cloud Run relay
chatgpt.com answers Cloudflare Workers' egress with a 403 "Unable to load site" page, so Codex via
the Orca account could never get an answer through the egress proxy (#767 made that a printed
error). Cloud Run's egress is answered normally (probed, then deleted).

- cloud/apps/chatgpt-relay: a dependency-free Node relay. chatgpt.com only, the same Codex path
  pinning as the Worker (shared sandbox-control/src/codex-paths.ts), SSE streamed chunk by chunk,
  no WebSocket upgrades, hop and Cloud Run headers dropped, logs without headers, bodies or queries.
- Cloud Run IAM authenticates the Worker: one invoker service account (run.invoker on the relay
  only); the Worker mints a Google ID token for the relay URL and sends it in
  X-Serverless-Authorization, so the swapped ChatGPT Authorization passes through untouched.
- sandbox-control: CHATGPT_RELAY_URL + CHATGPT_RELAY_SERVICE_ACCOUNT route the egress proxy's
  chatgpt.com fetches through the relay; unset, chatgpt.com goes direct as before. A relay
  sign-in failure answers Codex a 503 JSON detail instead of reaching chatgpt.com.
- cloud/infra/chatgpt-relay: Terraform (staging backend applied; production is a runbook step).
2026-11-15 00:21:38 -08:00
Neil 0ec974fd13 Merge pull request #768 from nwparker/cloud/agent-config-deps-prewarm
perf(cloud): OpenCode's first run happens at boot, not on the first launch
2026-11-15 00:21:15 -08:00
Neil 14cf7b12da fix(toasts): hovering a toast never moves it out from under the pointer
Neil: the Orca Cloud GitHub App notice sank when hovered and popped back when the pointer left,
in a loop, and looked cut off while it did. Sonner sizes an expanded toast to the height it measured
when the toast was issued. The cloud toasts update their copy in place, so a card that grew after it
showed kept its first, shorter height: on hover it shrank from the top, sank 20px out from under
the pointer, collapsed and came back.
- cloud-toast-stack re-issues a card under the same id when its content changes, so sonner
  measures it again (no re-add, no animation, same identity).
- The front toast keeps its natural height when the stack expands, as it does when collapsed, so
  no toast can resize under the pointer however its content changed.
Positions are unchanged: the card sits 16px from the right edge and clear of the status bar.
Regression: fixture orca-cloud/CloudToastHover:grownAfterShowing fails before (766→786) and passes
after; a unit test pins the re-issue.
2026-11-15 00:19:22 -08:00
Neil 0bb3d8ec78 fix(ports): agent CLIs' own listeners are never auto-forwarded or toasted
Neil got "Forwarded :34719 to localhost:34719 · codex · sand23 · Open": Codex's own listener on an
ephemeral port, forwarded and announced as if it were his app. Auto-forward now skips:
- a listener whose process is an agent CLI (claude, codex, opencode, gemini, cursor-agent, …; by
  binary name, path, .exe or platform suffix), on any port;
- an anonymous ephemeral port (>= 32768) with no known web protocol and no URL the workspace
  printed: an agent's MCP child, a language server, a debugger.
Dev servers keep auto-forward: usual ports (3000, 5173, 8080, …) and any port whose URL the terminal
printed. An earlier auto forward of an agent port retires once idle, as for any non-candidate.

The toast says what happened in the user's terms: "Your app on port 3000 is available at
localhost:3000", and "3 apps are available on this computer" for several.
2026-11-15 00:19:22 -08:00
Neil 767919684b perf(cloud): OpenCode's first run happens at boot, not on the first launch
OpenCode's first run in a VM installs its plugin SDK into ~/.config/opencode, creates its database and fetches its model list (first launch 5.2 s vs 2.7 s warm; in a pane on a fresh VM ~11 s, with the opencode process starting 0.7 s after the click, so the time is OpenCode's own). orca-sandbox-start now runs `opencode models` (does all of it, no credentials, exits) in the background at nice 19 right after orca-sandbox-env writes the config, only while ~/.config/opencode/node_modules is missing (once per disk; wakes skip it).
2026-11-15 00:17:47 -08:00
Neil 8cb1d5d2ff chore(i18n): drop the moved copy's old keys 2026-11-15 00:17:42 -08:00
Neil 85f5283d98 feat(settings): Orca Cloud agent sign-ins move to Settings › Orca Cloud › Cloud agent sign-ins
Neil: an Orca Cloud part inside Settings › Agent accounts was confusing. The Claude and ChatGPT
sign-ins for cloud workspaces (set up, paste a token, renew, remove) are now their own page in the
Orca Cloud group, right after Account & billing. Agent accounts keeps This computer and Hosts and
one row, "Orca Cloud sign-ins live in Orca Cloud settings", that opens the new page.

Every deep link moves with it: Renew in Settings, the sign-in sheet's footer, the host panel, and
old links to pane 'accounts' at 'orca-cloud' / 'accounts-orca-cloud' (resolveCloudAgentSignInsTarget).
Copy that sent people to "Settings → Agent accounts" for Orca Cloud now says "Settings → Cloud agent
sign-ins" (new i18n keys so stale translations don't point at the old place), including
sandbox-control's expired-Claude and RS-4 Codex messages. Search: the Orca Cloud keywords
(subscription, chatgpt, setup-token, renew) move to the new page. Behavior is unchanged.
2026-11-15 00:17:40 -08:00
Neil e6daa73f79 Merge pull request #767 from nwparker/cloud/chatgpt-egress-blocked
fix(cloud): CODEX-EGRESS-BLOCKED say so when chatgpt.com refuses the egress proxy
2026-11-15 00:13:13 -08:00
Neil dca419d3fd fix(cloud): CODEX-EGRESS-BLOCKED say so when chatgpt.com refuses the egress proxy
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.
2026-11-15 00:09:55 -08:00
Neil 10a4ea3db6 Merge pull request #765 from nwparker/cloud/cloud-env-unique-name
fix(cloud): a second cloud workspace from the same repository opens (unique server name)
2026-11-15 00:00:48 -08:00
Neil 0dd78f9aa5 fix: counter starts at 2 without a W-number 2026-11-14 23:56:43 -08:00
Neil dca6007901 fix(cloud): a second cloud workspace from the same repository opens instead of "Couldn't open the workspace on the sandbox"
Root cause (dev repro, deterministic): this computer saves each cloud workspace as a server named
"<title> (cloud)", server names are unique, and two workspaces from one repository share a title.
The second pairing failed with "A server named "xterm.js (cloud)" already exists." (verified with
a fresh grant on W-715: that name refused, a unique one paired in 550 ms), surfaced as "Couldn't
connect this computer to the workspace" / "Couldn't open the workspace on the sandbox".

A taken name now gets the workspace's W-number ("xterm.js W-715 (cloud)"), then a counter, using
the same collision rule the server store applies.
2026-11-14 23:52:10 -08:00
Neil 0f9fb98f07 Merge pull request #764 from nwparker/cloud/sc-deadlines-retry-observability
fix(sandbox-control): 20 s provider deadline, one retry for stalled reads; dev Worker keeps its logs
2026-11-14 23:46:21 -08:00
Neil ecfce3c737 Merge pull request #760 from nwparker/cloud/fetch-access-notice
fix(cloud): GH-FETCH-REASON the can't-reach-GitHub notice says why and offers the fix
2026-11-14 23:43:25 -08:00
Neil c24f97588e fix(sandbox-control): 20 s provider deadline, one retry for stalled reads; dev Worker keeps its logs
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.
2026-11-14 23:40:25 -08:00
Neil 6f1bbcfc55 Merge pull request #763 from nwparker/cloud/golden-agent-prefetch
perf(golden): prefetch the agent CLIs into the page cache at boot
2026-11-14 23:22:32 -08:00
Neil 6a02019931 chore(golden): regenerate the Worker-embedded VM scripts 2026-11-14 23:20:02 -08:00
Neil 845e495128 perf(golden): prefetch the agent CLIs into the page cache at boot
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.
2026-11-14 23:17:54 -08:00
Neil 6ea618d883 Merge pull request #762 from nwparker/cloud/sc-provider-deadlines
fix(sandbox-control): deadlines on every Vercel API call; slow grants log their phases
2026-11-14 23:16:46 -08:00
Neil 027fc090d5 fix(sandbox-control): deadlines on every Vercel API call; slow grants log their phases
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.
2026-11-14 23:14:24 -08:00
Neil 693bc2497f Merge pull request #761 from nwparker/cloud/agent-start-status
feat(cloud): "Starting Claude…" instead of a blank cursor; no "Asleep" flash on a new workspace
2026-11-14 22:48:53 -08:00
Neil 5386fc3acb feat(cloud): "Starting Claude…" instead of a blank cursor; no "Asleep" flash on a new workspace
Neil (n70): after creating a cloud workspace with Claude, the pane showed a blank terminal with a
cursor before Claude appeared. On a cloud host the agent starts behind a shell whose echo is
erased, so from the pane attaching until the agent's first frame there is only a cursor.

- A launched agent's pane shows "Starting <agent>… Ns" (centred, quiet) until the terminal draws
  any text, after a 600 ms grace so fast starts never flash it; past 20 s it adds "Taking longer
  than usual…". Only on the tab's agent leaf, only for a launch under 3 minutes old (a reattach of
  an older session is not a start), and never over the process-exit overlay, so a failed start
  shows its error.
- A just-created paired cloud workspace no longer flashes "Asleep · Wake to continue" before its
  agent tab opens: without a status read, "sleeping" only meant no pane was open yet.
2026-11-14 22:45:05 -08:00
Neil d9534be69d fix(cloud): GH-FETCH-REASON the can't-reach-GitHub notice says why and offers the fix
"This workspace can't reach <repo> on GitHub right now" with Check again read as transient even
when Orca's GitHub app simply can't see the repository.

- The doctor's git.fetch failure carries a code from git's own words: remoteDenied,
  remoteNotFound, remoteUnreachable (none for wording it doesn't know).
- The line asks the control plane's repo access, like the push line:
  - the app can't see the repo: "Orca's GitHub app doesn't have access to <repo>." with Grant
    access (the app's install page for that repo), or a request to copy for an owner;
  - the app can see it but GitHub refused this workspace (installed after it started): Restart;
  - the network, or no answer yet: the old words with Check again.
- After Grant access, the recheck drops the line once origin answers.
2026-11-14 22:22:42 -08:00
Neil 359288400d Merge pull request #758 from nwparker/cloud/gh-anon-403
fix(cloud): GH-ANON-403 member GitHub identities no longer 403 anonymous git to github.com
2026-11-14 22:15:50 -08:00
Neil 6b05760eb7 fix(cloud): GH-ANON-403 member GitHub identities no longer 403 anonymous git to github.com
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.
2026-11-14 22:12:45 -08:00