Skip to content
This repository was archived by the owner on Nov 9, 2026. It is now read-only.

Boat box backend behind Computer, CF Containers fallback, human take control - #3

Merged
raunakdoesdev merged 23 commits into
boat-basefrom
devin/1791744660-boat-box
Oct 12, 2026
Merged

raunakdoesdev merged 23 commits into
boat-basefrom
devin/1791744660-boat-box

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds Boat (boat.dev) as a box backend behind the existing Computer DO. BOX_BACKEND selects it: cf in prod config, boat in staging. Callers and the Box service do not change. CF Containers stays as an automatic fallback.

Boat path (src/core/boat.ts, src/core/box.ts)

  • #boot() resumes the stored sandbox id, or else creates the sandbox from BOAT_TEMPLATE.
  • Every create and fork uses { noEnv: true, monitoring: false, failFast: true } with the default size. Boat therefore keeps no command history or output, and the VM gets no account credentials.
  • Commands go to boatd on port 8912, exposed with host --private. Stdin and per-call env (secrets) go in the HTTPS request body, never in Boat exec args.
    • The Boat proxy takes _token once and answers with a 302 and a cookie. call() caches that cookie per daemon URL and retries once with a fresh cookie on 401/403/3xx.
  • Subagents (agent-N) are Boat forks of main. A fork is deleted after merge.
  • Computer-use agents run in main: same disk, same Chrome profile, same desktop on :0.
  • Fallback: if a Boat call fails before a command starts, the box sets boatDown for 10 minutes and runs on CF. On Boat there is no setup.sh replay, because the disk persists.

Secrets on Boat

  • Vault values exist only in memory at use time: in the browser process, in vault run's child env, and in Bitwarden data on tmpfs (/dev/shm/raubot-bw).
  • Passkeys are loaded into the CDP virtual authenticator at the start of each browser run. They are removed with set([]) after the run, and the decrypted item cache is dropped (vault.forget()).
  • Chrome's Sessions and Session Storage live on tmpfs (RAUBOT_VOLATILE), because Chrome's tab-restore file kept typed form values.
  • Hardening:
    • Password manager and autofill are off (managed policy).
    • journald is volatile; HISTFILE=/dev/null.
    • Browser log is on tmpfs.
    • Boat's built-in 2 GB /swapfile is removed in the template. Boat recreates it on resume, so #boatUp() also runs swapoff -a && rm -f /swapfile after every boot and resume.
  • prestop() quits the browser server so cookies get flushed, kills Chrome, and clears tmpfs and /scratch. With BOAT_WIPE_BROWSER_ON_STOP=1 (default off) it also deletes the profile. Logged-in cookies and localStorage persisting is the accepted risk.

Leak test (npm run boat:leaktest, .github/workflows/boat-leaktest.yml)

  1. Fresh sandbox. Runs a vault password login (fake bw serving random values) and a WebAuthn passkey login (random P-256 key and credential ID) against a local site.
  2. Pre-stop, then stop.
  3. Streams the snapshot tar and scans it.
  4. Resumes.
  5. grep -r / (detached), then a raw scan of /dev/vda1 (test/rawscan.py; offsets are mapped to files with debugfs).

Needles cover each value as raw text, base64, base64url and hex. For passkeys they also cover the PKCS#8 DER, the PEM line, the private scalar and the credential ID bytes. A canary file is the control. Any match fails the test, and the sandbox is deleted in finally.

Take control

  • GET /takeover/(main|agent-N): behind Access, same-origin only. Each request mints a new desktop URL and adds overlay=0; no publicAccess. It answers with a 302, no-store, no-referrer. The URL is never logged or stored.
  • While the box is held, the browser tool waits (up to 5 min). "Hand back" sends the steer text, then releases the box.
  • A browser call that was waiting on the hold is not run after the hand back; it returns "Not run: a human had control ..." so the agent looks at the page and follows the steer first (Computer.free() returns "free" | "released" | "held").
  • Boat 429s (12 sandbox starts per minute) are retried with backoff in Boat.#call() instead of falling back to CF.

Vault origin check (browser/origin.mjs, browser/server.mjs)

vault.fill(locator, ref) and vault.type(ref) now refuse unless every URL they would put the value into has the same eTLD+1 (tldts.getDomain) as one of the item's saved URIs. The check runs before the value is read from the vault.

fill: at = [page.url(), frameOf(locator).url]   // attacker iframe -> refused
type: at = [page.url(), ...page.frames().map(f => f.url())]
if (!sameSite(at, item.uris)) throw refuse(...)  // no saved URI, non-http(s) -> refused

Regression test: browser/origin.test.mjs. Red-team kit: box/boat/redteam/ (trap site, fake bw), scanner box/boat/scan.mjs.

Deploy / rollback runbook

