Repository navigation
Description
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::uninstallincrates/fctl-host/src/service.rs) runslaunchctl bootout(macOS) orsystemctl --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), andrunner_authrefuses its token from then on, so the host can't connect again. - Scheduling (
FleetObject::candidatesincrates/fctl-control/src/do_fleet.rs,fctl_domain::schedule::pick) has anenabledflag onSlotthat is alwaystrue.
What should happen
- A runner can be drained: it keeps its connection and serves the sessions it has, but no new session starts on it. From the CLI with
--jsonand from the web app's runners list. (feat: drain runners so they take no new sessions #74) - The runners list and
fctl admin runnersshow a draining runner as such, with how many sessions it still runs. (feat: drain runners so they take no new sessions #74) -
fctl host uninstallsays when sessions are running on the host and what happens to them, and points to draining first. - machines should stop working on sessions that has completed about 10 minutes ago, where there's no new work to do. it would be great if work could be picked up again if there's any follow ups. (feat: stop idle sessions after ten minutes and resume them for a message #67)
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 uninstalldoes while sessions run: warn and go ahead, refuse without--force, or drain and wait for them?
Refs #46
Activity
fix: keep runners online and agents reachable when Docker hangs (#57)
fctl-sh commentedon Oct 18, 2026
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):
fctl projects set --idle-timeout), and their runner takes other work.fctl send,fctl attachor the API, on the Claude subscription the session ran on. Failed sessions still need their owner's Resume.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 uninstallsays). 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 whatfctl host uninstalldoes 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.
feat: stop idle sessions after ten minutes and resume them for a mess…
fctl-sh commentedon Oct 18, 2026
#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, whatfctl sendprints, 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:
fctl admin drain NAME; its host drains itself withfctl host drain, using the runner token. It is one shared state, shown with who drained the runner and when.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.fctl host uninstallwhile 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.fctl-sh commentedon Oct 18, 2026
Progress from https://app.fctl.sh/s/ses_01M57HEJ5EHGT4SX0E3FZ86PPV, following the decisions above:
fctl admin drain NAME, or from the machine withfctl host drain [--wait]/fctl host undrain.fctl admin runnersandfctl host statusshow who started the drain, when, and the sessions left.fctl host uninstalllists 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.
fctl-sh commentedon Oct 18, 2026
#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/undrainand the drain infctl admin runnersandfctl host statuscome with the next release. I ticked the first two items.#75 (the last item,
fctl host uninstall) now hasmainmerged in: it conflicted only where it builds on #74. It is mergeable, and its CI is green.