Skip to content

feat(autopilot): pass on more lessons, and read the brief in parts - #544

Merged
kalaspuff merged 3 commits into
mainfrom
fctl/1264-i-asked-an-autopilot-for-a-project-calle
Nov 14, 2026
Merged

kalaspuff merged 3 commits into
mainfrom
fctl/1264-i-asked-an-autopilot-for-a-project-calle

Conversation

@fctl-sh

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

Copy link
Copy Markdown
Contributor

Summary

Carl Oscar asked the spaghetti autopilot (on fctl 0.34.1) what it would tell any fctl autopilot. Most of its advice already reached the briefing through #538–#543. This adds what hadn't:

  • Which sessions count toward the limit. The autopilot had to guess, and guessed wrong about queued ones. The briefing, the limit's error and the docs now say: those queued, starting, working, paused on a usage limit or still stopping count, as does one just messaged; one that ended its turn, stopped or failed doesn't. With all of them at work, the autopilot keeps the next tasks in its plan and starts one when fctl wakes it for a session that ended its turn.
  • Lessons. Name sessions as the brief and wakes do, never with a placeholder or a guessed number (it sent one fctl send to a made-up ID). Keep the scripts the work relies on in the plan whole, and lead the plan with what a stranger must act on first. Send long output to a file and grep it. Ask for screenshots of the case that matters (a person's narrow window, their real file), not only the default. Have watchers follow the base branch's newest run when a newer merge cancels one (a cancelled run stopped its watcher, and a ship sat waiting). Look at what people send before publishing it or passing it on (one screenshot showed a /Users/<name>/… path), and unpack archives in an empty directory.
  • fctl autopilot brief --only sessions,people,asks (?only=) shows only the named parts: direction, notes, asks, sessions, people, plan, log. The whole brief had grown to about 32 KB, which every wake read again, though its plan and log are already in the autopilot's conversation. The briefing and wake message point to --only. Notes and answers in parts it leaves out stay new, so the next whole brief or wake still marks them.

I verified it with unit tests (the briefing's lines, parsing and ordering the parts, a brief with two of them, the CLI's flag) and end to end in cargo xtask dev. An autopilot's own session ran fctl autopilot brief --only sessions,asks through the relay and got only those parts, and the CLI and the API refuse an unknown part, naming the parts there are. The dev stack can't show that a note left out stays new, because fake-claude reads the whole brief at every wake; that part is a filter on what the brief showed.

Related pull requests

The other gaps the autopilot named, each in its own pull request:

Not done here

  • Watchers that survive a handover, for what fctl doesn't wake autopilots for (the base branch's checks, a deploy). The merge wake in the pull request above removes the most common one.
  • fctl send --attach from an autopilot (Let an autopilot attach files to the sessions it starts #517). Since feat(autopilot): send an answer's files to the session the ask names #543, an ask that names a session sends people's files to it directly.
  • fctl run --when-free: the briefing now says the limit's rule, and a session ending its turn already wakes the autopilot.
  • A standard place for a pull request's screenshots, and a check in fctl send against IDs of other projects' sessions. An autopilot can already message only the sessions it started.

Worth confirming

  • Decision: --only names parts rather than headings: sessions is the autopilot's own, people is people's sessions. The lines on where it runs (time, limit, next wake, powers) always show.

fctl session


Note

Low risk. It adds an optional only filter to the autopilot brief and extends briefing text and docs; without the filter the brief is unchanged, and an older control plane ignores the parameter.

What it does. Adds more lessons and a rule on which sessions count toward an autopilot's session limit (queued, starting, working, paused or still stopping) to its briefing, the limit's error and the docs. The autopilot can now read its brief in parts with fctl autopilot brief --only sessions,asks (and ?only= on the API), so each wake reads less. Unknown or empty part names are refused with an error that lists the parts.

Partial brief and notes. Notes and answers in parts left out by --only stay new, so the next whole brief or wake still marks them.

fctl review's first look at 0f6bff4 · 11 files, +357 −44 · Review agent settings

fctl-sh Bot added 2 commits November 14, 2026 19:19
An autopilot that ran the spaghetti project for days said what it would
tell any autopilot. Its briefing now says which sessions count toward how
many work at once, to name sessions as fctl does rather than with a
placeholder, to keep the scripts the work relies on whole in the plan, to
read long output and the brief in part, to ask for shots of the case that
matters, to follow the base branch's newest run when a newer merge
cancels one, and to look at what people send before publishing it.

fctl autopilot brief --only sessions,people,asks (?only=) shows only the
parts it names; the notes and answers of parts it leaves out stay new.
@fctl-review

This comment has been minimized.

Comment thread crates/fctl/src/cmd/autopilot.rs Resolved
Comment thread crates/fctl-control/src/autopilots.rs Resolved
--only sessions, asked for the direction too: an empty name read as every
part, of which the CLI took the first. It now fails on it. The session
limit's copy says that sessions still stopping count, as they do, and the
API's table lists ?only=.
@fctl-sh

fctl-sh Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

On the summary's finding about docs/api.md: fixed in 0f6bff4. The GET …/autopilot/brief row now lists ?only=, the part names, and that the notes and answers it marks heard are only those among the parts shown.

kalaspuff pushed a commit that referenced this pull request Nov 14, 2026
## Summary

`project#12` resolved only among the project's latest 200 sessions, so a
long-running autopilot's session became unreachable by number once 200
newer ones came, and every plan had to carry `ses_…` IDs. The spaghetti
autopilot ran into that. `GET /sessions` now takes `?number=` with
`?project=` and gives that one session however old it is. The CLI asks
for it everywhere it resolves `project#N` (`fctl show`, `send`, `logs`,
`autopilot ask --session` and the rest).

Older control planes ignore `?number=` and return the latest 200 as
before, among which the CLI still looks. Only then does its error add
"(or it is older than the last 200)".

I verified it with a CLI test (the request it makes and both errors) and
in `cargo xtask dev`: `?number=1&limit=1` returned session #1 rather
than the newest, and `fctl show playground#1` found it.

## Related pull requests

- #544
- #546

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

<!-- FCTL_REVIEW_SUMMARY -->
---

> [!NOTE]
> **Low risk.** It adds an optional query filter to the sessions list
and changes how the CLI looks up `project#number`; an older control
plane ignores the filter and the CLI falls back to the old behavior.
>
> **What it does.** `fctl` looked up `project#number` among a project's
latest 200 sessions, so older sessions could not be found. The sessions
list now takes `?number=` together with `?project=`, and the CLI asks
for exactly that session. Docs and a test are updated.
>
> **Older control planes.** A control plane without `?number=` ignores
it and returns the latest 200, so the CLI still searches among those and
keeps the old error message.
>
> <sub>[fctl
review](https://app.fctl.sh/s/ses_01M7DSPMGMH1AR48MZ9N5Z1Y68)'s first
look at
[`e9a1f40`](e9a1f40)
· 5 files, +86 −19 · [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>
@kalaspuff
kalaspuff merged commit d9ea69e into main Nov 14, 2026
14 checks passed
@kalaspuff
kalaspuff deleted the fctl/1264-i-asked-an-autopilot-for-a-project-calle branch November 14, 2026 20:24
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>
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