Repository navigation
fix(control): keep events that newer ones overtook after a reconnect - #70
Merged
Merged
Conversation
After a link to the agent or an uplink closed, the agent could send newer events over the new link before the host's replay of the older ones. SessionDO stored the newer ones, acknowledged them, and then dropped the replayed older ones as already stored, so they never reached the transcript, and the agent's journal was told it could forget them. SessionDO now stores events in agent_seq order: one that skips ahead waits for the replay that follows every reconnect, for at most a minute, so that a journal that lost events can't stop the transcript for good. Refs #46
This was referenced Oct 18, 2026
kalaspuff
pushed a commit
that referenced
this pull request
Nov 11, 2026
#511) ## Summary An autopilot now looks after the sessions people start in its project (or workspace) too, not only its own. Its brief (`fctl autopilot brief`) gains a *People's sessions* section: the ones at work and the ones resting with a pull request still open, with who started each, how long ago its agent last worked and how its pull requests' checks stand. Its wake messages carry the ones that ended a turn with a pull request open, without waking it for them. The briefing tells it those sessions are theirs (it never messages, stops or takes one over), to plan around them, and once one looks ready or stuck, to ask people with `fctl autopilot ask` whether it should help get it merged; if they say yes, it starts a session of its own to bring the pull request up to date, resolve conflicts, get checks passing and merge it (or ask people to merge it, without the merge power), and notes the answer in its plan so it doesn't ask again. Review agents' and archived sessions stay out. An autopilot's own session now opens its sidebar (the details sheet on a phone) with the autopilot, as its tab shows it: where it stands, with *Wake now* / *Pause* / *Resume* for those who steer it and what it asks (each opens the tab to answer), its plan with its progress, and the sessions it started. In an earlier session of its own it says which one fctl wakes it in now. Changes show only once that session changed something, and the retrospective and memory sections stay out there. The tab's "Updated now ago" now says "Updated just now". I checked it in `cargo xtask dev`: a person's session with an open pull request (set in local D1, as dev has no GitHub) showed in the autopilot's brief while one without stayed out; another ending a turn with a failing check showed in the next wake message (below); and the screenshots are from the autopilot's own session there. `cargo xtask check --quick` passes, with new tests for the brief, the wake message, the briefing, the pull request lines and the session page. ```text People's sessions that ended a turn with a pull request open (theirs: ask people before you help get one merged): - playground#2 “Gift cards”, Dev Owner's: ended its turn just now; pull request #70 (open, 1 check failed) ``` ## Screenshots An autopilot's own session's sidebar, before (Changes, Retrospective and Memory, all empty) and after:   The light theme, and the details sheet on a phone:   ## Worth confirming - **Decision:** The autopilot always asks before it helps with someone else's pull request, and helps through a session of its own on its owner's subscription rather than by messaging the person's session, which would spend that person's plan and steer a session it didn't start. - **Decision:** People's sessions don't wake the autopilot; they come with its next wake (at the latest its check-in), as you said it should look "occasionally". - **Decision:** Its asks still notify the people who follow its own session (its owner among them), not the person who started the session it asks about. - **Decision:** The sidebar shows the plan and its sessions but not its direction, notes or log, which stay a click away on its tab (↗ in the card's corner), to keep the sidebar short. The design docs for the sidebar: - hyperstructure/design#43 [fctl session](https://app.fctl.sh/s/ses_01M7552J9TNXXFJCK69CQMN7H3) <!-- FCTL_REVIEW_SUMMARY --> --- > [!NOTE] > **Medium risk.** It changes what an autopilot's brief, wake messages and briefing tell the agent, so its behavior toward people's sessions and pull requests changes, and adds new SQL over sessions; the web part is a contained UI addition. > > **What it does.** An autopilot now lists the sessions people start in its project or workspace (at work, or resting with a pull request open) in its brief and wake messages, and its briefing tells it to ask people before helping get such a pull request merged. An autopilot's own session now shows its autopilot, plan and sessions in the details rail, reusing the controls from its Autopilot tab, and the plan's update time now reads "just now" rather than "now ago". > > **Autopilot briefing.** The briefing now instructs autopilots to look after people's pull requests and ask before starting sessions to merge them. > > <sub>[fctl review](https://app.fctl.sh/s/ses_01M756GF3HQSDW9NF5NBEBY3X5)'s first look at [`f667e44`](f667e44) · 16 files, +901 −140 · [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.
Testing #69 I froze a session's fctl-agent in the middle of a tool call and let it go again, and the tool's result never reached the transcript, though it was in the agent's journal and the journal replayed it. Events that newer ones overtook after a reconnect were dropped for good.
Why. When the host's link to fctl-agent breaks, the events the agent sends over it are lost and come again with the replay the host asks for on the next link. But the agent sends new events over a new link as soon as it connects, and the host's
Replayarrives a moment later. So SessionDO got, say, events 9 and 10 live, then 8, 9 and 10 from the replay. It stored 9 and 10, moved the acknowledgedagent_seqto 10, and skipped the replayed 8 as already stored. Its acknowledgement also told the agent it could drop 8 from its journal. The same happens when an uplink reconnects during a turn, which every deploy does: the uplink drops the events it can't send, the Welcome brings a replay, and newer events can overtake it.What changed. SessionDO stores events in
agent_seqorder (fctl_domain::journal). An event that skips ahead is not stored or acknowledged: it waits for the replay that follows every reconnect, which brings the missing events and then it again. Every fctl-agent numbers its events one after another, and a resumed session's new sandbox starts right after what SessionDO has, so a skip means lost events. Should they never come, because a journal has lost them, SessionDO stops waiting after a minute and goes on without them, so the transcript doesn't stop for good. Both cases are logged.The control plane alone fixes it, for every host and agent already out there. An agent that held new events until the host's
Replaywould avoid sending them twice, but it would reach sandboxes only as their agents restart.How I verified it
journal::tests.cargo xtask check --quick.cargo xtask dev, playing a host's side of a session's uplink with a script while the dev host was stopped (SIGSTOP), so it didn't take the uplink back: with 11 events stored, the script sent events 13 and 14, as a new link does before the replay, then the replay of 12, 13 and 14.maindoes): SessionDO stored 13 and 14 and acknowledged 14; 12 was lost.agent_seq 13 came before 12: waiting for the host's replay.agent_seq 12 to 14 never came; going on without them.Refs #46
Session: https://app.fctl.sh/s/ses_01M57HG0XSAWK0CZXYRTVFZBV4