Skip to content

Custom sandbox images for projects and hosts #16

Closed

Description

@fctl-sh

Sessions need tools the default image lacks: Rust, .NET, a pinned TypeScript toolchain, company CLIs, Claude Code skills and plugins. Today the options are a setup script that installs them in every session, or an image you build and document yourself. This project has no setup script, so a session working on fctl installs rustup and builds from cold. That took about 6 GB of disk in #14's session.

Part of this exists:

  • Per project: image in the project settings (Settings → Sandbox image), which maintainers and owners can change. The host uses it instead of its default (crates/fctl-host/src/session.rs), and the Apple and Docker drivers pull it when it's missing (crates/fctl-host/src/driver/container.rs).
  • Per host: the default image, fctl-agent:latest, set with fctl host install --image and built from images/agent by fctl host image build [tag].
  • The contract is one sentence in images/agent/README.md: sh, tail, git and Claude Code on the PATH. fctl copies its supervisor (a static musl binary, so any libc works) into /opt/fctl/bin as root and runs it as the image's user, in ~/workspace.

#2 publishes the default image so custom images can start FROM it. This issue covers the rest, and can land in parts.

What should happen

  1. Write the contract down in a "Sandbox images" page in docs/:
    • Required tools: the ones above, plus gh (fctl-agent uses it to find the session's pull request and silently does without).
    • A non-root user with a writable home.
    • Architectures: Apple silicon hosts need arm64 images.
    • The oldest Claude Code version fctl works with, because it relies on stream-json control requests (oauth_token_refresh, remote_control). fctl-agent should check claude --version at start and fail with a clear message below it.
    • What fctl writes into the sandbox (see 3).
    • A worked example FROM the published image that adds Rust.
  2. CLI. Project settings can't be changed from the CLI: fctl-client has update_project, but fctl projects has no command for it. Add fctl projects settings <project> [--image …] [--setup-script …] [--env KEY=VALUE …] with --json.
  3. Keep the image's Claude configuration. write_claude_config (crates/fctl-agent/src/supervisor.rs) overwrites ~/.claude/settings.json, so an image's user settings (enabled plugins, marketplaces, hooks, permissions) are lost. Skills in ~/.claude/skills survive. Merge fctl's keys into what the image ships, and drop apiKeyHelper and ANTHROPIC_* entries in env (the rules in project_settings_are_unsafe). Skills committed to the repository (.claude/skills) already load.
  4. Build from the repository. Many repositories already describe their environment in a Dockerfile or .devcontainer/devcontainer.json. A project setting pointing at one would let hosts build the image, cache it per project, and rebuild it when the file changes on the base branch. Builds run on people's machines, so they need limits and a size bound (see Shared package caches per project #3).
  5. Let host owners decide what runs.
    • The risk: a maintainer's image runs on machines that belong to other people, with the starter's Claude token and the session's GitHub token inside it. A full login's token is short-lived, but a long-lived token from claude setup-token is valid for a year.
    • Add allowed_images to the host config: exact references or registry prefixes, optionally pinned to digests.
    • The host advertises the list as an optional field when it connects. FleetDO schedules sessions only on hosts that allow their image, and a session no host can run says why ("No host runs images from ghcr.io/acme").
    • docs/security.md should say that whoever sets the image or the setup script can read the credentials of the people who start sessions.
  6. Show it in the app. The hosts page shows each host's default and allowed images. The image setting's hint says it only applies to the Apple container and Docker drivers: Lima uses its prepared fctl-base VM, and the process driver has no image.
  7. Private registries. Pulls use the host's own registry login (docker login, container registry login). Document that, or decide to pass registry credentials from project secrets.

Compatibility: new settings are optional fields in ProjectSettings, and a host that doesn't know about allowed_images behaves as it does now.

🤖 Generated with Claude Code

https://app.fctl.sh/s/ses_01M560YQN20DK06NSEWWVYB3Q4

Activity

  1. added
    host
    web
    cli
    agents
    on Oct 17, 2026
  2. fctl-sh commented on Oct 18, 2026

    @fctl-sh
    ContributorAuthor

    For point 2 (fctl projects settings): #19 asks for --connectors on|off on that command, setting ProjectSettings.claude_ai_connectors, which #32 adds. Since an update replaces all settings, read the project first and send its settings back with your changes. #32 keeps the stored claude_ai_connectors when an update leaves it out, but other fields have no such guard.

    Session: https://app.fctl.sh/s/ses_01M564VCYM35Z4JVYCMFQ73EZ6

  3. fctl-sh commented on Oct 18, 2026

    @fctl-sh
    ContributorAuthor

    For point 1: #39 (for #2) adds docs/sandbox-images.md, the "Sandbox images" page. It has:

    • the published image, its tags and labels, and how hosts get it;
    • its layout, which images built FROM it can rely on (the agent user with uid 1000 and passwordless sudo, ~/.local/bin and /opt/fctl/bin first on the PATH, the tools), checked on every build by images/agent/check.sh;
    • under "Other images", the contract that was in images/agent/README.md: sh, tail, git and Claude Code on the PATH, plus a user with a writable home (fctl-agent writes ~/.fctl) and arm64 images for Apple silicon hosts;
    • a minimal FROM example that installs a package as root and switches back to agent.

    Point 1 still needs gh among the required tools, the oldest Claude Code version (and fctl-agent's check of it), what fctl writes into the sandbox (point 3), and the worked example that adds Rust.

    Session: https://app.fctl.sh/s/ses_01M56C4589JCHJ2W8TXC8V2S4P

  4. fctl-sh commented on Oct 18, 2026

    @fctl-sh
    ContributorAuthor

    On the tools the default image lacks: #45, released in v0.3.0, adds Rust 1.99.0 (rustup, with rustfmt, Clippy and wasm32-unknown-unknown, matching rust-toolchain.toml), Python 3.15.0 with uv 0.13.1, TypeScript 7.0.2 and Bun 1.4.3 to images/agent. A session working on fctl no longer installs rustup before it builds. The image's own README lists everything it contains.

    It doesn't do any of the numbered items here; .NET and company CLIs still need a custom image.

    Session: https://app.fctl.sh/s/ses_01M56D7AEK3XQYQJH6TQXYMDZ5

  5. fctl-sh commented on Oct 18, 2026

    @fctl-sh
    ContributorAuthor

    Checked what was left here; #88 does the rest, and hyperstructure/fctl-site#16 updates the privacy policy to match.

    Already done before: point 1 in part. #39 added the "Sandbox images" page: the published image, its layout, and the FROM contract.

    Done in #88 (open, CI running):

    1. The contract. The page lists gh, a non-root user and both architectures. Claude Code must be 2.1.101 or later, the first release that asks its host for fresh OAuth tokens (oauth_token_refresh; remote_control came in 2.1.63). fctl-agent checks claude --version at start and fails with a clear message below it. The page also covers what fctl writes into a sandbox, and has a worked example that adds .NET; Rust has been in the default image since feat: add Python 3.15, Rust, Bun and TypeScript to the sandbox image #45.
    2. CLI. fctl projects set takes --image, --build, --build-context, --setup-script, --env, --unset-env, --cpus and --memory. I added them to set, which already existed, rather than a new settings command.
    3. Claude settings. fctl-agent merges its keys into the image's ~/.claude/settings.json, and drops apiKeyHelper, ANTHROPIC_* and provider variables.
    4. Builds from the repository. The new image_build setting names a Dockerfile or devcontainer.json.
      • Hosts that allow it build from the default branch, keyed by the file, the Dockerfile and the build directory's tree.
      • Limits: one build at a time, build_timeout_minutes, max_build_mb. Hosts keep the newest build per project.
    5. Host owners decide. allowed_images and allowed_builds in host.toml reach FleetDO as optional hello fields. Sessions wait with a reason when no runner allows their image. docs/security.md covers the risk.
    6. The app. Settings → Sandbox → Image chooses an image or a build; its hint names the drivers that use images. Admin → Runners shows each runner's image and lists.
    7. Private registries. Hosts use their own registry login, and the docs say so.

    Left once it merges:

    • A real build on a Docker host and on a Mac with Apple container. The session that built this had neither runtime: the builds were tested against a stand-in docker and a fake GitHub only.
    • Decisions for a person:
      • Should new hosts run only their own image unless their owner allows more? The default stays "any image", so that upgrading no host stops sessions.
      • Should registry credentials come from project secrets?
      • Should fctl install dev container features (that needs the Dev Container CLI)?

    Session: https://app.fctl.sh/s/ses_01M57YPG1ATK9ARAXTZG43G51J

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

    agentsclihostweb

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions