Skip to content

Sessions keep their conversation and uncommitted work when they resume on another runner #616

Done

Description

@fctl-sh

A stopped session resumes with Claude's whole conversation only on the runner that keeps its sandbox. On any other runner it starts over:

  • a new sandbox;
  • a fresh clone of its branch;
  • a new Claude conversation that knows only the session's original task.

Uncommitted work is gone too. On a fixed fleet of always-on machines that happens now and then. On an elastic fleet, where machines are retired when idle and replaced by new ones, it becomes the normal case. People see an agent that has forgotten what they discussed an hour ago, and it pushes organizations toward keeping machines up that they'd rather scale away. This is the piece that makes scale-to-zero and one-machine-per-session pools (#615) lose nothing.

How it works now

  • Where the conversation lives. Claude Code keeps it in the sandbox, at ~/.claude/projects/<working directory>/<session id>.jsonl, with subagents' files beside it.
    • fctl-agent resumes it with claude --resume when it finds it: conversation_exists in crates/fctl-agent/src/claude.rs.
    • Otherwise it sends prompt::fresh_resume ("your earlier conversation is gone", then the task; crates/fctl-agent/src/prompt.rs). The agent numbers its events after those the control plane has (first_agent_seq).
  • Where a resume goes. FleetDO remembers each session's home runner (sandboxes, in its storage; fctl_domain::schedule::Home).
    • A resume waits for that runner up to ten minutes while it is busy, and goes elsewhere when it's offline, removed, or no longer gives the sandbox the session asks for (docs/architecture.md#idle-sessions).
  • How long a stopped sandbox lasts. A host removes stopped sandboxes after keep_stopped_hours (72 by default), or sooner when its disk runs low (crates/fctl-host/src/expiry.rs, ADR 0019).
  • What reaches GitHub. Hosts push after each turn when push_on_commit is on, and agents push their work before a drain or a shutdown stops them (StopReason::Shutdown). Uncommitted files never leave the sandbox.
  • Autopilots already avoid resuming their own session this way, and hand off to a fresh session (An autopilot whose runner is gone resumes without a proper handoff #592, Fresh::Away). Ordinary sessions have nothing like it.

What should happen

  • Saving. As a session's sandbox stops (idle timeout, drain, uninstall, shutdown, stop), fctl-agent saves a snapshot:

    • the conversation file and its subagents' files;
    • Claude Code's todo list;
    • the working tree's uncommitted changes, as a commit on a hidden ref (refs/fctl/wip/<session>, never pushed to a branch people see) or a git bundle, with the paths of untracked files.

    It's compressed (zstd) and encrypted with a key of the session's that the control plane keeps sealed with the master key, so whoever stores it reads nothing. It is saved again at each stop, replacing the one before.

  • Storing.

    • By default in the control plane: the project's FilesObject, chunked as attachments are (ADR 0008: Durable Object storage, up to 10 GB a project), or /data on the standalone server.
    • Or in the organization's own S3-compatible bucket, set on the host ([snapshots] url = "s3://acme-fctl/sessions", with the machine's IAM role or workload identity). The control plane then keeps only where it is, its size and its checksum, and the session's code never leaves the organization's cloud.
  • Restoring. When FleetDO starts a resume on a runner other than the home one, the SessionSpec names the snapshot.

    • fctl-agent fetches it (through the host's uplink, or from the bucket), checks it, restores the files and the work-in-progress commit, and starts claude --resume.
    • The transcript says "Resumed on aws-7 with its conversation" (a notice).
    • A snapshot that can't be used (missing, too large, from a Claude Code version that can't read it, failing its checksum) falls back to today's fresh start, and the transcript says why.
  • Placement. With a usable snapshot, FleetDO stops waiting up to ten minutes for a busy home runner, and starts the resume on any runner that can take it. The home runner stays the first choice while it has room.

  • Limits and retention.

  • Docs:

    • docs/architecture.md (Idle sessions, A runner that goes away, Sandboxes and drivers);
    • docs/security.md (what's stored where, and how it's encrypted);
    • docs/self-hosting.md (the bucket setting);
    • fctl-site's privacy policy, since app.fctl.sh would store conversations it doesn't store today.

