Skip to content

Hosts can't stop taking new sessions without dropping the ones they run #56

Closed

Description

@fctl-sh

What is missing

There is no way to take a host out of rotation and still serve the sessions it runs. To stop new sessions going to a host (for maintenance, or because its disk is filling up), the tools are fctl host uninstall and disabling its runner, and both drop the sessions it runs: their agents keep working in their sandboxes, nothing of it reaches the app, and ten minutes later the fleet stops them ("Runner now has been offline for 10 minutes. Resume the session to continue elsewhere."). That may be what stopped the session in #46, whose host had fctl host uninstall run on it so that it would take no more sessions.

How it works now

  • fctl host uninstall (crates/fctl/src/cmd/host.rs, service::uninstall in crates/fctl-host/src/service.rs) runs launchctl bootout (macOS) or systemctl --user disable --now (Linux) and removes the job, so the host process stops and nothing starts it again. Its help says "Stop and remove the service (sandboxes are kept)", and it prints "Removed the service. Configuration and sandboxes are kept.", with nothing about the sessions that are running.
  • Disabling a runner (PATCH /api/v1/runners/{id} with "enabled": false, crates/fctl-control/src/api/runners.rs) asks FleetObject to close its connection (/runner-disabled, close code 4003), and runner_auth refuses its token from then on, so the host can't connect again.
  • Scheduling (FleetObject::candidates in crates/fctl-control/src/do_fleet.rs, fctl_domain::schedule::pick) has an enabled flag on Slot that is always true.

What should happen

Compatibility

Deciding it in the control plane needs a migration (a column on runners) and no host release. If the host can drain itself (fctl host drain on the machine), the hello and heartbeats need a new optional field, which older control planes ignore.

Decisions for a person

  • Who drains a runner: an admin in the control plane (like enabling and disabling it), its owner on the machine, or both?
  • Does a resume of a session whose sandbox is on a draining host start there (keeping its sandbox and Claude's conversation) or elsewhere?
  • What fctl host uninstall does while sessions run: warn and go ahead, refuse without --force, or drain and wait for them?

Refs #46

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

Activity

  1. added
    enhancement
    host
    control-plane
    cli
    on Oct 18, 2026
  2. fctl-sh commented on Oct 18, 2026

    @fctl-sh
    ContributorAuthor

    Progress from https://app.fctl.sh/s/ses_01M57HEJ5EHGT4SX0E3FZ86PPV

    In review: #67, for the last item (machines stop working on sessions that finished about ten minutes ago, and follow-ups pick the work up again):

    • Idle sessions stop after ten minutes unless the project sets another timeout (web app, or fctl projects set --idle-timeout), and their runner takes other work.
    • A message to a stopped session resumes it, from the web app, fctl send, fctl attach or the API, on the Claude subscription the session ran on. Failed sessions still need their owner's Resume.
    • A resume goes back to the runner that has the session's sandbox, so Claude continues the same conversation. It waits up to ten minutes while that runner is busy, then starts elsewhere in a new sandbox.

    I'll tick that item once #67 is merged and checked.

    Still open: the first three items (draining a runner, showing draining runners with the sessions they still run, and what fctl host uninstall says). They wait on the three decisions in the issue: who drains a runner, where a resume of a session whose sandbox is on a draining host starts, and what fctl host uninstall does while sessions run.

    For the second decision: since #67, a resume goes back to the runner that has its sandbox whenever that runner is online and has room. Draining needs a rule for that: either a draining runner still takes resumes of the sessions whose sandboxes it has, or it takes none and they start elsewhere without their conversation.

  3. fctl-sh commented on Oct 18, 2026

    @fctl-sh
    ContributorAuthor

    #67 is merged and deployed to app.fctl.sh: idle sessions stop after ten minutes, a message resumes a stopped session, and a resume goes back to the runner that has its sandbox. Its CLI and fctl-agent parts (fctl projects set --idle-timeout, what fctl send prints, the prompt for a resume in a new sandbox) come with the next release. I ticked the last item.

    The person who started https://app.fctl.sh/s/ses_01M57HEJ5EHGT4SX0E3FZ86PPV decided the open questions:

    1. Who drains a runner: both. Admins drain it from the runners list and with fctl admin drain NAME; its host drains itself with fctl host drain, using the runner token. It is one shared state, shown with who drained the runner and when.
    2. A resume of a session whose sandbox is on a draining host starts there, with its sandbox and Claude's conversation, until the host is being removed (fctl host uninstall). Idle sessions on a draining runner stop right away instead of after the idle timeout, so the runner is empty whenever no turn runs, and a message resumes them there.
    3. fctl host uninstall while sessions run lists them, says what happens, and asks before stopping them. Without a terminal it refuses unless given --wait (drain, wait until none run, then uninstall) or --force (stop them through the control plane, so their agents stop and push their work, then uninstall). Their next resume starts on another runner.

    Also decided: Disable and Remove in the runners list ask first when sessions run, and point to Drain.

    Next: draining (the first two items) in one pull request, then fctl host uninstall (the third) in another.

  4. fctl-sh commented on Oct 18, 2026

    @fctl-sh
    ContributorAuthor

    Progress from https://app.fctl.sh/s/ses_01M57HEJ5EHGT4SX0E3FZ86PPV, following the decisions above:

    • fix: resume a session for messages that come as it stops #73, merged: a session whose agent stops for being idle just as a message comes now resumes for that message. Before, the message waited until someone sent another. Messages for a session that stops wait for its next run. This was groundwork for draining, which stops idle sessions too.
    • feat: drain runners so they take no new sessions #74, in review: the first two items. A runner drains from the runners list (Drain, Stop draining), with fctl admin drain NAME, or from the machine with fctl host drain [--wait] / fctl host undrain.
      • No new session starts on a draining runner. Its sessions carry on, and a follow-up resumes them there.
      • Its idle sessions stop after a minute.
      • The runners list, fctl admin runners and fctl host status show who started the drain, when, and the sessions left.
      • Disable and Remove ask first, and offer Drain.
    • feat: ask before fctl host uninstall stops the sessions on a host #75, in review (stacked on feat: drain runners so they take no new sessions #74): the third item. fctl host uninstall lists the sessions on the host, says what happens to them and asks. Without a terminal it needs --wait (drain, then uninstall once none runs) or --force. Stopping goes through the control plane, so agents push their work and the sessions resume elsewhere.

    I'll tick the first three items once #74 and #75 are merged and checked.

  5. fctl-sh commented on Oct 18, 2026

    @fctl-sh
    ContributorAuthor

    #74 is merged and deployed to app.fctl.sh. Draining, the runners list's Drain / Stop draining and its confirmations are live, and so is the API. fctl admin drain/undrain, fctl host drain/undrain and the drain in fctl admin runners and fctl host status come with the next release. I ticked the first two items.

    #75 (the last item, fctl host uninstall) now has main merged in: it conflicted only where it builds on #74. It is mergeable, and its CI is green.

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

    clicontrol-planeenhancementhost

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions