Commit Graph
23470 Commits
Author SHA1 Message Date
Neil ddbc12131e ci(cloud): egress probe through the control plane and orca CLI; boot-twice premerge step
The egress probe now needs no Vercel token. It uses dev workspaces with a dev-JWK user, runs its
commands in a workspace terminal through the shipped orca CLI's pairing code, and uses
postman-echo.com as the echo host for bogus keys. It covers the custom-base-URL swap,
chatgpt.com through the relay, api.github.com, #758 anonymous git and the App repo clone.
Premerge runs boot-twice-check.sh for image/** changes. The step has its own omarchy slot and
a 10 min limit, and fails open with a warning without Docker.
2026-11-15 04:09:58 -08:00
Neil 1117d3a9b6 ci(cloud): boot-twice image check and a dev egress release probe
Boot-twice (image/boot-twice/): provisions the golden image in a container with the real
provision-golden.sh, then boots the same disk twice through the control plane's own boot steps
(entry-point probe, startOrcad with the workspace prelude, ensureEntryPoints). Each start is a new
kernel boot id. The second boot runs offline behind a DNS sink, and must install, fetch and redo
nothing (docker diff allowlist, logged lookups, sampled command lines). It must come up, carry
this tree's entry points and stamp, and match every manifest version pin. ~15 s cached, ~5 min
cold. It catches the pre-#781 OpenCode first run that repeated on every wake.
Workflow: cloud-vm-boot-twice.yml (PRs touching image/**, GHA layer cache).

Egress probe (scripts/egress-probe.ts): against dev, with bogus tokens and an echo sandbox.
Firewall layer: egressPolicy()'s real policy forwards placeholders for chatgpt.com,
api.anthropic.com, api.github.com and github.com with other auth headers untouched. Credential
hosts fail closed, and anonymous git works without an App token (#758). Swap layer: the dev egress
proxy swaps a bogus ANTHROPIC_API_KEY in for its placeholder on a custom base URL, and leaks no
Vercel hop headers. Workflow: cloud-egress-probe.yml (dispatch + nightly; skips without secrets).

Fix found by the harness: provision-golden.sh linked a release bundle's runtimes dir, and every
VM script's `find .../runtimes -type f` skips a symlinked start point, so --release goldens had
no node. Move the tree instead. No entry-point change (stamp unchanged).
2026-11-15 04:09:57 -08:00
Neil 49d0f0baf5 Merge pull request #784 from nwparker/cloud/opencode-seed-fallback
fix(cloud): OpenCode first run falls back to the plugin-aware install without the seed
2026-11-15 04:09:38 -08:00
Neil 4b7ab8bcb9 merge cloud/integration; regenerate VM scripts 2026-11-15 04:06:25 -08:00
Neil ee7fba26e2 Merge pull request #787 from nwparker/cloud/create-step-watch
chore(sandbox-control): name the step a stuck create waits in
2026-11-15 04:00:53 -08:00
Neil f75ab574eb Merge pull request #780 from nwparker/cloud/vm-memory-guard
feat(cloud): VM memory guard, /dev/shm at half of RAM, memory-pressure signal
2026-11-15 03:58:07 -08:00
Neil de49dd979f chore(sandbox-control): log the step a create waits in before it starts (CREATE-STEP-WATCH) 2026-11-15 03:50:45 -08:00
Neil 5a0927a2d4 Merge remote-tracking branch 'private/cloud/integration' into cloud/vm-memory-guard
# Conflicts:
#	cloud/apps/sandbox-control/image/vm-scripts.generated.ts
2026-11-15 03:49:16 -08:00
Neil 4939c2c878 Merge pull request #785 from nwparker/cloud/in-vm-signin-followups
feat(cloud): sign in inside the workspace: Claude's own sign-in screens, chat sign-in state, keys copy
2026-11-15 03:37:40 -08:00
Neil 5681f9499f Merge remote-tracking branch 'private/cloud/integration' into cloud/vm-memory-guard
# Conflicts:
#	cloud/apps/sandbox-control/image/vm-scripts.generated.ts
2026-11-15 03:34:17 -08:00
Neil 12389ecdbf feat(cloud): signing in inside the workspace opens on the agent's own sign-in, in terminals and chats
- sandbox-control: an agent the person signs in inside each workspace gets mode 'inside' (keys
  dropped as before) and the session env carries ORCA_SIGN_IN_INSIDE=<agents> (ORCA_*: never in
  shells). The VM env script then leaves Claude's first-run onboarding unmarked while there is no
  login in the workspace, so Claude opens on its own sign-in screens instead of 'Not logged in';
  once ~/.claude/.credentials.json exists it is marked as usual. No golden rotation: the env
  script reaches older snapshots through the boot-time entry-point refresh.
- Structured chats: a 'not signed in' verdict or start failure for such an agent reads
  '{{agent}} needs you to sign in inside this workspace' with 'Open terminal to sign in', which
  opens a terminal tab on the workspace running the agent's login (claude auth login, codex login
  --device-auth), instead of the Orca-account Renew advice.
- Copy: the choice's detail adds 'Team API keys won't be used for this agent.' (strip, Settings
  row, and the Settings button's tooltip).
2026-11-15 03:29:37 -08:00
Neil db9691e4a6 fix(cloud): boots from snapshots without the OpenCode seed keep the plugin-aware first run 2026-11-15 03:26:27 -08:00
Neil 5fe6f01f24 Merge pull request #781 from nwparker/cloud/opencode-seeded-deps
perf(cloud): seed OpenCode's config-dir install from the image
2026-11-15 03:24:33 -08:00
Neil c4a65079df Merge pull request #782 from nwparker/cloud/agent-still-starting
feat(terminal): "Still starting <agent>…" past 10 s
2026-11-15 03:18:06 -08:00
Neil 5e245104e9 refactor(cloud): VM metrics and memory wire schemas in their own module (wire file size limit) 2026-11-15 03:16:59 -08:00
Neil 8f32582e36 feat(terminal): the agent starting overlay says "Still starting <agent>…" past 10 s 2026-11-15 03:14:19 -08:00
Neil fea70d5b9b Merge pull request #779 from nwparker/cloud/in-vm-signin
feat(cloud): sign in inside the workspace (per agent, Orca stores nothing)
2026-11-15 03:14:13 -08:00
Neil 10e26123c6 fix(cloud): memguard desktop pieces under file-size limits; catalog keys 2026-11-15 03:13:40 -08:00
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 d1bdfc909b feat(cloud): VM memory guard, /dev/shm at half of RAM, and a memory-pressure signal
MEMGUARD. A build or test that eats a cloud VM's memory now costs that process, not the workspace.

- orca-memguard (new VM entry point, root via sudo from orca-sandbox-start): ranks processes for the
  kernel OOM killer (Orca runtime -900, terminal shells and agent CLIs -500, everything else 500),
  stops the largest unprotected process when MemAvailable drops under 8% and records it, adds 2 GiB
  swap files on demand (up to 1.5x RAM) and drops them after 10 quiet minutes, and remounts /dev/shm
  at 50% of RAM (the provider mounts 64 MB). Reaches old snapshots through the entry-point refresh.
- orca-sandbox-drain releases on-demand swap before a stop so it doesn't ride the snapshot.
- Status read: the VM metrics probe reads the guard's state; status gains an optional memory
  {pressure, guardKills, lastGuardVictim, ...} (metrics keeps its strict shape for older desktops).
- Desktop: guard kills count in the OOM tracker and show 'Orca stopped <process> to keep the
  workspace responsive' with a Machine size action; the sidebar row gets a quiet memory mark under
  pressure (amber when critical).
2026-11-15 03:09:39 -08:00
Neil 3e427dc6e1 chore(sandbox-control): agent_sources migration is 0063 (0062 is taken) 2026-11-15 03:00:14 -08:00
Neil c939513a89 fix(strip): the ⋯ choice lays out its two lines in a wrapper, not on the menu item 2026-11-15 03:00:05 -08:00
Neil 22e21d88e1 feat(cloud): sign in inside the workspace, an alternative to signing in once per agent
A per-person default Source 'in-workspace' for Claude and Codex. Orca stores and injects nothing
for that agent: no account placeholder, no API key, and so no egress route on the vendor's
hosts. The agent starts as it is and shows its own sign-in in the pane; its token stays in the
workspace's home directory and survives sleep.

- sandbox-control: migration 0062 widens agent_sources.source (table rebuilt, rows kept);
  PUT /v1/agent-sources accepts 'in-workspace' as a default only (400 with workspaceId);
  agentModesFor maps it to 'omit'; GET adds inWorkspace per agent while defaults/effective
  keep their two values for older desktops.
- Desktop: coverage kind 'inWorkspace' (no hold, no per-host sign-in gate on Orca Cloud);
  'Set up once' strip gets a quiet ⋯ choice 'Sign in inside this workspace instead' that
  saves the choice and starts every launch held on it; Settings › Cloud agent sign-ins offers
  it on a not-set-up row and shows 'Signs in inside each workspace' with a way back.
- Tests: Worker (env, open/limited policy, live switch, migration) and renderer (model, hold,
  spawn gate, strip, settings, build row); fixtures for the strip menu and the settings row.
2026-11-15 03:00:05 -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