Deploy (prod stays on CF until you flip it):

  1. Merge into boat-base, push to Artifacts raubot main, wrangler deploy. Prod config has BOX_BACKEND: "cf", so behaviour is unchanged.
  2. wrangler secret put BOAT_API_KEY (prod).
  3. Build the template: npm run boat:template -> set BOAT_TEMPLATE to the printed name (staging uses raubot-box-b63e44d1a1; the boatd 15 s keepalive is newer than that template, so rebuild it).
  4. Set BOX_BACKEND: "boat" and BOAT_TEMPLATE in the prod vars and deploy again.
  5. Check: GET /box shows backend: "boat"; a bash call works; /takeover/main opens the desktop.

Migrating existing boxes: nothing to run by hand. On the first call after the flip, main has no Boat sandbox, so it is created from the template, /workspace and the raubot repo are cloned from Artifacts, and setup.sh is replayed once (with sudo for apt, since the Boat user is not root). After that the Boat disk persists, so setup.sh is not replayed again. Anything installed on CF but not in setup.sh or /workspace is lost, same as a CF restore today.

Running subagents: a subagent box that already runs on CF stays on CF until it stops. New subagent boxes are Boat forks of main, so they get main's disk (including what setup.sh installed) and need nothing reinstalled. A subagent that was mid-task on CF and boots again on Boat starts from a fork of main, so it must reinstall anything it installed itself outside setup.sh; its /workspace branch agent-N is restored from Artifacts.

CF fallback (automatic): if Boat fails before a command starts (API error, 402/401, daemon not healthy in 60 s), the box sets boatDown for 10 min and runs that boot on CF (setup.sh replay as before). It goes back to Boat on the first boot after the CF container stops and boatDown has passed. Boat 429s are retried, not failed over.

Rollback: set BOX_BACKEND: "cf" and deploy (or roll back to the previous Worker version). Boxes boot on CF and replay setup.sh; /workspace is in Artifacts, so no data is lost. Boat sandboxes are left stopped (stop = free); delete them later with DELETE /sandboxes/{id} + X-Ascii-Confirm-Delete: <id>.

Real passkey e2e (raubot runs it, creds injected at use time)

Staging: https://raubot-staging.reducto.ai (Boat). Ask the staging agent, with BW_CLIENTID/BW_CLIENTSECRET/BW_PASSWORD given only as per-call secrets:

  1. Headed browser: sign in to Google as [REDACTED SECRET] with the passkey; check the account chooser shows raunak@ (not sauhaarda@).
  2. Vercel SAML -> Duo -> passkey as raunak@.
  3. Take control from the web UI, click around, hand back with a steer; repeat step 1-2.
  4. POST /box (stop), then repeat steps 1-2 (session should still be logged in).
  5. In one bash call with the same BW_* secrets: cd /workspace/raubot && node box/boat/scan.mjs; echo exit $?. Pass = "pass": true (0 secret files, 0 raw-disk secrets, canary found). Then stop the box and run it once more after resume.

Results (real Boat VMs / staging)

Test Result
Create → first command 0.2–1.2 s
Template build raubot-box-b63e44d1a1 25–32 s; daemon healthy, HTTPS egress ok, metadata blocked
Fork → ready 2.1 s (needs a completed source snapshot, ~64 s after create)
Stop / resume / resume → daemon 11–18 s / 2.2–3.4 s / 2.8–4.3 s
Files, apt package, npm install after stop/resume Pass
Browser login and passkey session after stop/resume (wipe off) Pass
Browser login gone after stop with --wipe Pass
Passkey login after resume; authenticator empty after each run Pass
Snapshot tar scan (≈128 MB, ≈13k files) 0 secret matches, canary found
grep -r / after resume 0 secret matches, canary found
Raw disk scan (75 GB) Fail with swap on: every value found 1–8 times, all in blocks owned by /swapfile (debugfs icheck/ncheck). Pass with swap off (leak10, leak11, and leak12 on HEAD 19fbed5): 0 secret matches, canary found. leak12: create 0.2 s, stop 20.7 s, resume 4.0 s, resume → daemon 4.5 s, snapshot 129 MB / 13,066 files, raw scan 74.9 GB in 18.5 min
Swap after resume Boat recreates /swapfile on resume (leak12 saw a new 1 MB one). It is now turned off on every boot/resume, and leak12 fails if swap is still on. Staging main VM: no swap, no /swapfile
12 parallel subagents (staging chat, rerun) 11 on Boat forks, 1 got Boat 429 rate_limited (12 starts/min) and ran on the CF fallback. All 12 finished and merged in 79.8 s; forks deleted within ~60 s. 429s are now retried
Fallback, bad BOAT_API_KEY on current build Pass: new subagent got 401 from Boat, ran on CF (BACKEND=cf), whole chat turn 35 s. Key restored afterwards
Fallback on a real Boat failure (402, earlier build) Pass: boatDown, backend: "cf", bash call 6.4 s
Codemode Pass: all chat tests above ran through codemode (tools.bash, tools.agent, tools.crons, tools.jobs)
Crons Pass: * * * * * cron on app channel ran twice on schedule on Boat (BACKEND=boat, CRON_OK), then removed. On the imessage channel the runs fail with send failed because staging has no SPECTRUM_PROJECT_ID/SPECTRUM_PROJECT_SECRET secrets (same on CF)
Take control: desktop URL mint 5/5 distinct URLs; main median 325 ms (320–333 ms); agent box 481 ms. 302, no-store, no-referrer, overlay=0
Take control: iframe Moonlight client (not noVNC), live desktop in 6.6 s, mouse and typing work. agent-N (computer use) opens the shared main VM desktop
Take control: clipboard Host → Boat pass. Boat → host pass after the iframe has focus
Take control: pause / resume Pass on main and on a computer-use agent: completed browser calls stayed flat while held (2 → 2 over 90 s; 5 → 5 over 67 s); hand back with steer "go to Wikipedia" → agent reported title "Wikipedia"; held:false after
Google passkey as raunak@ + Duo/Vercel SAML (real vault) Not run by Devin. raubot runs it with real creds injected at use time (no BW secrets on staging). Synthetic vault password + passkey logins pass (rows above)
Prompt-injection / credential-exfil red-team (fake canary vault) Pass, see research/injection-redteam.md: 4 agent runs (password, TOTP, passkey, "authorized") + 2 passkey reruns + a direct gate test. No canary on attacker pages or in requests; final file + journal + browser log + raw-disk (74.9 GB) scan: 0 matches, canary control found
npx tsc -p ., npm test, vite build web Pass

Held desktop during take control
Agent resumed after hand back with steer
Boat to host clipboard

Staging deploys need the global API key; CLOUDFLARE_API_TOKEN fails with "Container image preparation is not enabled for this account".

Link to Devin session: https://app.devin.ai/sessions/2eb03b16c1bc48d7be38fc7a7d1cb712
Open in Devin Desktop: https://app.devin.ai/desktop/session/2eb03b16c1bc48d7be38fc7a7d1cb712?variant=devin
Requested by: @raunakdoesdev

devin-ai-integration Bot and others added 4 commits October 11, 2026 19:00
…END)

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
…b button + embedded desktop, agent computer use paused until hand back

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
…ck, then continue

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Original prompt from Raunak

Repo: github.com/raunakdoesdev/raubot (private). Base your work on branch boat-base (current production HEAD 76841b9; main on GitHub is stale). Open your PR against boat-base. raubot is a Cloudflare Worker + Durable Objects agent; each agent runs in a Cloudflare Containers "box" (src/core/box.ts, standard-1; /workspace = git repo auto-committed; setup.sh replays installs after a box restore; subagents get a copy of the main box). Read README.md, BOX.md, src/core/box.ts, wrangler.jsonc. Staging: npm run deploy:staging → raubot-staging.reducto.ai (separate chat/box/Artifacts namespace raubot-staging). Background research: Boat = boat.dev (by ASCII / Dedale AI): persistent Ubuntu 24.04 full VMs, Chrome+desktop preinstalled, minute disk snapshots, stop=free, resume/fork from snapshot, REST API https://boat.dev/api/v1 (Bearer BOAT_API_KEY), TS SDK, docs https://docs.boat.dev (llms.txt).

TASK: implement Boat as the box backend behind the existing Box interface in src/core/box.ts, keeping CF Containers as a fallback selected by a flag (e.g. env BOX_BACKEND=boat|cf, default cf in prod config, boat in staging).

  • Main box + a Sol computer-use "buddy" agent in the SAME Boat VM sharing Chrome/Chromium profile and disk (see /workspace/research/agent-architecture.html ideas if present in repo; otherwise design it).
  • Subagents = Boat forks of the main sandbox.
  • Persistent Boat disk replaces the setup.sh snapshot/replay hack; installs persist. Add a declarative template/manifest (named Boat snapshot built from a manifest) for fresh boxes.
  • Security (required): turn off/avoid Boat command-output retention for anything secret (never put secrets in boat exec args; pass via stdin/env files with 0600 and delete), use Boat environments with no account credentials for subagents (--no-env / safe-for-third-parties), scoped short-TTL keys where possible, default-deny egress allowlist in template that keeps Boat agent port 8911 + WireGuard endpoint. Bitwarden session material must ... (2032 chars truncated...)

devin-ai-integration Bot and others added 19 commits October 11, 2026 21:42
…ion state on tmpfs

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
…k test checks it

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
…ter the hand back

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
…ith sudo for apt; tsx devDependency; leaktest CI names a missing BOAT_API_KEY

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
… and fake vault

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
…h it

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
…al BW_* keys

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
…starts

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
… bw works outside the browser server

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
…ned when stdin is a socket

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
…commands over 100 s (524)

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
…ble), so Chrome's HTTP cache can't hold it

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
…overable) and send the challenge as no-store, like a real RP, so Chrome doesn't cache the credential id

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
…anary (Boat keeps copies of the canary file)

Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>
Co-Authored-By: Raunak Chowdhuri <raunak@reducto.ai>

@raunakdoesdev raunakdoesdev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gates: red-team PASS, origin-check test, CI leaktest green, real Google passkey + Vercel SAML/Duo e2e PASS on staging. Raunak approved deploy.

@raunakdoesdev
raunakdoesdev merged commit a419d13 into boat-base Oct 12, 2026
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant