Skip to content

Fly Machines: bake runtime packages into a derived agent image #3821

Done

Description

@integry

Split out of #3807 / PR #3816 so the runtime-packages work can merge without it.

Goal

On the Fly Machines runtime, bake the instance's runtime packages into a derived agent image once per (base image digest, package list), instead of installing them at every Machine start (#3816's behaviour). Every Machine then launches from the derived digest.

Starting point

The implementation from PR #3816 is kept on branch 3807-derived-fly-image-reference (cfbdeca). Main files:

  • packages/core/src/agents/runtime/fly/derivedImage.ts
  • fly/registry.ts
  • fly/wrapperBuild.ts
  • test/flyDerivedImage.test.ts

It uses a build Machine in the agent app to install, capture a layer, verify it against dpkg -L, and push to registry.fly.io, with in-process caching and capacity accounting.

Known requirements (from live runs and reviews on #3816)

  • R0 (live failure, fixed on the branch): the layer capture skipped files on an overlay root (device-number filter), so an 881-byte layer shipped and the agent got figlet: command not found. Keep the publish-time check: every dpkg -L file is present, and the layer is at least the installed size.
  • Capacity (F5, F13, R1):
    • a build Machine counts against PROPR_FLY_MACHINES_MAX and the org limit for as long as it may exist;
    • a lost create response or an unconfirmed delete keeps the slot until reconciled;
    • leftovers are found by name prefix at startup;
    • a run never has a build Machine and its agent Machine at once on the Free Plan.
  • Cache identity (F6, R3): a mutable base tag is re-resolved per run, and a derived digest whose tag or manifest disappeared is dropped and rebuilt.
  • Failures (R2): a failed apt build is cached per (base digest, list) with a backoff. Prevalidation against the Debian index runs only when a new build is needed (F12).
  • Fallback (F9): a failed build falls back to install-at-start from the original image, never a partially built one.
  • Deletes (R6): build Machine removal has its own retry window, independent of the build deadline.
  • Compute usage (R7): build wait and install are reported as their own fields, and wall time is measured from dispatch.

Acceptance

  • Live (fly-e2e.yml, agent_runtime=fly-machines):
    • the first run builds a derived image and the agent finds the package;
    • a second run with the same list reuses the digest, with no build Machine;
    • changing the list builds a new digest;
    • teardown leaves no Machines.
  • Unit tests for each requirement above.
  • Docs: the per-runtime package table in agent-runtime.md and the Fly tutorial.

Activity

  1. propr-dev commented on Nov 26, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: claude
    • Model: claude-opus-5-5
    • Branch: 3821/claude-opus-5-5-fly-machines-bake-runtime-20261126-2328-m2d
    • Base Branch: 3758-epic-runtime-abstraction-sc0
    • Worktree: issue-3821-20261126-2328-claude-opus-5-5-m2d

    🔍 Track Task Execution

  2. integry commented on Dec 1, 2026

    @integry
    OwnerAuthor

    Done in #3825, which merged into the runtime epic; the epic merged into main with #3774 and ships in 0.9.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions