Commit Graph
126 Commits
Author SHA1 Message Date
Neil 8769dddccc fix(cloud): a device id claimed by more than one member maps to nobody in the VM's devices map (no last-wins attestation as another member) 2026-11-15 22:52:34 -08:00
Neil 9a770d4686 feat(cloud): GIT-COAUTHOR a commit that falls back to the workspace identity while a known member drove it carries Co-authored-by for them 2026-11-15 22:48:20 -08:00
Neil 36303ac480 fix(cloud): GH-AS-MEMBER gh wrapper actually runs: the real gh moves off PATH (tools/gh/bin) and tools/bin/gh links to the wrapper; older images migrated at entry-point install 2026-11-15 22:37:07 -08:00
Neil 730334b4f5 fix(cloud): GH-AS-MEMBER PRs, comments and pushes from a cloud workspace show as the member, not the bot
stablyai/orca#42960 (Neil, dev) was authored by orca-cloud-dev[bot]. Neil had connected GitHub; member
identities only reached git: gh ran on the workspace placeholder (the App's installation token), and
the Worker's member route on api.github.com allowed only REST under the repo while gh pr create is
GraphQL.

- VM: a gh wrapper runs gh with the attested sender's own placeholder (orcad attests, as for git);
  plain gh otherwise. Behind GH_AS_MEMBER=on (dev on).
- Worker, api.github.com with a member placeholder: the member's own token only for REST under the
  workspace repo and for allowlisted authorship mutations whose every target resolves to it
  (repositoryId equals its node id; other ids looked up with the installation token, cached per repo,
  failures not cached). graphql-js parse; variable defaults, owner-level projectIds, duplicate
  top-level keys and anything unexpected are not member requests. Everything else goes out on the
  installation token as before; an out-of-repo pinned mutation is refused with a GraphQL error.
- Shared workspaces never approve or merge as a member (GraphQL and REST): those go out on the
  installation token, so branch protection still applies.
- Identity rule: the only person who can use a workspace always acts; in a shared one the latest
  sender acts until another member sends, for at most MEMBER_GIT_SHARED_MAX_MINUTES (default 480).
- A GitHub connect or disconnect mid-session reaches the running VM's identities now.
- Tokens never enter the VM.
2026-11-15 21:18:00 -08:00
Neil 053e4bad38 fix(cloud): a background clone sends one Authorization header, not two
The desktop's create (clone-progress) runs the workspace clone detached. orca-sandbox-start then writes
the same extraheader into ~/.gitconfig, and http.<url>.extraheader is a list. So the clone's later
requests (the blobless clone's checkout fetch, and the retry clone) carried Authorization twice. The
firewall answered 400 and nothing reached the egress proxy. The clone failed with "could not fetch
... from promisor remote", and an App-installed private repo opened empty.

Reproduced on dev: `git -c extraheader=<A> ls-remote` with the global header set gives 400, and with
`-c extraheader=` first it gives rc 0. The prelude's git auth now clears the list before adding its
header. Worker-only (the prelude ships per create), so the VM scripts stamp is unchanged. Found by the
egress probe, after #790 fixed the proxy side.
2026-11-15 13:05:20 -08:00
Neil e00dab0808 Merge remote-tracking branch 'private/cloud/integration' into cloud/codex-firewall-swap
# Conflicts:
#	cloud/apps/sandbox-control/image/vm-scripts.generated.ts
2026-11-15 12:42:55 -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 4b7ab8bcb9 merge cloud/integration; regenerate VM scripts 2026-11-15 04:06:25 -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 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 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 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
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 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 6a02019931 chore(golden): regenerate the Worker-embedded VM scripts 2026-11-14 23:20:02 -08:00
Neil 0148e0c48c fix(sandbox-control): share-link WebSockets get a keepalive ping under Vercel's ~340 s idle cut
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.
2026-11-14 20:57:31 -08:00
Neil ff8f915c05 fix(cloud): G9 ~/.claude.json pre-approves only an Orca placeholder's tail; a real ANTHROPIC_API_KEY leaves nothing of itself on disk and an older tail is scrubbed 2026-11-13 06:10:57 -08:00
Neil 7014c59a2d fix(cloud): PUSH-CAP design-squad wording; 'connect GitHub' catalog form in the no-access line 2026-11-13 05:45:44 -08:00
Neil f7d3a47079 fix(cloud): PUSH-CAP git shim replaces the bare HTTP 413 on a github.com push over the egress proxy cap with a plain Orca line 2026-11-13 05:44:51 -08:00
Neil c92b709831 feat(cloud): docker shim copy per design-squad (retry hints, three-line CA notice once per workspace) 2026-11-13 04:10:53 -08:00
Neil 1ffa40e87c feat(cloud): docker first-use message states the measured time (7.5 s on dev) 2026-11-13 04:08:21 -08:00
Neil 98bdda862a merge cloud/integration (#666); regenerate VM scripts 2026-11-13 03:47:14 -08:00
Neil a7554e7176 chore(cloud): DOMAIN-1 D3: fallback VM git identity Orca <noreply@orca.dev> + benchmark token URL (ROTATES GOLDEN; w6 deploys with it) (#666)
* chore(ci): DOMAIN-1 D3 the benchmark workflow's diagnostics token URL matches the other release workflows (orca.dev)

* chore(cloud): DOMAIN-1 D3 (DOM-d) fallback VM git email noreply@orca.dev (prelude, vm-agent, routines); image/vm unchanged, no VM_SCRIPTS_HASH change

* chore(cloud): DOMAIN-1 GIT-EMAIL-ALIGN image/vm fallback git email noreply@orca.dev; earlier defaults migrate to it

* chore(cloud): regenerate vm-scripts.generated.ts

* chore(cloud): DOMAIN-1 DOM-d fallback VM git identity Orca <noreply@orca.dev> (name migrates from 'Orca Cloud'); shim notice copy per design-squad

* chore(cloud): regenerate vm-scripts.generated.ts

* test(cloud): update environment-build-auto-install VM_SCRIPTS_HASH pin for DOMAIN-1 #666
2026-11-13 03:22:32 -08:00
Neil fd1b37c29f Merge remote-tracking branch 'private/cloud/integration' into create-speed/parity-docker 2026-11-13 03:02:54 -08:00
Neil ba3962d9cc feat(cloud): Docker installs on first use instead of in the golden (+5 s create p50 measured) 2026-11-13 02:55:10 -08:00
Neil 41894956d0 feat(cloud): Docker in Orca Cloud workspaces (PARITY-DOCKER)
The golden image ships Ubuntu's docker.io, docker-compose-v2 and docker-buildx (pinned in the
manifest; daemon.json: overlay2, local log driver with caps, mirror.gcr.io registry mirror).
dockerd runs rootful inside the workspace's microVM and is never started at boot: the new
/opt/orca/bin/docker shim (image/vm/docker, first on PATH) starts it on the first command that
needs it (0.3 s in the spike), says once what differs from a laptop (containers stop on sleep;
credential hosts need the proxy CA mounted), then execs plain docker. An image without Docker
says so instead of waiting.

Off switch: SANDBOX_DOCKER=off (Worker var, default on) sends ORCA_DOCKER=off on every boot;
orca-sandbox-start leaves ~/.orca-sandbox/docker.off and the shim refuses with a plain message.
Starts without the flag (retries, repairs) keep the VM's last answer.

Egress: CONTAINER_REGISTRY_HOSTS (mirror.gcr.io, Docker Hub, GHCR) join the default allowlist.
Docs: cloud/docs/sandbox-docker.md (incl. the proxy-CA mount). Golden rotation carries only
this change, with the Worker deployed from the same commit (runbook 1.8a).
2026-11-13 02:25:21 -08:00
Neil 71b8cd4c32 feat(cloud): automatic environments install the repo's lockfile dependencies, softly (PARITY-AUTO-ENV-DEPS)
An automatic environment (no install script) now runs the first repo's JavaScript install from its
lockfile during its build, so creates start with node_modules: pnpm/yarn through corepack (frozen /
immutable), npm ci; package.json's packageManager wins. A failure, a lockfile out of date or the
15-minute cap never fails the build: the log says why, half-installed node_modules are removed, and
the warm clone is snapshotted as before. Lockfiles the image has no tool for (bun, uv, bundler, go,
cargo) are named in the log. Admin environments are unchanged. env/ scripts ship in the Worker:
VM_SCRIPTS_HASH is unchanged (no golden rotation).
2026-11-13 02:14:03 -08:00
Neil bb7da07082 Merge remote-tracking branch 'private/cloud/integration' into cloud/w6-settings-arrow 2026-11-12 21:53:09 -08:00
Neil ab27c1d396 fix(cloud): SEC-2 builds never get model keys, and fail if a team secret is left on disk
Environment builds get only the team secrets an admin named, never a swapped model key, hand them to the install script alone, and fail with no snapshot (secret_in_image) when a value is still in a file the build changed.
2026-11-12 21:37:25 -08:00
Neil 38ed468ae4 fix(cloud): VM git lines say Settings → Account (glossary path arrow; design-squad) 2026-11-12 17:17:33 -08:00
Neil 018d81b096 fix(sandbox-control): never install older VM scripts over a newer golden (VM-SCRIPTS-DOWNGRADE)
The generator now emits VM_SCRIPTS_HASH and a monotonic VM_SCRIPTS_STAMP
(kept while the scripts are unchanged; max(previous + 1, now) on a change).
Provisioning records the stamp in /opt/orca/bin/.scripts-stamp (source
builds use the fetched commit's stamp), installEntryPoints writes the
Worker's, and ensureEntryPoints probes stamp + marker in one command and
skips images whose stamp is newer than the Worker's. Golden refreshes use
ensureEntryPoints too, so a lagging Worker cannot bake older scripts into
a refreshed golden.
2026-11-12 16:52:50 -08:00
Neil 4f2b3772ca fix(cloud): GitHub not-found on push/fetch says to check the name, or install the App if it's private (design-squad) 2026-11-12 16:14:15 -08:00
Neil 3de6f16d82 fix(cloud): VM git lines point to Settings › Account (true with or without billing; design-squad) 2026-11-12 16:05:27 -08:00
Neil 61d31da441 fix(cloud): PUSH-RAW-PROMPT a github.com push, pull or fetch with no credential never prompts; one plain line says what to do 2026-11-12 16:04:07 -08:00
Neil 0f98742050 feat(cloud): a commit under Orca Cloud's name says once per session how to use your own (Connect your GitHub in Account & billing; design-squad) 2026-11-12 02:02:59 -08:00
Neil c2f5b1fbb7 Merge remote-tracking branch 'private/cloud/integration' into cloud/n02-reland
# Conflicts:
#	cloud/apps/sandbox-control/image/vm-scripts.generated.ts
2026-11-12 01:25:37 -08:00
Neil f8beff3dc5 Merge remote-tracking branch 'private/cloud/integration' into cloud/reland-485
# Conflicts:
#	cloud/apps/sandbox-control/image/vm-scripts.generated.ts
2026-11-12 00:31:18 -08:00
Neil 8fd67bbd3d Merge remote-tracking branch 'private/cloud/integration' into cloud/n02-reland
# Conflicts:
#	cloud/apps/sandbox-control/image/vm-scripts.generated.ts
2026-11-12 00:31:11 -08:00
Neil a44f0c39fd Merge remote-tracking branch 'private/cloud/integration' into cloud/w6-terminal-identity
# Conflicts:
#	cloud/apps/sandbox-control/image/vm-scripts.generated.ts
2026-11-11 22:21:55 -08:00
Neil e28c042de2 Revert "Merge pull request #502 from nwparker/cloud/revert-485"
This reverts commit 0d53168422, reversing
changes made to e81a96e7ad.
2026-11-11 22:18:34 -08:00
Neil e7059d8a0e Revert "Merge pull request #485 from nwparker/cloud/cr-cmd-quiet-zsh"
This reverts commit da67a5ca80, reversing
changes made to 337e3e6929.
2026-11-11 21:57:11 -08:00
Neil a834170b8f feat(cloud): commits and pushes in a plain cloud terminal use the typist's GitHub identity; fallback email on orca.dev
- orcad: a delivered keystroke frame from a paired device records that device as the terminal's driver (the same registry agent prompts use), so the VM git shim's orca-git-as answers for plain terminals too. The device is the transport-attested caller, never the client id. Local windows never record.
- desktop: typing in an Orca Cloud terminal reports "I'm driving" (noteCloudSend, throttled), so the egress honors the typist's GitHub identity. Only xterm user input counts; query replies, focus and mouse reports, replay and resubscribes don't.
- Fallback author email cloud@users.noreply.onorca.dev becomes cloud@users.noreply.orca.dev; existing workspaces on the old default follow on next boot.
2026-11-11 21:45:40 -08:00
Neil c1963562d9 fix(cloud): CR-cmd-quiet zsh: keep Orca's staged launch line out of zsh history (VM session env hook) 2026-11-11 19:59:57 -08:00
Neil 4bcf815aa7 fix(cloud): a boot whose member identity install fails records it too (VM git-setup.failed + gitSetup), so Restart can't hide a failure
Boot-time installs were swallowed and the boot cleared gitSetup, so a restart whose install failed again dropped the desktop strip while git still lacked identities. Every boot install now goes through settleMemberGit: failure marks the VM and the row, a later success (or a boot with nobody to install) clears them. The git shim refuses on a failed mark even with nothing pending. Restart is the retry (it re-runs the install before it answers).
2026-11-11 19:29:18 -08:00
Neil 8bb65d69b0 copy(cloud): git shim hold messages per design-squad (orca: prefix, git <cmd>, sidebar > Restart, newline-terminated) 2026-11-11 19:29:18 -08:00
Neil d441463abb perf(cloud): a create answers at ready; member git identities install after it (CREATE-GIT-ASYNC)
POST /v1/sandboxes kept the response open ~2.3 s after orcad was ready while syncMemberGit ran (and again inside boot when the creator had GitHub connected). A create now records the owner device, answers, and installs member identities in ctx.waitUntil. The VM is told the setup is pending (ORCA_GIT_SETUP=pending -> ~/.orca-sandbox/git-setup.pending); its git shim holds commit/push/merge/... up to 15 s until orca-sandbox-members writes git-setup.ready, and on a failed or stalled setup stops them with what to do instead of committing as the workspace identity. Read-only git and fetches never wait: the boot already routes the workspace credential. A failed install is kept on the row (0053 git_setup_failed_at) and shown as sandbox.gitSetup 'failed' to clients sending feature git-setup; any later boot or successful sync clears it. Wake, resume, restart and grants are unchanged (synchronous).
2026-11-11 19:29:18 -08:00
Neil a7b4937fa0 fix(cloud): N-02 re-land: host keeps a local terminal's depth in the VM; overflow recovery stays at 1000 rows 2026-11-11 13:17:09 -08:00