Skip to content

feat(autopilot): hold its messages until its session limit has room - #556

Merged
kalaspuff merged 7 commits into
mainfrom
fctl/1291-let-an-autopilot-s-messages-wait-for-roo
Nov 15, 2026
Merged

kalaspuff merged 7 commits into
mainfrom
fctl/1291-let-an-autopilot-s-messages-wait-for-roo

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An autopilot's message to one of its sessions that rests no longer fails while as many of its sessions work as its people allow. The control plane keeps it in D1 (autopilot_held) and sends it as soon as one of its sessions ends its turn, stops or fails, those held going out in the order the autopilot sent them. This replaces the send-when-free.sh scripts autopilots wrote to poll fctl send, which a fresh session lost at each handover. ADR 0081 records why fctl holds such a message rather than let it through: nothing tells how much a message will set going.

  • Holding: POST /sessions/{id}/messages from an autopilot answers with held (its aph_… id and how many go before it) and the delivery it later goes out as. A message to a session that works goes at once. One to a resting session waits behind messages already held, as does any message to a session that has held messages waiting. At most 30 are held per autopilot. A retry of the same request finds the one already held.
  • Releasing: SessionObject sends what may go as a crew session ends its turn, stops, fails or starts working again (a session that works takes its held messages without needing room). The autopilot's wakes, its next message and people raising its limit do too. Each held message goes out from the person the autopilot acted as, with the delivery id the API answered with. One for a session that failed or is gone is dropped, and the autopilot's log says so. Held messages wait while the autopilot is paused; taking the project off autopilot drops them.
  • CLI, briefing and brief: fctl send says "Held: it goes to shop#41 once one of your sessions ends its turn, stops or fails…". fctl autopilot held lists the held messages (and fctl autopilot shows them), and --take-back <id> takes one back, for the autopilot or those who steer it, until a pass claims it to send it (then 409). The briefing tells the autopilot not to send a held message again, and the brief lists held messages under its sessions.

Verified with unit tests of the hold and release rules, wasm tests of the D1 queries against the D1 stand-in (what waits, what goes, claiming one to send and taking one back), and cargo xtask check lint. I also drove a fake-claude autopilot in cargo xtask dev with a limit of one session, and saw:

  • two messages to a resting session held in order while another session worked;
  • a person taking one of them back;
  • the other going out the moment the working session ended its turn;
  • a held message following a person's message to its session, sent by that session's own object;
  • a held message to a stopped session waiting while the autopilot was paused, then resuming that session when the autopilot was resumed;
  • fctl resume at the limit still refused, with its new wording.

The privacy policy on fctl.sh says what is kept of held messages and for how long:

Refs #550: fctl run --when-free (holding a new session's start) isn't part of this; see Worth confirming.

Worth confirming

  • Decision: a message waits for room, rather than going through to a resting session whatever the limit (the issue's open question, recorded in ADR 0081).
  • Decision: only messages are held. fctl resume of a failed session and fctl run still fail at the limit, with the resume's refusal now pointing out that a message waits by itself. Holding a start (fctl run --when-free) would mean replaying a session's start without the request that asked for it, so I left it for a follow-up, should autopilots still need it.
  • Decision: held messages wait while the autopilot is paused and go out when it resumes; taking it off autopilot drops them.
  • Decision: people who steer the autopilot can see held messages (fctl autopilot held, the API's held) and take them back. The web app's Autopilot tab doesn't show them yet.

fctl session


Note

Medium risk. It changes how an autopilot's messages to its sessions are delivered: they can now be stored in a new D1 table and sent later from the session objects, which touches session delivery and autopilot state.

What it does. When an autopilot messages a resting session while as many of its sessions work as its limit allows, the control plane now holds the message in a new autopilot_held table instead of failing it. Held messages go out in the order they were sent as soon as a session ends its turn, stops or fails, or when the autopilot wakes or its limit is raised. The API, CLI (fctl autopilot held, --take-back), the briefing and the generated web types are extended, and ADR 0081 records the decision. A pass claims each held message (sending_at) before sending it, and a message taken back no longer holds up later ones for the same session.

New migration. 0063_autopilot_held.sql adds the autopilot_held table to D1, and a message from an autopilot to a session can now be answered with held instead of an error.

fctl review's first look at b3fccb1 · 22 files, +1431 −34 · Review agent settings

fctl-sh Bot added 2 commits November 15, 2026 10:50
… has room

A message from an autopilot to one of its sessions that rests, while as
many of its sessions work as its people allow, no longer fails: the
control plane keeps it in D1 (autopilot_held), in the order it was sent,
and sends it once one of its sessions ends its turn, stops or fails, as
SessionObject reports the move, or at the autopilot's next wake. fctl send
says it is held, fctl autopilot held lists those held and takes one back,
and the briefing and brief say so.
ADR 0081 records why fctl holds them rather than let them through, and
the architecture, API, CLI and llms.txt describe held messages.
…pilot-s-messages-wait-for-roo

# Conflicts:
#	docs/llms.txt
@fctl-review

This comment has been minimized.

Comment thread crates/fctl-control/src/autopilots.rs Resolved
Comment thread crates/fctl-control/src/autopilots.rs Resolved
After a held message fails to reach its session, those held for that
session after it wait for the next pass rather than overtake it, and a
held message that fails to be dropped no longer stops the pass, as
fctl's review of #556 found.
kalaspuff pushed a commit to hyperstructure/fctl-site that referenced this pull request Nov 15, 2026
…es (#125)

## Summary

An autopilot's message to one of its sessions that rests, while as many
of its sessions work as its people allow, now waits on app.fctl.sh until
one of them makes room, rather than being refused. The privacy policy
now says what is kept of each such message: its text, its files' names,
types and sizes, the session it goes to, the person the autopilot acts
as and when it was sent. It also says how long: until the message goes
to its session (and into that session's transcript), someone takes it
back, its session is deleted or the project is taken off autopilot, and
however long the autopilot is paused. And it says who sees it: the
account the autopilot runs on (its brief shows the start of each) and
the project's members (its autopilot view). `updated` moves to
2026-11-15.

- hyperstructure/fctl#556

[fctl session](https://app.fctl.sh/s/ses_01M7FBR91XMD2RC1EXPNDF9A4D)

<!-- FCTL_REVIEW_SUMMARY -->
---

> [!NOTE]
> **Low risk.** Only the privacy policy text changes, plus a bump of the
pinned fctl docs reference.
>
> **What it does.** Updates `legal/privacy.md` to say what app.fctl.sh
keeps of the messages an autopilot holds for its sessions while its
session limit is full: what is stored, that their start goes to the
Claude account the autopilot runs on, that project members see them, and
how long they stay. It also bumps `fctl-docs.ref` to a newer fctl
commit.
>
> **Retention wording.** The policy now says a held message waits
however long the autopilot is paused, and is dropped for a failed
session only once the autopilot is next on; this follows fctl#556, which
is not merged yet.
>
> <sub>[fctl
review](https://app.fctl.sh/s/ses_01M7FFXYRAJFBZN827511TWS4B)'s first
look at
[`305d009`](305d009)
· 1 file, +18 −7 · [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>
@fctl-review

This comment has been minimized.

Comment thread crates/fctl-control/src/autopilots.rs Resolved
fctl-sh Bot added 2 commits November 15, 2026 11:56
…pilot-s-messages-wait-for-roo

# Conflicts:
#	crates/fctl-control/src/autopilots.rs
#	docs/architecture.md
#	docs/llms.txt
A pass now claims a held message (autopilot_held.sending_at) before it
sends it, and sends only what it claimed; taking one back deletes it
only while no pass has, and answers 409 once it is going out. The
migration is 0063 now, after main's 0061 and 0062. As fctl's review of
#556 found.
@fctl-review

This comment has been minimized.

Comment thread crates/fctl-control/src/autopilots.rs Resolved
A held message that a pass finds gone (taken back meanwhile) no longer
holds back those after it to its session; only one another pass is
sending does, as fctl's review of #556 found.
@kalaspuff
kalaspuff merged commit 5bd9999 into main Nov 15, 2026
12 of 13 checks passed
@kalaspuff
kalaspuff deleted the fctl/1291-let-an-autopilot-s-messages-wait-for-roo branch November 15, 2026 12:08
kalaspuff pushed a commit that referenced this pull request Nov 15, 2026
…rts (#558)

## Summary

An autopilot can now attach files to the sessions it starts and steers
(`fctl run --attach`, `fctl send --attach`) and read the files sent in
the sessions it reads, with a new `fctl files list` / `fctl files get`
(for people too). Files like the .3mf and .stl models of the 3D printing
autopilot then pass from a person to one session, and from there to
another, without anyone attaching them again.

- **Relay:** the autopilot's `fctl` sends a file to fctl-agent in base64
as a new `AgentCall::ApiBytes`, and the host posts the bytes as they are
to a new runner endpoint, `POST /api/v1/runner/sessions/{id}/relay`. The
Worker routes them as the JSON relay does, as the autopilot's owner, but
streams the body in and the answer out, so a 20 MB file never goes into
wasm memory. Only uploads and downloads of files go this way
(`fctl_domain::autopilot::carries_files`), and the JSON relay refuses
them.
- **What it may do:** it uploads for a session it starts (`Gate::Open`)
or one it started (`Gate::Crew`), and reads the files of the sessions it
can read. `GET /api/v1/sessions/{id}/attachments` (new) lists a
session's files, leaving out those of an autopilot's messages fctl still
holds for room (#556). A held message that never goes hands its files
back as unsent uploads, which are deleted a day later.
- **Its instructions:** where its sandbox's `fctl` has `fctl files`, its
`~/AGENTS.md` tells it to attach files rather than publish screenshots
for its sessions. It still publishes to show people an image in what it
asks them.

I checked it with unit tests (the gate, which requests carry files,
fctl-agent passing them on only from an autopilot's own session, the
`~/AGENTS.md` text, picking files by name) and in `cargo xtask dev`.
There, the fake autopilot started a session with a 3 MB model attached.
It then downloaded a 19.5 MB file a person had sent that session and
attached it to another of its sessions. The sha256 matched at every
step. Its attempt to attach a file to a person's session was refused.

Runners a version behind keep working: their fctl-agent refuses
`ApiBytes`, and `fctl` says the runner needs a newer fctl. The
autopilot's `~/AGENTS.md` keeps telling it to publish screenshots until
its sandbox's `fctl` has `fctl files`. The session socket now takes
requests of up to 32 MiB (it was 8), enough for a 20 MB file in base64.

Crew sessions still send the autopilot no files, as Carl Oscar decided:
what one makes for another (a sliced .gcode.3mf, say) goes on its
branch, or as a screenshot it publishes, and the autopilot's
instructions say so.

## Worth confirming

- **Decision:** the autopilot reads the files of every session it can
read, people's sessions in its places too, as it already reads their
transcripts. It uploads only for sessions it starts or started.
- **Decision:** uploads and downloads add no line to the autopilot's
log. The message or session that sends the files gets its usual line.
- **Decision:** `fctl files get SESSION NAME` takes the newest file of
that name and writes it into the current directory (or `--dir`), but
over no file already there unless `--force`, as the names are whoever
sent the files'. `--all` takes the newest of each name, and an older one
is reached by its id.
- **Decision:** `AgentCall::ApiBytes` is a variant of its own, not
optional fields on `AgentCall::Api` as the issue suggested. An older
fctl-agent refuses an unknown variant, where it would silently drop new
fields and send an empty upload.
- **Assumption:** the name `fctl files` (the files sent in a session)
reads clearly beside `fctl autopilot files` (the autopilot's own text
files, from #555). The autopilot's instructions tell the two apart:
attachments go to its sessions, while its own files are what it keeps
for its next session.

Fixes #517

[fctl session](https://app.fctl.sh/s/ses_01M7FBVEK6V85B5J3NNR92Z2QB)

<!-- FCTL_REVIEW_SUMMARY -->
---

> [!NOTE]
> **Medium risk.** It adds a runner endpoint that streams file bodies to
the API as an autopilot's owner, a new `AgentCall::ApiBytes` variant
with its own permission gate, and raises the session socket request
limit from 8 to 32 MiB.
>
> **What it does.** Lets an autopilot attach files to the sessions it
starts and steers (`fctl run --attach`, `fctl send --attach`) and read
files in sessions it can read, through new `fctl files list` and `fctl
files get` commands. Files travel from the autopilot's `fctl` through
fctl-agent as base64 in `AgentCall::ApiBytes`, then through a new runner
relay endpoint to the API, and a new `GET
/api/v1/sessions/{id}/attachments` lists a session's files. Uploads are
allowed only for sessions the autopilot starts or started, while
downloads cover every session it can read. `fctl files get` downloads
into hidden part files, created as new files only, and puts them in
place once every download came, writing over no existing file unless
`--force`.
>
> **Permission gate.** The autopilot can read the files of every session
it can read, including people's sessions in its places, but upload only
to sessions it starts or started.
>
> <sub>[fctl
review](https://app.fctl.sh/s/ses_01M7FKG4NZ1MV4MBWA62K7KBRB)'s first
look at
[`a8071f1`](a8071f1)
· 32 files, +1564 −83 · [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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant