Repository navigation
feat(autopilot): pass files to and from the sessions an autopilot starts - #558
Merged
kalaspuff merged 10 commits intoNov 15, 2026
Merged
Conversation
An autopilot's own session can now upload files (fctl run --attach,
fctl send --attach) and download those sent in sessions it reads
(fctl files list/get). Its fctl sends them to fctl-agent in base64 as
AgentCall::ApiBytes; the host posts the bytes as they are to the new
runner endpoint POST /runner/sessions/{id}/relay, and the Worker routes
them as the autopilot's owner with the body streamed through, never into
wasm memory. GET /sessions/{id}/attachments lists a session's files.
Refs #517
…pilot-attach-files-to-and-rea # Conflicts: # docs/llms.txt
This comment has been minimized.
This comment has been minimized.
- Limited tokens that read sessions list their files too. - The relay checks only the path before its query for .. and //, so a file named v1..2.pdf uploads. - The host tries an autopilot's file only while fctl-agent still waits for it (110 s in all), rather than uploading it again after. - fctl reads fctl-agent's answer even when the agent closed before it read the whole request, as one from before files does for a request over 8 MiB, so it says the runner needs a newer fctl. Refs #517
Contributor
Author
|
Answers to fctl review's findings in its summary for 503fbc7. All three are fixed in f162823:
|
…pilot-attach-files-to-and-rea # Conflicts: # crates/fctl-control/src/autopilots.rs # crates/fctl-domain/src/autopilot.rs # docs/llms.txt
This comment has been minimized.
This comment has been minimized.
…sked - A session's files leave out those of an autopilot's messages fctl still holds for room; a held message that never goes (taken back, dropped, refused at the cap, or the project off autopilot) hands its files back as unsent uploads, deleted a day later. - A task of files alone from an autopilot is named after its files, not after the note fctl adds to it. - fctl files get writes over no file already there unless --force, nor two files of one name in one go. Refs #517
Contributor
Author
|
Answers to fctl review's findings in its summary for b6cef7c. Both are fixed in 60dccbf:
|
This comment has been minimized.
This comment has been minimized.
Each file downloads to a hidden part beside where it goes, and all go in place once every one came, without writing over a file there unless --force; a failure removes the parts, so the same command runs again. Refs #517
This comment has been minimized.
This comment has been minimized.
kalaspuff
approved these changes
Nov 15, 2026
kalaspuff
deleted the
fctl/1292-let-an-autopilot-attach-files-to-and-rea
branch
November 15, 2026 12:43
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.
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 newfctl 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.fctlsends a file to fctl-agent in base64 as a newAgentCall::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.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 (feat(autopilot): hold its messages until its session limit has room #556). A held message that never goes hands its files back as unsent uploads, which are deleted a day later.fctlhasfctl files, its~/AGENTS.mdtells 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.mdtext, picking files by name) and incargo 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, andfctlsays the runner needs a newer fctl. The autopilot's~/AGENTS.mdkeeps telling it to publish screenshots until its sandbox'sfctlhasfctl 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
fctl files get SESSION NAMEtakes 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'.--alltakes the newest of each name, and an older one is reached by its id.AgentCall::ApiBytesis a variant of its own, not optional fields onAgentCall::Apias the issue suggested. An older fctl-agent refuses an unknown variant, where it would silently drop new fields and send an empty upload.fctl files(the files sent in a session) reads clearly besidefctl autopilot files(the autopilot's own text files, from feat(autopilot): keep files across an autopilot's sessions #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
Note
Medium risk. It adds a runner endpoint that streams file bodies to the API as an autopilot's owner, a new
AgentCall::ApiBytesvariant 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 newfctl files listandfctl files getcommands. Files travel from the autopilot'sfctlthrough fctl-agent as base64 inAgentCall::ApiBytes, then through a new runner relay endpoint to the API, and a newGET /api/v1/sessions/{id}/attachmentslists 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 getdownloads 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.
fctl review's first look at
a8071f1· 32 files, +1564 −83 · Review agent settings