Repository navigation
feat: stop idle sessions after ten minutes and resume them for a message - #67
Merged
kalaspuff merged 2 commits intoOct 18, 2026
Merged
Conversation
Idle sessions held their runner's slot for two hours unless the project set another timeout, so busy runners filled up with sessions that did nothing and new work waited until someone stopped them by hand. - The default idle timeout is ten minutes. - A message to a stopped session resumes it, from every client and for anyone who may message the agent, on the subscription it ran on. A failed session still needs its owner's resume. - FleetDO remembers which runner last took each session and starts a resume there, where Claude's conversation is, waiting up to ten minutes while it is busy. - A resume waits for the last run to stop, and SessionDO ignores that run's late reports while the session is queued. Refs #56
fctl projects set --idle-timeout MINUTES sets how long a session that waits for a message keeps its sandbox and its runner's slot, and fctl projects show says when the project's idle sessions stop. Refs #56
3 of 4 tasks
kalaspuff
deleted the
fctl/29-let-s-get-started-on-https-github-com-hy
branch
October 18, 2026 13:51
This was referenced Oct 18, 2026
kalaspuff
pushed a commit
that referenced
this pull request
Nov 14, 2026
…ge (#546) ## Summary The spaghetti autopilot named "wake me when PR N merges" and "message session X when PR Y merges" as the most common reasons it wrote watcher scripts. Those scripts died at every handover. A crew session's pull request that merged or closed while the session rested (its turn ended, it stopped or failed) told the autopilot nothing until its check-in, up to a day later. That hit hardest without the merge power, where people merge, and with a session held back until another's merge. Now, when GitHub says such a pull request merged or closed, SessionObject wakes the autopilot. It's gathered a minute like other crew wakes, whoever merged it. It counts the session as changed so that the wake lists it, with `#67 merged` in its line. A session at work, one waiting for its background work, or one just messaged (which counts among those at work until its runner reports) doesn't wake it this way: its turn's end does, with the pull request as it stands. The briefing says so where it talks about merging, and the shared-layout lesson no longer suggests a script to wait for the first merge. I verified it with unit tests on the rule (which statuses wake, only a pull request that newly ended) and in `cargo xtask dev`, through a temporary route standing in for GitHub's webhook. With the autopilot resting, nothing at work and its crew session stopped, marking that session's pull request merged scheduled a wake at once. A minute later the wake listed the session as `stopped (a message resumes it); pull requests #67 merged`. ## Related pull requests - #544 - #545 ## Worth confirming - **Decision:** a closed pull request wakes it too, not only a merged one: the work it waited for won't land. - **Decision:** the merge bumps the crew session's `updated_at`, which the wake's news selects by, so the session also shows as recently changed in lists. This applies only to sessions an autopilot started. [fctl session](https://app.fctl.sh/s/ses_01M7DQEXFV9KNC4CY8ZZZ2KHZH) <!-- FCTL_REVIEW_SUMMARY --> --- > [!NOTE] > **Medium risk.** It changes when autopilots are woken and bumps a session's `updated_at` from the pull request refresh path, which the working-session count in `CREW_WORKING` reads. > > **What it does.** Wakes an autopilot as soon as a pull request of one of its crew sessions merges or closes while that session rests (idle, stopped or failed), instead of at its next check-in. A session that is working, waits for background work, or ended its turn and was just messaged is left to wake the autopilot when its turn ends. The briefing text and docs now describe this. > > **Working-count interaction.** The wake sets `updated_at` on the session, which is why an idle session with a newer message is skipped: `CREW_WORKING` counts it at work by `messaged_at >= updated_at`. > > <sub>[fctl review](https://app.fctl.sh/s/ses_01M7DVSB36B7ZZ80H2ZN279X7A)'s first look at [`86494b4`](86494b4) · 5 files, +154 −7 · [Review agent settings](https://app.fctl.sh/p/fctl?tab=reviews)</sub> <!-- /FCTL_REVIEW_SUMMARY --> --------- Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A session holds a slot on its runner from the moment it starts until its sandbox stops. A session that finished its turn and waited for a reply kept that slot for its project's idle timeout, two hours by default, so busy runners filled up with sessions that did nothing, and new work waited until someone stopped them by hand. This does the last item of #56: idle sessions stop after about ten minutes, and a follow-up picks the work up again.
What changes
fctl_domain::settings(DEFAULT_IDLE_TIMEOUT_MINUTES), andfctl projects set --idle-timeout MINUTESsets a project's own (fctl projects showprints it). The web app's field shows the new default with a line about what it does.fctl send,fctl attachand the API, for anyone who may message the agent. Before, only owners typing in the web app could resume one this way;fctl send,fctl attachand editors got "The session has ended. Resume it to continue." SessionObject queues the session when it stores the message, and the new run gets the message from the outbox. The run uses the Claude subscription the session ran on, as a message to an idle session does. Resume (owners,fctl resume) still runs it on the resumer's subscription, and is still the only way to start a failed session again. Messages to a failed session get "The session failed. Resume it to continue.", and editors see that note in place of the composer.sandboxestable in its storage) and starts a resume there. While that runner is full, the session waits for it ("Waiting for studio, which has this session's sandbox") for up to ten minutes, then starts elsewhere. It starts elsewhere right away if the runner is offline or too small for the session's size now. This applies to Resume too.docs/architecture.md(a new "Idle sessions" section),docs/getting-started.md,docs/cli.md, and ADR 0013 records the decisions.Choices a reviewer may want to weigh in on
Compatibility
Control plane only: no protocol change, no migration (FleetDO's new table is created with
IF NOT EXISTS), no host release needed. Hosts already stop idle sessions with the timeout in the spec, and a resume on the same host already restarts the stopped sandbox. The new default applies to sessions that start or resume after the deploy; running ones keep the timeout they started with. The fresh-resume prompt change reaches hosts with the next release.web/src/genchanges only in doc comments.How I verified it
fctl_domain::schedule(a resume goes to its runner when it has room, waits for it when full andwaitis set, starts elsewhere when it's offline, gone or too small),fctl_domain::settings(the default), fctl-agent's fresh-resume prompt.cargo xtask checkpasses.cargo xtask dev, a second process-driver host (dev-host-2, capacity 1) and a 1-minute idle timeout:fctl send playground#1 "write notes.md"printed✓ Sent to playground#1; the session resumes for it. It started on the same host within a second, and Claude'sinithad the samesession_idas before (a9f40ebd…), so the conversation continued. It wrote and committednotes.md.fctl stop, thenfctl sendstraight away: the session showed "Starting again once the last run has stopped" for about six seconds, then started. No "stopped" from the old run reached the transcript in between, and the conversation continued.dev-host, a message to a session whose sandbox was ondev-host-2started it ondev-host-2, same conversation.dev-host-2full anddev-hostfree, the session waited ("Waiting for dev-host-2, which has this session's sandbox") untildev-host-2freed up a minute later, then started there.dev-host-2held for longer, it waited ten minutes and then started ondev-hostin a new sandbox ("The earlier conversation went with the old sandbox; Claude starts a new one on the branch").crashfour times):fctl sendgotThe session failed. Resume it to continue., and the editor saw the note instead of the composer.Screenshots
I took these with Playwright against
cargo xtask dev,mainbeside this branch, but this session can't attach images to the pull request (#40). What they show, at 1440 px unless noted:Left for later
Draining a runner and what
fctl host uninstallsays (the first three items of #56) need the decisions listed in the issue, so they are not part of this pull request.Refs #56
Session: https://app.fctl.sh/s/ses_01M57HEJ5EHGT4SX0E3FZ86PPV