Repository navigation
Description
Restart of #3767 (FlyMachinesRuntime). The first attempt, #3784, works on real Fly but grew to about 5,400 lines and 36 review findings, mostly from reconciling two output paths (live logs and capture files). Build it fresh from the epic branch with the simpler design below. You may read #3784 for API details, but follow THIS spec where they differ.
Goal
PROPR_AGENT_RUNTIME=fly-machines (or an agent's runtime: fly-machines) runs a Claude Code or Codex agent run in an ephemeral Fly Machine booted from the propr/agent image (Dockerfile.agent), using the clone workspace transport and per-run credential copies, behind the AgentRuntime interface (packages/core/src/agents/runtime/types.ts). Model the structure on the merged Sprites runtime (spritesRuntime.ts, sprites/) and use the shared run pipeline (runPipeline.ts) for workflow markers, the cost cap, the watchdog and secret redaction.
Design (non-negotiable)
- One authoritative output path. The run writes stdout, stderr and an exit-status file to a run directory on the Machine. After the agent exits, the runtime reads those files through the Machines exec/file API, bounded (for example a 16 MiB cap per stream, truncating the start and saying so). Only these files feed the result, cost accounting and workflow markers, scanned in full once at the end. Live logs (Machines log API) are display only: best-effort, never reconciled, never used for accounting or status. If an output file cannot be read, the result is marked failed, with an explicit output-unavailable error, never success.
- One status file. The wrapper writes a single
statusfile atomically (temp file in the same directory, fsync, rename) withrunning, thenexited <code>. No multi-phase protocol. - Lifecycle. One Machine per run:
restart: no,auto_destroy: true, region and size from config.release()(or completion with nothing left to read) destroys the Machine right away. Keep no lingering Machine: the Free plan allows 3 Machines, and a stopped Machine counts toward that limit.stop(signal, timeout)signals the Machine; if it hasn't exited after the timeout, kill and destroy it. - Capabilities.
supportsExtensions: false(admission refuses extension runs),supportsBindMounts: false, and no restricted network (refused at admission) unless that's trivial. MCP is reachable over.internalwhen the control plane is on Fly; otherwisereachable-url. - Secrets. The Fly token never reaches the Machine or the logs. Credential files and secret env go in through the Machine config files and secret env, not the image or the logs.
- Size budget. About 1,500 lines of non-test code. Prefer small, flat modules: api client, config, launch and wrapper, handle.
Verified live on real Fly (keep these)
- Image by digest. A remote build on an app with no releases pushes by digest only, so the tag does not resolve. Document
PROPR_FLY_IMAGE=registry.fly.io/<app>@sha256:…and how to find the digest (the build'spushing manifest … @sha256:line). - Root, then drop to node. The image's default user is
node. Run as root via the Machine config'sprocesses: [{ user: 'root', entrypoint: [...], cmd: [...] }]. The entrypoint and cmd must be explicit; otherwise Fly runs the image default and reports a fake success in about 0.5 s. The wrapper then drops tonodethe way the Docker entrypoints do. - Git ownership. The
safe.directoryfix is already on the epic branch, inworkspaceTransportScript.ts. - Timings. About 25–50 s to create the Machine and pull the image; a stop via
handle.stop()took effect in 2.3 s with exit 143. The transport still saved its result bundle.
Acceptance
- Unit tests with a fake Machines API:
- the happy path;
- a failed output read gives a failed result;
stop()during a run gives exit 143, the Machine destroyed and the result bundle still readable before destroy;release()destroys the Machine;- status-file atomicity;
- extension refusal;
- a failing workflow hook fails the run (through the shared pipeline);
- the Fly token is never in the Machine env or logs.
- A live test, skipped without
PROPR_FLY_LIVE_TOKENandPROPR_FLY_LIVE_APP, covering the task and the stop. - Docs in
docs/docs/architecture/agent-runtime.md(config, digest image, Free-plan Machine limit) and.env.example. - In the PR description, list what still needs live verification. A maintainer will run the live Fly E2E before merge.
Activity
propr-dev commentedon Nov 25, 2026
🤖 AI processing has started for this issue using codex agent with gpt-6.2-astra model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
codexgpt-6.2-astra3798/gpt-6.2-astra-flymachinesruntime-restar-20261125-0640-gs13758-epic-runtime-abstraction-sc0issue-3798-20261125-0640-gpt-6.2-astra-gs1🔍 Track Task Execution
refactor: harden Fly runtime boot, polling, and cleanup handling
integry commentedon Nov 25, 2026
Done via #3801 (FlyMachinesRuntime restart), merged into the epic after live Fly verification.