feat(sdk): isolate hosted Babysitter capability
Summary
- add a Linux-only runner for the exact published native Babysitter artifact, importing it only inside bubblewrap user/PID/network/mount namespaces plus Node's permission model
- expose only
f.capabilities.cloud.babysitterTurn.queue({ delivery })andf.done; the original verified dispatch and immutable extension provenance stay in the parent - bind execution to one opaque runtime generation and exact reviewed base, extension, and Surface runtime bytes
- keep #549's generic executor refusal unchanged; this PR does not publish, enable, deploy, or merge the extension
Fail-closed boundary
The public path requires one opaque base/installation generation plus the symbol-branded verified delivery dispatch. It never executes tenant base code to derive identity: the parent requires the exact reviewed Software Factory flow SHA-256 and assigns the pinned software-factory@2.0.22 identity. Every dispatch rechecks current declarations and the complete project source generation, so caller-assembled, cross-project, cross-redeploy, stale, composed, lock-drift, and route-ambiguous inputs refuse before import.
Every installed artifact and manifest is reverified against the base/runtime, and the selected artifact must equal the reviewed native pin:
- ref
github:AgentWorkforce/flows@8b33ebab8347514f80d9da5a81206a087f641714#extensions/babysitter - digest
bdf2187b9a242667d34bbc63e7a744753e146dc8cd6f4047047f2aed28f406ee - manifest SHA-256
5631a06bbdc8186f4ee0ff955610ead24d001c5197b59fb1fe81fe422c44f226
The extension bytes are reread into bounded parent-owned buffers and rehashed. The six required Surface runtime files are independently SHA-256-pinned and read into parent-owned buffers. Bubblewrap receives every runner, extension, and Surface file over an inherited descriptor and --ro-bind-data, which copies it into a read-only mount before Node starts; there is no mutable host staging path, and live project, plugin-store, and Surface paths are never mounted. The runtime generation is checked again after the buffers exist and immediately before spawn.
The child runs beneath inherited hard limits of 16 GiB address space and 3 GiB data/anonymous memory (covering V8 reservations, heap, Buffer/native memory, mappings, and descendants); the separate 64 MiB old-space bound remains and receives a closed normalized GitHub descriptor and minimal Surface facade. It receives no workspace mount, inherited credentials, network, writable filesystem, subprocess permission, MCP, helpers, harnesses, base context, verified authority, or extension provenance. Descriptor 3 is hostile transport, not authority: every frame/request/receipt is validated in the parent, an exact direct frame can consume only the same one-shot delivery capability already granted, and premature/repeated/unknown frames fail.
The parent permits exactly one request and returns only { receiptId, status: 'queued' | 'duplicate' }. Typed Cloud refusals remain the parent rejection; the child sees only a fixed refusal marker. In-doubt timeout rejects without retry or fallback.
Rollout coupling (not enabled here)
- The host accepts only a base flow byte-identical to the reviewed Software Factory source SHA-256
49c993220b9c34fab2d4b0e51911656f62b8b657f534d988691960d45bb9d9b6and assignssoftware-factory@2.0.22. Any Garden customization or source update refuses until a reviewed SDK pin is released, so fleet rollout must deploy those exact base bytes. - The accepted extension ref is compiled into the SDK as
github:AgentWorkforce/flows@8b33ebab8347514f80d9da5a81206a087f641714#extensions/babysitter, with digestbdf2187b9a242667d34bbc63e7a744753e146dc8cd6f4047047f2aed28f406ee. A new Babysitter version requires a reviewed SDK release, and the Cloud catalog must carry that exact ref and digest. - Default Garden bundling must prefilter the exact live
babysitlabel before invoking this runner so unrelated PR events do not spawn sandboxes. The Cloud adapter still rechecks the live label, session, and head after dispatch.
Remaining gate
- AgentWorkforce/cloud#3942 owns persisted
workspaceId/activationId/listenerAgentIdinjection, live open-PR/exact-label/current-head checks, authorized existing-session resolution, lineage/head dedupe, and Relay native-turn delivery. - The Relay route, Surface release, end-to-end canary, and independent review at the exact release head remain required before replacing #549's refusal.
- Broader per-step permissions from #442 are not bundled and remain a separate gate.
Refs #442.
Verification
- SDK typecheck/build/test-typecheck and focused security/routing suites: 10 files, 231/231 tests pass
- Surface typecheck/regressions and suite: 51/51 tests pass
- Linux sandbox exercised with bubblewrap 0.12.0 and exact published 2.0.27 bytes
- CI installs bubblewrap and explicitly enables Ubuntu user namespaces/AppArmor support so the no-network isolation suite runs rather than skips
Literal command output: evidence/babysitter-gate8-isolation/verification.txt.
[!NOTE]
High Risk
Introduces a security-critical sandbox and parent protocol for executing pinned extension code with host-verified dispatch; mistakes in generation binding, pinning, or frame validation could allow privilege escalation or unauthorized cloud turns.
Overview
Adds a Linux-only, capability-only path to run the pinned native Babysitter extension without lifting #549โs generic executor refusal. Hosted callers must loadHostedExtensionRuntime (opaque base + installation in one generation, no extension JS import) and then runHostedCapabilityExtension, which re-verifies declarations, full project source, lock/store bytes, route uniqueness, and exact reviewed Software Factory + Babysitter ref/digest/manifest before import inside bubblewrap with a minimal Surface facade and a single capabilities.cloud.babysitterTurn.queue adapter call validated in the parent.
Supporting work hardens trust boundaries: private base/plugin snapshots with bounded descriptor reads, hosted declaration/manifest/protocol validators that treat child IPC as hostile, intrinsic-only canonical/bundle hashing so tenant code cannot poison prototypes, and build-time embedded SDK/Surface versions for standalone CLI. Docs (BABYSITTER-CATALOG-HANDOFF.md, CLOUD.md) and evidence/babysitter-gate8-isolation/ document the contract, pins, and verification record; Cloud adapter, Relay, canary, and #442 remain out of scope.
Reviewed by Cursor Bugbot for commit d401cb8c6e6b59014449fa9503772fe5a1f830a8. Bugbot is set up for automated code reviews on this repo. Configure here.