oficina / equipo Public
Hosted runners on AWS Lambda MicroVMs
Date: 2026-11-18; security revision 2026-11-19. Status: approved by Paul 2026-11-19 with the §16 rulings; slice 1 plan next. Decision: discussion 22 (Lambda MicroVMs, not reopened). Evidence: a throwaway spike in the dev AWS account, torn down (§15).
1. What this adds
A person can run Equipo work without keeping a machine online. Each hosted job gets one Firecracker VM in Ireland running the existing outbound-only equipo-runner. Personal runners keep working as they do today.
Three spike results changed the design from discussion 22:
- Managed DNS bypasses an egress allowlist unless VPC DNS is off (§6).
- An execution role exposes live AWS credentials inside the VM, so hosted VMs have no role (§5).
- Bubblewrap works in the VM with a specific image profile, so the agent stays sandboxed from the runner's secrets (§7).
2. The isolated job runner adapter
The scheduler uses this interface and never sees AWS types. It lives in internal/isolatedjob, with an AWS implementation and an in-memory fake.
type Runner interface {
Launch(ctx context.Context, s LaunchSpec) (Ref, error) // idempotent on AttemptID
Get(ctx context.Context, ref Ref) (Job, error)
Suspend(ctx context.Context, ref Ref) error
Resume(ctx context.Context, ref Ref) error
Stop(ctx context.Context, ref Ref, reason string) error // succeeds if already gone
List(ctx context.Context) ([]Job, error) // all VMs the provider holds
Limits() Limits
}
type LaunchSpec struct {
AttemptID string
Image ImageDigest // must be certified (§7)
Size Size // Small (2 GB) or Large (4 GB)
MaxLifetime time.Duration // includes suspended time
Bootstrap []byte // one-time code only (§5)
}
type Job struct {
Ref Ref
State State // Starting, Running, Suspending, Suspended, Stopping, Stopped, Failed
StartedAt time.Time
Reason string
}
type Limits struct {
MaxLifetime time.Duration
MaxBootstrapBytes int
SuspendUsesLifetime bool
ConnectionsSurvive bool
}Controller. equipo-hosted-controller runs in the hosted AWS account and holds the only IAM role that can call the MicroVM APIs. The Equipo instance calls it over signed HTTPS and holds no AWS credentials. run-microvm accepts no tags and List returns no attempt ID, so the controller's job table is the only link between a VM and its job.
3. VM lifecycle
Every launch uses NO_INGRESS, the VPC connector as its only egress, no execution role, no idle policy (outbound traffic does not count as activity, §15), a maximum duration of 28,800 s, and x86_64, the runner's only release target.
| Stage | What happens | | --- | --- | | Launch | The controller saves a launch intent with the exact request, then calls AWS with the attempt ID as client token. After a crash it replays the same request. | | Enrol | The /run hook gives the runner the bootstrap code. The runner generates its machine key and enrols (§5). | | Run | The instance dispatches the step over the normal runner stream. | | Pause | See the barrier below. | | Resume | See the barrier below. | | Stop | Close admission, fence publication, then obtain proof of the end: the runner's termination report or a terminal VM state. Then revoke tokens. The revoked runner row stays until its attempts, transfers and publications settle. |
The pause barrier. Checking that nothing is running is not enough, because a dispatch could arrive straight afterwards.
- The instance marks the job
draining, with a new pause generation, in the same transaction that authorises step starts. Nothing new can start once it commits. - The runner stops taking work, flushes reports and transfers, acknowledges
quiescentfor that generation, and only then closes its stream. - The controller suspends only on an acknowledgement for the current generation. Without one within 2 minutes it cancels that generation and ignores any late acknowledgement. Admission reopens only when the runner confirms it is taking work again. If it cannot confirm, the VM is stopped and the attempt recovered.
- Resume carries an operation ID, so a retried call raises the epoch once. Admission stays closed until the runner has replaced its tokens and resynced.
The 8-hour limit. The deadline is launch time plus 8 hours and never moves. Suspended time counts.
- At 7 h 15 min the job enters
draining. - The runner sends a checkpoint: a pack of work in progress, acknowledged durably by the primary, plus a notebook summary. Today's provider failover discards a refused attempt's work, so checkpointing is new work in slice 4.
- A replacement starts only after the old VM is proven stopped. Publication is fenced by attempt number, so a late push from the old attempt is refused.
- With no acknowledged checkpoint by 7 h 50 min, the VM is stopped and the step retries from the last acknowledged state.
Checkpoint notes are untrusted runner/model output (Fable M8). The resumed prompt labels the task, attempt and checkpoint digest, then carries each note as a JSON-quoted string. It keeps composer-origin person words in a separate block. Notes cannot change authority, tool policy or the continuation scope. The instance binds the pack digest and note digest to its recorded task, repository, base, candidate, attempt and launch ID before acknowledging them. A mismatched or unacknowledged checkpoint cannot resume work.
4. Snapshots
The base image is built from a pinned manifest: runner release, tool proxy, harness, toolchains and the pinned bubblewrap binary. It carries that binary itself, because Debian's current package no longer matches the pin.
A base image may never contain tokens, bootstrap codes, provider keys, OAuth homes, forge credentials, machine keys, SSH keys, a person's configuration, or any repository or task output. The /ready hook fails the build unless the runner state directory is empty, and CI scans the image inputs for secrets. Unique values are generated in the /run hook, because AWS documents that VMs from one image version share build-time state.
A suspended VM's snapshot holds one task's workspace and short-lived tokens. It never launches another VM and ends when the VM terminates.
5. Task-scoped tokens
| Token | Lifetime | Scope | Held by | | --- | --- | --- | --- | | Bootstrap code | 2 min, single use | One attempt and VM | /run payload | | Runner bearer | 1 h, renewable to the deadline | One job, worker role | Runner, outside the sandbox | | Gateway token | 15 min, renewable | One task, spend cap, allowed models | Runner, outside the sandbox | | Forge push token | 15 min, renewable | One repository and task branch | Not issued in slices 1 to 4 |
Issue. The run payload crosses AWS's control plane, so it carries only the bootstrap code. The runner calls a new POST /api/hosted/enrol with the code, the VM's ID and a new public key. This replaces device-code approval and the 30-day credential for hosted runners.
Renewal while running. The runner renews each token at half its lifetime and installs it atomically. Two code changes follow: Link must read the current bearer on each dial, because it copies it at startup today; and the harness must not hold the gateway token, because a 15-minute token cannot live in the launch environment of a 20-minute step. The harness calls a runner-side relay through its namespace socket, and the relay attaches the current token.
Renewal after resume. Each resume raises the job's epoch. The /resume hook makes the runner sign the instance's challenge with its machine key and fetch new tokens for that epoch.
Revocation and its limits. The epoch invalidates Equipo-issued tokens at once. A gateway token copied earlier stays usable until the gateway revokes it, within 60 seconds (G1). A replacement attempt starts only after that revocation is acknowledged or the token has expired.
Forge pushes. While a person has a personal primary, hosted workers return candidate packs and the primary publishes, as workers do today. The instance already refuses a worker that reports a push. The forge token is reserved for a later hosted primary.
No AWS credentials in the VM. With an execution role, the metadata endpoint gave any process the role's temporary keys. Without one it returned only region and tags. With no role AWS forwards no runtime logs, so logs travel over the runner stream.
6. Offline sandbox, dependency mirror and runner egress
Fable H3 (review of oficina/equipo main 449e9c14) changes the original egress proposal. Agent-chosen code stays offline in hosted mode, including dependency installers, build scripts, tests and shell commands. Bubblewrap creates a network namespace with no route, resolver, proxy socket or proxy credential. The hosted profile must not introduce a network exception to the personal-runner policy.
Dependencies arrive through a read-only mirror. A trusted process outside the sandbox stages immutable, hash-verified objects before the attempt, then mounts them read-only. Missing objects stop the build with an explicit dependency result; the sandbox cannot trigger an arbitrary URL fetch. A separate mirror service imports approved lockfile coordinates and digest-pinned toolchains from upstream. It offers no uploads, mutable tags, arbitrary query strings, credentials supplied by a task, or forward-proxy endpoint. Build lifecycle scripts run only inside the offline sandbox. Mirror writes and upstream credentials never reach a worker.
agent code -> read-only dependency mount (no network)
trusted runner/relay -> authenticated egress proxy -> exact approved service host
mirror importer -> approved upstreams (separate service and credentials)The deployment manifest records exact fully qualified hostnames and port 443 for the Equipo instance, model gateway and read-only mirror. The controller copies those literal values into each launch record and the proxy's per-VM policy. No suffix match or wildcard is permitted, including for CARLOS, the forge or a package registry. amadan.net is the only forge hostname, and is absent from worker egress while the personal primary supplies source and publishes candidates. Direct access to proxy.golang.org, sum.golang.org, registry.npmjs.org, pypi.org and files.pythonhosted.org is denied. Their dependency objects come from the mirror. The operator must choose and record the instance, gateway and mirror's exact deployment hostnames before certification; an unset name blocks launch. These are configuration requirements, not new deployed services.
The private subnet has no internet route. The VM security group allows only the fixed proxy and resolver addresses. enableDnsSupport is false on the VPC, since managed resolvers bypass security-group DNS filtering. Root init replaces the managed resolver mounts. The unprivileged runner cannot change them. The resolver answers only the launch record's exact service names; unknown names get NXDOMAIN. The sandbox cannot reach even that resolver.
Every VM authenticates to the proxy with a short-lived client certificate bound to launch ID, attempt, VM ID and epoch. It is minted against the controller's launch record, rotated on resume and held outside every sandbox. The connector's shared source address is never identity. The proxy verifies the certificate and current launch state before each request, revokes access on stop or epoch change, and records VM, task, attempt, destination, method, decision and byte counts. Logs contain no credentials, request bodies or model text.
SNI filtering alone is insufficient: domain fronting can use an allowed TLS name with a different encrypted HTTP Host or HTTP/2 :authority. The authenticated proxy terminates the runner's outbound service connection and checks that CONNECT target, TLS SNI, Host/:authority and the manifest destination agree. It originates TLS to that exact host, validates its certificate, and refuses redirects to other hosts, IP literals, missing SNI, encrypted ClientHello, alternate authorities and opaque nested tunnels. Each service also has fixed methods and path classes: the mirror is GET/HEAD only for approved object paths. The gateway relay accepts the model protocol only; arbitrary sockets are never exposed to agent-chosen code. This replaces the earlier TLS-passthrough and two-proxy proposal.
Production uses two proxies in two availability zones. The original spike tested only the weaker SNI-passthrough design; the new proxy and offline boundary need the certification tests below before any hosted model work.
7. The vm-boundary containment profile
The VM separates people. Bubblewrap still separates the agent's tools from the runner's tokens, using the same launch policy as personal runners.
The certified image has:
additionalOsCapabilities: ["ALL"]. With default capabilities bubblewrap cannot mount/proc, and 51 of 79 containment tests fail.- A root init that replaces the managed mounts, which otherwise stop the runner overlaying
/etc, and that reaps orphaned processes. - The runner as an unprivileged user with no capabilities.
- The bubblewrap digest pinned in the release manifest.
Certification is a release gate run in a real VM for each image digest. The full containment suite and the §14 egress matrix must pass, no AWS credential may be reachable, VPC DNS must be off, and the runner user must be unable to alter the resolver files or gain privileges. The gate signs the image digest, runner and sandbox policy digests, proxy policy version and dependency-mirror configuration. The controller verifies that certificate and records its digest with the exact image, VM reference, launch request, task, attempt and epoch before issuing an enrolment capability. Every hosted admission path, including ordinary checks, resolves that controller launch record and requires a matching current certificate. A runner's hello is diagnostic only; its self-reported profile or image digest cannot establish certification (Fable M8). Replaying another VM's hello, certificate or enrolment code must fail, as must an epoch or image mismatch.
Test-suite fixes first: exited must retry poll on EINTR; the two source-reading tests must run from the source tree; the delegated-cgroup test must skip where no user session exists (production containment does not use cgroups).
8. Hosted and personal runners together
- A hosted VM enrols as a worker bound to one job.
fits, authorisation and dispatch refuse it any other task, so it never joins the person's general pool. - The person's primary stays their personal runner. It must be online, because it relays the candidate as a pack and alone publishes the result. Workers hold no forge credential in any slice here, and slice 2 needs no model token either.
- Trigger: a project setting, off by default, runs checks in a hosted VM.
placereads it before today's early return for checks with no special needs. - Starting, draining and suspended VMs are exempt from offline withdrawal. The step shows a new
waiting_hostedplacement while its VM starts.
Slice 2 needs two changes to existing code. thin.Run starts the worker loop only on a Mac or the test fake, so Linux needs a checks worker built on the containment manager, with namespace proof. The instance also accepts only seatbelt from a worker and taints anything else, so it must accept bubblewrap from a certified hosted runner.
9. Connections
| Connection | Hosted? | Why | | --- | --- | --- | | Claude or Codex subscription, setup-token | No | Subscription credentials stay on the person's machine | | A person's own API key | No in v1 | Keys stay out of VMs, and the gateway resells the operator's account | | Platform gateway through the Pi harness | Yes, once built | OpenAI-compatible, short-lived token | | Claude Code or Codex through the gateway | No | They need APIs the gateway does not serve |
A person with only a subscription can use hosted checks. Their model work stays on their own runner.
10. Cost, limits and failure
AWS rates for Ireland, x86_64: 2 GB / 1 vCPU costs $0.155 an hour and 4 GB / 2 vCPU costs $0.310. A pause and resume costs $0.0057 per GB of snapshot. Use above baseline, up to 4x, costs extra.
Illustrative day for one active person, at baseline:
| Work | Cost | | --- | --- | | Three Engineering tasks, 45 min each at 2 GB | $0.35 | | Later coordinator at 4 GB: 40 turns of 2 min | $0.41 | | 40 pauses, assuming 4 GB written each time | $0.91 | | Total | $1.67, about $37 for 22 working days |
AWS does not report snapshot size, so the pause figure is an assumption, and a VM that has burst could write more. Budgets must also count launch reads, image storage and data transfer. The shared proxies add roughly $35 a month.
Default limits per person, enforced from slice 2: 2 running VMs, 8 VM-hours a day, $50 a month. At the limit, new work waits and says why. Confirm the applied account quota in the production account first. The dev account's is 2,048 GB of VM memory.
| Failure | Response | | --- | --- | | Launch throttled | Back off and stay in waiting_hosted | | VM does not enrol in 2 min | Stop it, retry once, then fail with a reason | | VM stops or resume fails | Prove it stopped, then start a new attempt from the checkpoint | | Token renewal fails | Stop the VM; never run on stale tokens | | Proxy down | Steps wait; nothing falls back to open egress | | Controller down | Running VMs continue; launches wait |
Leaked VMs. Every 60 seconds the controller compares List with its job table.
- An incomplete
Listskips the pass. - An attempt with a live launch intent is left alone; the controller replays it first.
- A VM with no matching job is stopped after 10 minutes, once ownership is rechecked.
- A VM past its deadline is stopped.
AWS's maximum duration is the backstop. A leaked 4 GB VM costs at most $2.48 at baseline, or $9.92 at sustained 4x.
11. Observability
The spike found no CloudWatch metrics for MicroVMs, so Equipo records its own.
- Metrics: launch-to-enrolled and resume-to-ready time, jobs by state, VM-hours and estimated cost per person, leaks stopped, renewal failures, proxy decisions.
- Logs and audit: runner logs over the stream, proxy decisions by name, and every lifecycle action with person, task and reason. CloudTrail data events stay on.
- Alerts: a leaked VM, VPC DNS switched on, no healthy proxy, or daily spend above twice the trailing average.
12. The inference gateway dependency
The gateway is designed but not built (2026-09-21-platform-inference-design.md, carlos/platform branch design-platform-inference). Carloku is the platform's flagship, so Equipo requests these from the platform instead of building its own:
| Need | Today's design | | --- | --- | | G1. Per-task tokens minted by the app: 15 min at most, renewable, revoked within 60 s with an acknowledgement | One static bearer per app | | G2. A spend cap per token, with usage by person and task | Balance per account | | G3. An exact stable hostname and protocol supported by the authenticated proxy | Needs confirming | | G4. Accepted fields that cover the Pi harness's requests | Strict parser, untested with Pi | | G5. A cut stream releases its hold correctly | Needs confirming |
Until it exists, hosted VMs run no model work, model work stays on personal runners, Equipo builds no relay to a provider, and no provider key enters a VM or the controller.
13. Rollout
Each slice ships behind a flag.
| Slice | Delivers | Depends on | | --- | --- | --- | | 1. Foundation | Adapter, controller, image pipeline, egress stack, certification gate, reaper, in the dev account | Paul's approval | | 2. Hosted checks | Checks in a bound VM, Linux worker, certified results, waiting_hosted, per-person limits | Slice 1 | | 3. Visibility | Cost display and project controls | Slice 2 | | 4. Hosted Engineering | Pi through the gateway, token relay, candidate packs back to the primary, checkpoint and handover | G1 to G5 |
A hosted coordinator is out of scope and needs its own spec. Coordinator lanes run only Claude and Codex today, and a hosted primary needs defined authority over routing, connections and publication. It would also need a short-lived, branch-scoped forge token, which the forge's CLI does not offer today.
14. Test plan
- Adapter contract: one suite runs against the fake and the AWS implementation.
- Lifecycle simulation: randomised launch, pause, resume, crash and expiry. Invariants: one live VM per attempt, nothing starts while draining, no Equipo token survives its epoch, no job outlives its deadline, and only one attempt publishes.
- Races: dispatch during pause, crash between launch and saving the VM ID, lost stop reply, late candidate from a replaced attempt, late acknowledgement of a cancelled pause.
- Tokens: replayed code, wrong VM, old epoch and revoked renewal are refused. A step runs past 15 minutes and 1 hour on renewed tokens.
- Egress matrix, in a real VM: only the trusted runner and model relay can use approved service routes. A sandboxed shell, dependency installer and build script cannot reach any host, resolver, metadata endpoint or relay network socket. A disallowed name, no SNI, direct IPv4 and IPv6, other proxy ports, each managed resolver and metadata credentials all fail.
- Slice 2 end to end: pack transfer, checks in the sandbox, certified report.
- Failure drills: kill the controller and proxy, stop a VM mid-step, plant an orphan.
- Cost: compare estimates with the first week's bill and real snapshot sizes.
15. Spike findings
Run on 2026-11-18 in Ireland, at 0.5 GB and x86_64, from oficina/equipo 449e9c14.
| Question | Result | | --- | --- | | Launch from a prepared image | 5 launches; first response at 2.3 to 3.2 s | | Image build; connector ready | About 2 min; about 4.5 min | | Real runner in the VM | equipo-runner version ran; not enrolled, no task | | Reach staging through the proxy | TLS 1.3, /healthz 200, runner stream with no credential 403 | | Suspend; resume | 2.0 to 4.0 s; 7 cycles, first response at 2.1 to 4.0 s | | State after resume | Memory, disk and a child process intact; clock within 12 ms | | Open connection after resume | Dropped, after 20 s and 200 s pauses; new connections work | | Disallowed name, no SNI | Refused by the proxy | | Direct IPv4, IPv6, other proxy ports | Timed out | | Source address seen by the proxy | One address for every VM | | Managed DNS, VPC DNS on | Leaked through four resolvers to an outside server | | Managed DNS, VPC DNS off | All four silent, on running and new VMs | | Metadata, no role | Region and tags only | | Metadata, with a role | Returned the role's temporary credentials | | Bubblewrap, default capabilities | Fails: cannot mount /proc | | Bubblewrap, ALL capabilities | Works, including nested; --unshare-net cuts the network | | Containment suite, final profile | 71 of 79 pass | | Idle policy with outbound traffic only | Suspended at about 70 s | | No idle policy supplied | None applied; maximum duration defaults to 8 hours | | Maximum duration 60 s | Terminated at about 64 s; 28,801 s is rejected |
The 8 containment failures: 5 need the codex binary, which the image left out; 2 read source files and fail the same way on a developer machine; 1 needs a systemd user session. TestNamespaceParentDeath passes only with the EINTR fix in §7, tried on a scratch copy.
Not proven: real enrolment or a task in a VM; those 5 Engineering tests; snapshot size; an 8-hour run or long suspension; many VMs at once; proxy failover; the two-proxy path.
Spike cost: estimated under $0.50, including the one-week minimum on image storage. Billing data had not arrived. Teardown: every resource was deleted and checked by type and by the purpose tag. AWS's tag index lagged; direct lookups confirmed the deletions.
16. Paul's rulings (2026-11-19)
Questions 2, 3 and 5 are approved as recommended.
- Which AWS account hosts production VMs? Ruled 2026-11-19: the unused organisation member account 149757027610, renamed
equipo-hosted. It is separate from every production account. - What are the default limits per person? Recommendation: 2 running VMs, 8 VM-hours a day and $50 a month, which an owner can raise.
- Should hosted checks ship before the gateway exists? Recommendation: yes. They need no model or forge token and prove the foundation.
- Registry egress: resolved by Paul's 2026-11-19 ruling. Agent-chosen code has no network in every project; the read-only mirror is required before hosted code runs. A trusted repository is not an exception.
- Should we request G1 to G5 from the platform now? Recommendation: yes. They decide when slice 4 can start.
17. Authority and prompt data (2026-11-19)
Paul approved these rules after Fable's prompt-injection review of oficina/equipo main 449e9c14. They apply equally to personal and hosted work.
- Model-written text is never the person's words. A tapped option the model wrote is a choice among model text, not a statement by the person.
- A change never authorises its own merge. Evidence the candidate can edit (its own checks, its own diff) is never trusted.
- Untrusted text enters a prompt only quoted, under a label naming its source.
- Anything an agent writes that leaves the system or opens in a browser needs the person's tap or a standing project setting they chose, plus deterministic checks. A private tailnet limits readers; it does not stop a page sending data elsewhere.
- A sandbox that runs agent-chosen code has no network. Dependencies come from a mirror.
For M4, the controller labels CI logs, Review findings, repository text, fetched pages and checkpoint notes by their actual source. Each value enters prompts as an escaped quoted string, with bounds recorded separately from content. Delimiter text inside a value cannot escape its framing. Composer-origin person words are kept separate from generated choices and agent summaries. Quoting conveys data; it cannot grant authority. Existing project settings govern actions without a new tap whenever their deterministic checks hold.
Before showing a preview, Equipo checks the Content-Security-Policy header on the served marker response against the exact policy it requires. A file in the artifact is not evidence that the browser received that policy. Equipo displays a verified preview through a sandboxed wrapper whose frame policy allows only that preview origin. The frame cannot open popups or navigate the parent, and the wrapper sends no referrer. If the served policy is missing or differs, normal preview access stays blocked. Opening it requires a warning and an owner's tap bound to the candidate and export digest, with a fresh secret scan before fallback publication. A public host also requires the project's public-preview setting.
Certification adds negative tests for H3, M4 and M8: network and DNS from build scripts; registry upload and cache-miss URL injection; absent, replayed or wrong-VM proxy certificates; wrong epochs; SNI/Host/:authority disagreement and fronting; redirects and encoded alternate authorities; checkpoint text containing prompt boundaries; checkpoint task/hash mismatch; and a hello claiming a certified image that differs from the controller's launch record. Each guard must first fail its mutation test, then pass after restoration. Record evidence with the signed image certificate. The 2026-11-18 spike does not certify these new requirements.