Repository navigation
fix: resume a session for messages that come as it stops - #73
Merged
Merged
Conversation
When an agent stopped for being idle just as a message came, before the session object knew it was stopping, the agent left the message and the session ended stopped with the message never handled, until someone sent another one. - A session whose agent stops on its own while messages wait in its outbox resumes for them. - Messages for a session that stops wait in the outbox for its next run instead of going to the agent that stops; an interrupt for one is dropped, since an interrupt kept for the next run could drop the messages that start it. - FleetDO marks a session stopping before it asks the host to stop it, so messages sent meanwhile wait for the next run too. Refs #56
This was referenced Oct 18, 2026
kalaspuff
pushed a commit
that referenced
this pull request
Oct 31, 2026
## Summary A session with many pull requests listed them in the order its agent found them, so the row in session lists, which cuts off what doesn't fit, could show only merged ones, and the rail's Pull requests section put the open ones at the bottom. Now open, draft and queued pull requests come first, then those whose state nobody has looked up yet, then merged and closed ones. Each group keeps the order the agent found them in. The session header's list of links uses the same order, since all three take it from the same function. I added a unit test for the order, ran `npm run check`, and looked at a dev session with ten pull requests in mixed states, staged in its SQLite, against `main`'s web app and this branch's. ## Screenshots At 8051709, dark theme. The row in the project's session list, before and after:   The session page's Pull requests section: | Before | After | |---|---| |  |  | ## Worth confirming - **Decision:** Pull requests whose state fctl doesn't know yet (nobody has looked them up on GitHub) come after open, draft and queued ones and before merged and closed ones, because they are usually new and so likely still open. - **Decision:** Within each group the order stays the one the agent found them in, not most recent first. [fctl session](https://app.fctl.sh/s/ses_01M67MYGPFQBTW30B1AYNJ5R2Q) <!-- FCTL_REVIEW_SUMMARY --> --- > [!NOTE] > **Low risk.** It only changes the order in which the web app lists a session's pull requests, with a unit test; no data or API changes. > > **What it does.** `pullRequests` now lists a session's open, draft and queued pull requests first, then those not yet looked up, then merged and closed ones, each group in the order the agent found them. Sessions with many pull requests therefore keep the ones still under way visible when a list cuts off its end. > > <sub>[fctl review](https://app.fctl.sh/s/ses_01M67NF732Z1C722BJ2SRBWNJB)'s first look at [`8051709`](8051709) · 2 files, +32 −3 · [Review agent settings](https://app.fctl.sh/p/fctl?tab=reviews)</sub> <!-- /FCTL_REVIEW_SUMMARY --> Co-authored-by: fctl-sh[bot] <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.
When an agent stopped for being idle just as a message came, before the session object knew it was stopping, the agent left the message (a stopping agent takes no messages) and the session ended stopped with the message never handled. Nothing resumed it until someone sent another message. #67 made idle stops ten minutes apart instead of two hours, so this window comes up more often. Draining a runner (#56) stops idle sessions too, and needs this to be right.
What changes
No protocol change, no host release: control plane only.
How I verified it
cargo xtask check --quick, and end to end withcargo xtask devand a 1-minute idle timeout:mainand fixed here. A script froze the host daemon (kill -STOP) 50 seconds into a session's idle minute, sentfctl send … "write race.md", and let the daemon go (kill -CONT) 75 seconds in. The message reached the session while it looked idle, and the agent stopped without taking it.mainthe transcript endsuser 'write race.md',stopping - Stopped after being idle,stopped - Stopped after being idle, and the session stays stopped.queued - Resuming,queued - Starting again once the last run has stopped,provisioning - Starting on dev-host, … and the agent handles the message.stopping - Stopping(FleetDO, first),stopping - Stopped(the agent), the message,queued - Resuming,Starting again once the last run has stopped, then the new run continues the same Claude conversation and handles the message. No delivery errors.fctl interrupt) leaves nothing in the transcript, and the next message runs in the new run as usual.Refs #56
Session: https://app.fctl.sh/s/ses_01M57HEJ5EHGT4SX0E3FZ86PPV