Notes on the design

  • The conversation format is Claude Code's, not fctl's, and can change between versions. The snapshot records the Claude Code version that wrote it, and the restore only uses it with the same or a compatible version. The sandbox image pins Claude Code, which helps.
  • Restore the work in progress as a commit, then reset it to uncommitted. Git then handles binary files, permissions and deletions, rather than a tarball of the tree.
  • The Kubernetes driver (A Kubernetes driver: one isolated sandbox per session in a company's cluster #617) keeps stopped sandboxes on volumes that survive their pod. Within one cluster it needs no snapshot, but snapshots still carry sessions between clusters and pools.

Design and UX

People shouldn't have to know runners exist for this to work: an agent picks up exactly where it left off, wherever it runs, and says so in one quiet line.

  • In the transcript. A notice styled like the runner notices that exist: "Resumed on aws-7 with its conversation and uncommitted work (12 MB)". When it couldn't, the notice says why and what the agent got instead: "Resumed on aws-7 without its conversation: it was saved by an older Claude Code. The agent has the task and the branch."
  • On the session page. The details rail shows where the session's last snapshot is and when it was saved, for those who look.
  • In settings.
    • Workspace admins see "Saved conversations: on, in Acme's bucket s3://acme-fctl/sessions" on the Runners tab, with the size used.
    • A host that can't write to its bucket shows in amber there, with the error.
  • For admins choosing where snapshots go, explain what is stored, where, and that it's encrypted, with a small diagram (sandbox → bucket or fctl), in the "pages that explain" style.
  • Follow hyperstructure/design's docs: docs/principles.md; docs/web-app/explaining.md for pages that set something up (a headline that names the outcome, a lead built from this place's facts, a preview of the result, one primary action, and who can act); docs/web-app/kit.md for controls.
  • Design every state before building it: the first visit, loading, errors and refusals, waiting, partial setups and long lists.
  • Say what happens, plainly, and never leave someone at a disabled control without saying who can act.
  • Prototype the main screens with realistic data (cargo xtask demo's world) and review them before building the rest.
  • Check both themes, a phone's width, the keyboard, screen readers and reduced motion, and show screenshots in each pull request.
  • Give the CLI the same care: readable output, --json, and errors that say what to do next.
  • Add or update the pages of hyperstructure/design's docs for each new component, with the reasons behind its choices.

Compatibility

  • Releases. Saving and restoring need a new fctl-agent and host. FleetDO offers a snapshot only to runners whose hello says they can restore one (a new optional feature flag), and otherwise resumes as today.
  • Protocol. SessionSpec gains an optional snapshot reference. Agents that don't know it ignore it and start fresh, as now.
  • Data.
    • A D1 migration for where each session's snapshot is.
    • Its encryption key is sealed with the master key, as other credentials are.
  • Privacy. app.fctl.sh would newly store conversations: docs/security.md#retention and fctl-site's legal/privacy.md change with it.

Decisions for a person

  • Default storage: the control plane (simplest), or nothing until a bucket is set (nothing new stored on app.fctl.sh).
  • Size limit: what it is, and whether to drop images from big conversations rather than give up.
  • Retention: whether snapshots follow transcript retention, or have their own.
  • Fresh resumes: whether a resume that finds no usable snapshot should hand off as autopilots do (An autopilot whose runner is gone resumes without a proper handoff #592), with a summary of the transcript, rather than start from the task alone.

Refs #592

Related: #615, #617, #623

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

Activity

  1. added
    enhancement
    host
    control-plane
    agents
    on Nov 23, 2026
  2. fctl-sh commented on Nov 23, 2026

    @fctl-sh
    ContributorAuthor

    Where this stands (from fctl session #1545): #636 does saving, storing in the control plane, restoring, placement, limits and retention, with the docs, and hyperstructure/fctl-site#138 the privacy policy.

    • As a sandbox stops, fctl-agent saves the conversation (with subagents' files, long tool results and todos) and each repository's unpushed work as a git bundle of a commit of the working tree, seals it with the session's own key (AES-256-GCM, the key sealed with the master key in D1), and its host uploads it before it reports the run ended; the session's SessionDO keeps the newest.
    • A resume in a sandbox without the conversation restores it, puts the work back uncommitted (or at refs/fctl/wip/<session> when the branch moved on), and says so in the transcript, or why it couldn't (older than the last run, a newer or other major Claude Code wrote it, damaged).
    • FleetDO doesn't make a resume with a snapshot to restore wait for a busy or gone home runner.
    • Defaults chosen for the decisions above: stored in the control plane; 200 MiB each (an instance setting), images dropped first, then the work; kept 30 days, a workspace setting of its own (1 to 365), rather than transcript retention; a resume without a usable snapshot starts fresh as before.

    Still to do: snapshots in an organization's own S3 bucket ([snapshots] url = "s3://…" on hosts), and the web app's part: the session's snapshot in its details rail, the settings in the workspace's and the admin's settings, and the page that explains where snapshots go.

  3. fctl-sh commented on Nov 23, 2026

    @fctl-sh
    ContributorAuthor

    #636 merged (fbf9309): sessions save an encrypted snapshot of their conversation and unpushed work as their sandbox stops, the control plane keeps it in the session's SessionDO, and a resume in a sandbox without the conversation restores it; FleetDO no longer makes such a resume wait for a busy or gone home runner. Workspaces keep snapshots for 30 days by default (1 to 365, or off), the instance up to 200 MiB each (or off).

    The control plane's part is deployed to app.fctl.sh. The agent's, the host's and the CLI's parts ship with the next release (no tag contains fbf9309 yet), and sessions save snapshots only once their hosts run it: hosts announce that they do, and older ones get no snapshot in their specs.

    I ticked Saving, Restoring, Placement and Limits and retention. The privacy policy (hyperstructure/fctl-site#138) is merged and live on fctl.sh. Storing stays open for snapshots in an organization's own S3 bucket, and Docs for that bucket's setting in docs/self-hosting.md.

    Left: that bucket option, and the web app's part (the snapshot in the session's details, the settings in the workspace's and the admin's settings, and the page that explains where snapshots go).

  4. fctl-sh commented on Nov 24, 2026

    @fctl-sh
    ContributorAuthor

    Where this stands (fctl session #1545). What's left is in these open pull requests, all green:

    Once those merge, Storing and Docs are done.

  5. fctl-sh commented on Nov 24, 2026

    @fctl-sh
    ContributorAuthor

    hyperstructure/fctl-site#140 merged (0f166da): fctl.sh/privacy now says what app.fctl.sh keeps of snapshots in an organization's own bucket. That is where each snapshot is, its size and checksum, the bucket's address, and the last error a runner met there.

    The bucket itself is still in #641, and the web app's part in #643, stacked on it. #641 is approved and green. While it waited, #637, #640, #642 and #638 took the ADR and migration numbers it had taken, so after four merges of main it now has ADR 0101 and migration 0076.

    The review agent's findings since then are fixed in #641:

    • requests to the bucket go again when S3 asks to slow down or a connection breaks;
    • a resume goes only to runners under its snapshot's prefix, not just its bucket;
    • the documented IAM policy has s3:ListBucket, so that a deleted snapshot reads as missing rather than refused;
    • a commit whose answer is lost keeps the object, and a retried commit still names the snapshot it replaced.

    Storing and Docs are done once #641 merges.

  6. fctl-sh commented on Nov 24, 2026

    @fctl-sh
    ContributorAuthor

    #641 (8fa95e6) and #643 (dce77c7) merged, and hyperstructure/design#79 with their design docs. That finishes this:

    I ticked Storing and Docs. The control plane's and the web app's parts are deployed to app.fctl.sh. The agent's, the host's and the CLI's ship with the release after v0.37.1, since no tag contains these commits yet. Nothing ran against a real S3, R2 or Google Cloud Storage bucket.

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

    agentscontrol-planeenhancementhost

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions