Board tasks: #79 (engine core), #85 (runners), #88 (Unstick stale tasks, now reminders), #90 (digest), #94 (start planned tasks), #95 (PR review), #21 (other people's PRs), #97 (custom automations), in epic #101; #123 (Merge into epic branch), #127 (Merge ready PRs); #135 (sharing custom automations); #241 (agents' drafts).
Autopilot lets the board act on its own: a catalogue of automations, each switched on or off per epic, per project or for the whole board, that watch the board and act when something needs doing. The engine is deterministic code in the server. It never calls an LLM itself; an automation whose action needs one starts an agent through a runner. The rules every automation lives under are in ADR 0008.
This doc covers the engine, the runners, the per-task flag, the automations that have landed (below) and the settings UI. The digest's header button and panel are in board-layout.md. The rest of the catalogue is each its own task in the epic.
Each automation has a mode at each scope: Inherit, Off, Preview or On. The most specific scope that isn't Inherit wins: epic over project over board. With nothing set anywhere, an automation is off. Preview is on, but every run it makes is a dry run.
The board is the top scope, so Inherit there would only fall back to that default, which is the same as Off. The
board's switch therefore offers Off, Preview and On only (BOARD_MODES); no row reads as Off, and picking
Off saves inherit, which drops the row unless it still holds config or a last on-mode. The server accepts every mode
at every scope. Projects and epics offer Inherit / Off / Preview / On.
| Board | Project | Epic | Effective |
|---|---|---|---|
| — | — | — | Off (default) |
| On | Inherit | Inherit | On (board) |
| On | Off | Inherit | Off (project) |
| Off | On | Inherit | On (project) |
| Off | Off | On | On (epic) |
| On | On | Off | Off (epic) |
| On | Preview | Inherit | Preview (project) |
| Preview | Inherit | On | On (epic) |
Where it runs is the same rows read as one sentence and edited as one table. describeWhere (packages/contracts/src/autopilotWhere.ts)
turns an automation's modes at every scope into a reach and its exceptions: Everywhere is the board On;
Only in… is the board off with some projects On; nowhere is neither. An exception is a project or epic whose own
setting differs from what it would follow: a project Off under Everywhere, an epic set against its project (an epic
set the same as its project is not one). "On everywhere except payments-api; epic #5 Off" is the sentence for the
board On, payments-api Off and epic #5 Off. Switching on over the board's row drops the rows a project or epic only repeated, so a later Switch off of the board really is off. Nothing is stored for it: the edits (whereEverywhere, whereOnEverywhere, whereOffEverywhere,
whereProject, whereProjectPreview, whereEpic) return the plain PUT writes (a scope and a
mode), and a toggle that gives what the scope above already gives saves Inherit rather than an override
(modeToBe), so a project that is switched on and off again leaves no row. Each write is its own request and the
server acts on each, so the order is part of the contract: a write that turns the board on sends it first, so nothing
is off on the way, which would drop a Run now request or restart a schedule (whereEverywhere keeps projects set Off,
and whereOnEverywhere, the table header's on click, clears them too), and whereOffEverywhere clears epics and
projects before the board. useApplyWhere sends them in order and the event stream holds back the switches'
refetch until the last is in (WHERE_MUTATION_KEY). The tests run every board × project × epic
combination against resolveAutopilot.
An epic's setting covers only the tasks in it (parent_id). A task with no epic skips that level, and so does a
task whose epic is archived: an archived epic no longer counts (unarchive it and its rows apply again). The epic
card itself isn't "in" an epic, so it follows its project, except as a candidate that is the epic card itself
(today only Auto-archive's), which the engine resolves on the epic.
An automation says whether an epic can switch it with epicScope (default true; describeAutomation sends it to the
UI). Set it false when its candidates are never tasks in an epic: Recurring tasks (per project, no task) and the Digest
do. For those the epic's popover leaves the automation out, the
epic button's state ignores it, the epic's scope entries don't list it, PUT of an epic switch for it is a
VALIDATION error, and an epic row left over from before the flag was set is ignored (resolve and
projectsWithEpicOn skip the epic level).
Each automation also has config (a skill, a budget, a number of days). Config keys merge the same way, board
first, then project, then epic, over the automation's defaults (with the board's agent defaults
laid over them), whatever the modes: a project can tune an
automation the board switches on, and an epic can tune one for its tasks. resolveAutopilot in packages/contracts/src/autopilot.ts is the rule, and
describeInherited gives the UI its "Inherit (On from board)" (or "Preview from board") label.
Rows live in autopilot_settings, keyed by scope and automation. The board scope has an empty scope_id. The
service reads or sets an epic scope only for an epic in the project it is given (NOT_FOUND otherwise: another
project's epic, a plain task, an id that doesn't exist). Deleting a project (or an epic) deletes its rows, through
triggers, since scope_id can't carry a foreign key.
The engine resolves per task: resolve(automation, projectId, epicId) in services/autopilot.ts. A pass looks at
a project where the automation is on, and also where one of its unarchived epics switches it on
(projectsWithEpicOn), since the project itself may be off. A check sees the whole project there, and the engine
drops every candidate whose task doesn't resolve to on, using the task's own epic. So check gets the project's
config, while act gets the task's effective config, epic keys included; a config key that changes what a check
finds can't be tuned per epic.
Preview is a per-automation dry run: try one new automation while the others keep working. resolveAutopilot counts
preview as enabled and sets preview, so the check runs where it would, and the engine records each candidate whose
task (or project, or the board for a task-less one) resolves to Preview as a dry run: a skipped run with "Would …"
as its summary, exactly as under Preview everything (engine.dryRun), which still
previews every automation at once.
- What still runs. Nothing the action would do: no agent, no shell command or script action, no change to the board or GitHub. A custom automation's check script is the exception: it runs for real, to find what it would act on, so its preview can say what it printed. The UI says so wherever an automation has one.
- Per scope. A project, or an epic, can be in Preview while the rest is On, and the other way round. A check is
handed
ProjectScope.dryRunper project (true when no scope reaching the project is live: neither the project's own resolution nor an epic of it switched On) andengine.dryRunset when nothing of the automation is live anywhere, so checks that read the dry-run flag (dedupe of custom checks, Orchestrate's slots, Start planned's room) read the right one. The engine still decides each candidate by its own task's scopes. - Turning it on. Going from Preview to On counts as switching it on (
onEnabled,onEpicEnabled): a custom automation re-arms and Recurring tasks restarts, so On acts on what happens from then, not on what Preview saw. Dry runs are deduped apart from real ones, so the Preview runs stay as history. - Start planned's room. Its check resolves each task as the engine will: a task that resolves Off (outside an epic that is on, in a project that is off) is left out, and one in Preview is handed over outside the slots, since the engine only records it. Neither can take the room a live task needs.
- A custom automation's preview text is built per task: its epic's mode when the epic has its own setting, else its project's, so a task in a Preview epic of a live project still gets "what it would run".
- Elsewhere. The merge gate counts Review PRs in Preview (or under Preview everything) as on, so a merge still waits for its review: that review doesn't come until it is turned on, which holds merges back rather than letting a PR through unreviewed. A Recurring section in Preview says no task is made.
- New automations save in Preview. Creating, importing or importing a draft writes a board row in Preview
(
customAutomationsinsert), withlast_on_modePreview. - The last on-mode.
autopilot_settings.last_on_mode(migration 043, which also widens the mode CHECK) keeps the last of On or Preview a scope was set to, through Off and Inherit; the row stays while it holds one. Such a row, at Inherit with no config, isn't an epic's own setting (epicsWithOwnSetting), so the epic still follows its project. Scope entries carry it aslastOnMode, withpreview. The list's switch turns an automation back on in it, or, with none, in Preview for one that has never made a real run and On for one that has (restoreMode). The lane and epic popovers' switches turn on in it, or On. - How often it would have run.
overview.previewRunscounts each automation's dry runs over the last 7 days (PREVIEW_WINDOW_MS,autopilotRuns.dryRunCountsSince), for the detail's "Would have run N times this week" notice and its Turn on.
Engine-wide settings are one autopilotEngine key in the settings table, and Pause all is
autopilotPaused:
| Setting | Default | Meaning |
|---|---|---|
maxConcurrent |
1 | Autopilot's open agent runs at once (not a machine-wide limit) |
dailyRunCap |
none | Agent runs started per local day |
dailySpendCapUsd |
none | What agent runs created today may cost before no more start |
quietHours |
off, 22:00–07:00 | No agent runs start in the window (local time; may wrap midnight; equal ends are no window) |
dryRun |
off | Preview everything: every automation records what would run, and does nothing |
worktreeRetentionDays |
7 | Days a finished headless run's worktree is kept when its PR hasn't merged |
agentDefaults |
auto, $5, 60 min, T3's default | What agent automations run with unless they override it (below) |
On connected machines. A machine that runs Autopilot for the tasks it holds has its own max concurrent, daily caps
and quiet hours (AutopilotLimits), set behind Limits for in Settings → Autopilot → Limits & safety; until set it
goes by the board's. Each server's limits count only the runs it made: the board's caps leave out the runs replayed
from a machine. The rest of the engine settings are shared. See
remote machines.
Quiet hours and the caps only hold back automations with needsAgent; board-only actions (archiving a card)
go ahead.
agentDefaults (AutopilotAgentDefaults in contracts) is the runner, budget, timeout and T3 access every agent
automation runs with: Settings → Autopilot → Limits & safety → Defaults for agent runs. An automation's config only
overrides it. The service lays it over the automation's own defaults (agentDefaultsFor in
autopilot/runnerOptions.ts, used by resolve, the scope entries and the overview's defaults), key by key, for
the keys the automation has a default for and whose value its schema accepts: Orchestrate's runner is only the one
the sessions it starts run on (Task sessions), and it has no T3 access,
and Review PRs, which takes only Auto or Headless, keeps its own runner when the board's is T3 Code. So a key comes
from the most specific scope that sets it, else the board's agent default, else the automation's built-in default
(readRunnerOptions(config, board) falls back the same way). The model isn't one of them: each kind of run has its
model in Agents → Operations (Models), and an automation's Model field defaults to Inherit. A run with no
task (the digest, a scheduled custom automation) and a custom agent given extra tools are always headless, whatever
the board's runner, so a board default of T3 Code can't make them fail.
Review rounds, comment rounds and the fix threshold were engine settings (prReviewRounds, prCommentRounds,
prFixThreshold) until 044_autopilot_agent_defaults, a code migration, moved them into
Review PRs (rounds) and Fix PRs (attempts, commentAttempts, fixThreshold; see Automations): a value
the user had changed goes into those automations' board-scope config (unless that scope sets the key already), and
the engine keys are dropped. Review PRs, Fix PRs, Orchestrate and the digest had budgets and timeouts of their own
below the old shared defaults ($2/20 min, $3/30, $3/30, $1/15); the migration writes them into the board-scope config of
each one that has any setting row, so nothing that ran changes, and the user sees them as overrides. One never touched
was never on, and takes the board's defaults. Pause all stops every new run; runs already going finish. Backups carry the engine settings but not
the pause, so a restore never lifts it.
The engine (apps/server/src/autopilot/engine.ts) runs a pass a second after a burst of board events, every
60 seconds, and when Autopilot settings change. PR and T3 thread snapshots reach it as task.upserted events,
so they need no hook of their own. Events published while the engine itself writes start no pass. A pass:
- Stops if paused.
- For each automation, works out the projects where it's on or has an epic it's on for (and whether it's on for the board itself) and skips it if it's on nowhere.
- Calls the automation's
check, which returns candidates: a dedupe key, a one-line summary, and usually a task. - Drops candidates outside the scopes it's on in (per task: its epic, then its project), and candidates whose dedupe key already has a run.
- Under Preview everything, or where the candidate resolves to Preview, records a
skippedrun with "Would …" as its summary and moves on. - For agent automations, holds the candidate in quiet hours, at the concurrency cap or at a daily cap. Held
candidates aren't recorded, so a later pass picks them up. A candidate with
startsNoAgent(Fix PRs giving up) isn't held: it starts no agent, so the caps and quiet hours don't apply to it, and it counts toward neither the daily run cap nor the concurrency count. Before any of that, a candidate another server's engine owns is dropped (autopilot/placement.ts): on a board, a task a machine holds that runs Autopilot itself, or a scheduled automation pinned to a machine; on a runner, anything but the tasks it holds and the automations pinned to it (remote machines). - Records a
queuedrun, marks itrunning, and calls the action. Agent actions, and automations markedbackground(custom shell commands and scripts), go on in the background; other board-only actions are awaited, one after another.
The engine never retries a run by itself: once a dedupe key has a run, whatever its outcome, that candidate is done. A
key that should act again changes (review:pr:<headSha>, start:<taskId>:<statusChangedAt>).
Retrying by hand. A real run that ended failed or skipped can be handed back to the engine
(AutopilotService.retry): the Autopilot section's Retry on the run, POST /api/autopilot/runs/:id/retry, or
the MCP tool retry_autopilot_run(task, automation?) (the task's newest such run, optionally of one automation by key
or title). A run the same automation has made a real run since (on the same task, or for a task-less run in the
same project) is superseded (isSupersededRun): the service refuses it with a CONFLICT and the panel shows no Retry on
it, since retrying would redo nothing yet drop it from the rounds and attempts. The run stays as history, but its dedupe key is retired to retried:<runId>:<old key> (RETRIED_PREFIX,
canRetryRun in contracts) and its attention flag is lifted, and the task logs an autopilot_run entry with status
retried under the caller. The old key is free, so the next pass acts on it again if check still finds the work,
under the switches, pause, quiet hours and caps as usual: retrying lifts no limit, which is why agents may call it.
Automations that count runs by key (Review PRs' rounds, Fix PRs' attempts, Merge ready PRs' tries) no longer
count the retried one. An automation can refuse a retry with a reason of its own (Automation.retryRefusal, given
the runs on the task): Fix PRs caps the fresh budgets its gave-up notices grant (see Fix PRs under Automations). This replaces pushing an empty commit to get a new head reviewed after a board restart failed
the review. Dry-run runs are deduped
apart from real ones (the unique key is automation, dedupe key and dry_run), so turning dry-run off doesn't
hide work it only previewed.
autopilot_runs holds one row per run: queued → running → succeeded | failed | skipped. The runner fills in
runner, session_id, thread_url, worktree_path and cost_usd. Starting a run records checkout_path
(AutopilotRun.checkoutPath, migration 063): its project's folder as it is then, found through its task when the run
names no project, null with none. On a runner that folder is the checkout the user chose there
(ADR 0019), so a machine's run says which checkout it used.
A board run sent to the machine holding its task (remoteWork) starts with the board's folder, so the board replaces
it with the machine's reported checkout as it sends the job, and the machine then sends its own (runnerWork, also
on the copy it adopts). The run's details show it as Folder, and it stays right after the project moves. An action can leave a structured result in
output_json (ActionResult.output, AutopilotRun.output) for a later automation to read; Review PRs leaves its
verdict there. A custom automation's shell or script action fills in exit_code and detail (the output's tail); a dry run
of a custom automation keeps in detail what it would have run (Candidate.preview). The UI labels a dry run
Preview. Runs are history, so backups
leave them out.
-
Deferred runs. A skipped run whose work comes again later says why in
deferred(migration 045,AutopilotRunDeferral,ActionResult.deferred).head_moved: Review PRs, Fix PRs and Merge into epic branch stopped because the PR's head moved before or while they ran, so the new head is acted on next. The UI shows these as Deferred: head moved (runStatusLabel, a warning badge), not as a plain skip, and the history's outcome filter has them apart. The status staysskipped, so dedupe keys, rounds and attempts read them as before. -
Rate limits. A run whose action fails on a git host's used-up API limit (
rateLimitOf, through any wrapping: GitHub PRs) isn't failed or flagged. The engine ends it skipped and deferredrate_limited(rateLimitDeferral), withoutput.rateLimitedHostandoutput.retryAt(RateLimitDeferralOutput): the host's reset, or 10 minutes when it didn't say (RATE_LIMIT_FALLBACK_MS). The UI shows Deferred: API rate limit until 19:54. Automations that retry passing failures (Review PRs' posting, other people's PRs, Merge into main, Merge into epic branch) let a rate limit through, so it uses up none of their tries. At the start of each pass,releaseRateLimitedretires the key of every such run whoseretryAthas passed, asretrywould (no flag; the task's activity says it will try again now the limit has reset), and the candidate comes back. Until then the host stays held: a candidate naming that host (Candidate.gitHost, set by the PR automations) isn't recorded. The engine also sets a timer for a pass just after the reset. Only the board's own runs hold a host; a machine's runs don't. A limitgh auth statusreports doesn't hold the host by itself: only an action that actually spends it is refused and deferred, so with GitHub's REST limit used up, GraphQL actions (posting reviews, merging) still run. Once one is deferred, the hold is host-wide, since a candidate doesn't know which API it will spend. -
A task's runs log
autopilot_runactivity under the actorautopilot: when it starts, when it ends, and once for a dry-run preview. -
A run a connected machine's own Autopilot made is kept on the board under its id with
machineset (machine_id,machine_name, migration 057), replayed from that machine's log; the run history and the task's Autopilot section show it as "on · ". The board doesn't recover such a run after its own restart, clean up its worktree, or count it against its limits. -
Every change to a run publishes
autopilot.changedwith the pause state and the runs in flight; the board snapshot carries the sameautopilotobject, so lanes, epic bands and cards can show what's running. Each run in flight carries its task'sepicId, read from the task when the status is built (it isn't stored on the run). -
An action that throws fails its run and flags it needs attention. The server ends runs a restart left
queuedorrunningas failed ("The board restarted while this run was going") at startup, whether or not the pollers run (recover). A Review PRs or Fix PRs run is retried once: it is retired like a hand retry (keyretried:<runId>:<key>, no flag, no inbox notification) and the task logs anautopilot_runentry with statusretriedand reasonrestart, so the engine redoes the work on its next pass and the run no longer counts as a Review PRs round or a Fix PRs attempt. Every other automation is flagged as before: a Start planned or Orchestrate run may have launched an agent, so redoing it could launch a second one. (A Fix PRs run killed after its agent pushed can likewise leave the redo with a second session; the engine re-checks the PR first and the attempt cap still applies.) Retries stop at one: a run whose work a restart already cut short (a retired run of the same automation and key that ended with that error) is flagged instead, so a run that itself restarts the board can't loop. A run a finished run of its automation has superseded is flagged too (runs stranded together don't supersede each other). Retired restart runs still count as restarts inboard_activity. A restart that lands in the instant between GitHub accepting a review and the run recording it can make the redo post a second review; the check for a landed review only covers a post that returned an error, not one the process was killed during. In dev,pnpm devandpnpm sandboxrun the server undertsx watch, which restarts on edits but not on a file being read:node --watchalso restarts on an NTFS last-access change, so an agent merely reading a server file would restart the board. -
A run the board sent to a connected machine (its task held there) isn't failed by
recover: it stays running and the board reads its job on the machine again, ending the run by how the job ended and the automation'safterRestart(remote machines).
The Run history page (/settings/autopilot/runs/$automation, RunHistory) lists every run of one automation, newest
first, or of all of them with all: the Runs tab of Settings → Autopilot. An automation's detail and a custom
automation's editor link to its own. It is for reading what scheduled agents did, since their runs have no task panel, and for clearing out old runs.
-
Plain names. Every run shows its automation's name, never its key:
automationTitleOf(contracts,autopilotRunHistory.ts) takes the catalogue's title, thenRETIRED_AUTOMATION_TITLESfor automations the board no longer has (unstick,unblock_dependents,fix_pr_findings), "Removed custom automation" for a deleted custom one, and otherwise the key made readable. The server's titles (activity, digests, Needs you, notifications) and the Stats page's table use it too. -
A row shows its status, automation, project and task, the error or summary, cost and age. What you can do with it sits in its header, right of cost and age, whether it is open or closed: ↻ Retry when
canRetryRunallows it (judged against the loaded runs, so a superseded run offers none) and, on a failure, Ask an agent ▾ (AskToFix, the hand-off menu described under Ask an agent below), so a failed run can be handled without opening it. Clicking it opens what the run kept: its summary under an error, the output (Error output on a failure), a scheduled agent's handover, and a details list of cost, model, runner, times and run id. What it can open is a link in that list: Thread ("Open in T3 Code ↗" for a T3 deep link, "Open thread ↗" for a web URL) and Session ("Open session ↗", which opens the session in a terminal as the task panel does when it is linked on the run's task (runSessionLink), then the short id, the whole one in its tooltip). The task panel's Autopilot section places them the same way: Retry on the run's first line, the thread and session links on the line under it. -
The list.
GET /api/autopilot/runs/history(ListAutopilotRunsQuery,AutopilotRunPageinpackages/contracts/src/autopilotRunHistory.ts) takesautomation(a key orall) and optionallyprojectId,since(included) anduntil(excluded) as ISO times oncreated_at,q,cursorandlimit(default 50, at most 100).qis a case-insensitive text search over the run id, its project's title, its summary, the summary and handover of a scheduled agent's answer and, for a query that is just#N, the task with that number (%and_are taken literally). A bad time, cursor or limit is aVALIDATIONerror. The oldGET /api/autopilot/runsis unchanged for its callers. -
Paging. Keyset, on (
created_at,id) newest first, so runs made while someone scrolls never shift a page.nextCursoris an opaque base64url of the last row's pair, null on the last page. Migration 034 indexes (automation,created_at,id). The page uses an infinite query (useAutopilotRunHistory) loading the next page as the end of the list comes into view.autopilot.changedrefetches it, and a refetch takes each cursor from the page before it, so a new run moves the pages along instead of dropping a run between two. -
Filters in the URL. The automation is the path's
$automation(the page's Automation select navigates, keeping the rest; retired automations are listed too). Search paramsproject,range(24h,7d,30dorcustom),sinceanduntil(local calendar days, both included, only withcustom),outcomeandq(RunHistorySearch,runHistoryFilterinrunHistory.logic.ts), so a filtered page can be linked to. A preset counts from when it was chosen.outcome(AutopilotRunOutcome, the chips under the filters) isfailed,succeeded,deferred(skipped with a deferral),skipped(the other real skips),preview(dry run) oractive(queued or running); the list'soutcomequery param filters the same way (OUTCOME_CLAUSEin the runs repo). -
Deleting, by hand only. Nothing deletes runs by itself: there is no retention setting and no sweep. Deleting sits under Clean up… below the list, out of the way: Select runs to delete shows a checkbox per run and a bar with Delete selected, and Delete all matching… deletes every run the filters match (Delete all matching…, which with no filter is the automation's whole history, so with a time range it clears, say, everything before a date).
POST /api/autopilot/runs/deletetakes{ ids }(at most 500,RUN_DELETE_IDS_MAX; the page stops ticking there) or{ filter }(the same filter as the list, without paging) andpreview. A preview counts and deletes nothing, which is what the confirm dialog shows before it asks; a real delete weighs the runs again and removes them in one transaction, then publishesautopilot.changed. The reply is{ preview, deleted, kept, keptReasons }. Runs aren't in backups (backup.md), so there is no way back, and the dialog says so. -
What is always kept. Runs are more than history: the engine reads them. A delete leaves a run alone, with the first of these as the reason, when it is: queued or running; one whose worktree is still on disk (the worktree cleanup finds worktrees through the row); on a task that isn't done or archived, since dedupe keys (
hasRun), Review PRs rounds, Fix PRs attempts, Merge ready PRs tries and the attention flag read the task's runs; a custom or Auto-archive run on a task (their dedupe keys follow the task's own state, so without the run Auto-archive would archive a task someone unarchived, and a custom trigger that still holds would fire again); the latest succeeded answer of a scheduled agent in its project (lastScheduledAnswer, what the next run is handed); or less than a day old (RUN_DELETE_MIN_AGE_MS), so deleting a just-finished run can't free a slot's dedupe key (Orchestrate would run the slot again) or make a notice repeat. The other automations are safe without their old runs: Recurring tasks has its cursor, the Digest and Start planned follow state that has moved on, and Review PRs, Fix PRs and Merge into epic branch key on a PR head or sit on tasks that are open while it matters. Everything else, including every older run of a Done task, can go.keptReasonshas each reason with its count (KEPT_REASON_TEXT).
How each automation is doing, on its detail in Settings → Autopilot and in Needs you.
-
This week.
GET /api/autopilot/automations/:automation/week(AutomationWeekinpackages/contracts/src/autopilotHealth.ts,AutopilotService.week) covers today and the six local days before it: real runs that acted (runs, skipped ones did nothing),failed,deferred,spendUsd,wouldRun(dry-run records),gaveUp(distinct PRs Fix PRs gave up on, by attempt budget:revieworcomments, read from itsfix:gave_up:dedupe keys), a bar per day, and its last five real finished runs. 404 for an automation the board doesn't have. The detail's This week section (WeekSectioninHealthSections.tsx) shows it while the automation is on anywhere, with an All runs link. Its query sits under the runs keys, soautopilot.changedrefetches it. -
Tuning hints are rules, no model: pure functions in
autopilotHealth.tsthe overview runs for every automation that is on somewhere (hintsinAutopilotOverview). Each has a stableidnaming the situation, a tone, its text and one action (AutopilotHintAction):- Fix PRs gave up on 2 or more PRs this week at an attempt cap below its maximum (10 for
attempts, 20 forcommentAttempts) → Raise to N+1 (set in its board config). A give-up for too many runs that ended in no action (:no_action) isn't counted: more attempts wouldn't help. - 3 or more of the last 5 runs failed (board restarts aside) → Ask an agent to fix, which copies
fixAutomationPromptand dismisses the hint until the next failure. - Start planned tasks is on but no ready Planned task (a plan, not blocked, not manual) in its projects is flagged,
while some are Default → Flag #9, #10 and #11 (
update_task-style PATCH withautopilot: true; tasks switched Off by hand are left out). - Orchestrate ran 40 or more times this week since its board setting last changed → Every 2N minutes (its board config; the count starts again once it changes, so the hint asks again only after the new interval has run often too). Whether a run changed anything isn't recorded, so the text says "if most runs found nothing to do".
- A daily run or spend cap is reached today (
engineHints,automation: null) → See limits.
Hints show under the detail's header (
HintNotice) and in Needs you, each with Dismiss (POST /api/autopilot/hints/dismiss, stored as the last 200 ids in theautopilotDismissedHintssetting, which stays with the machine like pause). Applying a hint dismisses it too. A dismissed hint comes back only when its id changes: a newer give-up or failure, other tasks, another interval, another day. - Fix PRs gave up on 2 or more PRs this week at an attempt cap below its maximum (10 for
-
Auto-pause. After a real run in a project fails,
autoPauseAfter(servicefinish) reads the automation's finished runs there since it was last resumed and counts failures in a row (failureStreak: a success ends the streak; skipped runs, dry runs and runs the board's restart failed neither count nor break it). AtAUTOPILOT_AUTO_PAUSE_FAILURES(3) it pauses the automation in that project (autopilot_auto_pauses, migration 045) with a reason ("Failed 3 times in a row. The last: …"), publishesautopilot.changedand sends anautopilot_failednotification. The engine then leaves the project out of the automation's check (a custom automation's check script doesn't run there either) and drops its candidates; other projects go on. The overview lists the pauses (autoPaused): the list row's subline reads Paused (amber) "in storefront", the detail's Where it runs a row per project with the reason and Resume, and Needs you the same. Resume (POST /api/autopilot/auto-pauses/resume,{ automation, projectId }; 409 when it isn't paused) lifts it, counts failures again only from then (counted_from), marks the notification read, and callsonEnabledas lifting Pause all does, so automations with a schedule of their own don't catch up. Board-wide runs (no project) never pause. The pause keeps the run whose failure caused it (run_id, migration 060): when that run turns out to have succeeded after all (a machine that couldn't be reached says so once it can, remote machines), the pause is lifted as by Resume, except thatcounted_fromstays. A pause another failure caused stays. Auto-pauses aren't in backups.
A flagged run puts an autopilot attention reason on its task, with the run's error. It isn't cleared by a
write: autopilotRuns.attentionFor stops reporting it once the task changes status after the run, or a later
real run of the same automation on the task succeeds.
Dismissing. The user can also lift a flag they have dealt with, with Dismiss in the Autopilot section of the
task panel (a notice with the flag's message, shown while the task carries the autopilot reason; dismissableRun in
autopilot.logic.ts) or POST /api/autopilot/runs/:id/dismiss (AutopilotService.dismiss). Unlike retry it redoes
nothing: the run stays as it was (failed or skipped, needs_attention still 1, dedupe key kept, so the engine
doesn't act on it again) and only gets dismissed_at (migration 032). attentionFor and latestFlaggedAt skip runs
with it set. The service dismisses every flagged run of the task, so an older flag doesn't surface in the dismissed
one's place; a run flagged afterwards raises the flag again. It refuses a run that isn't flagged or whose flag no
longer stands (CONFLICT), does nothing for one already dismissed, logs an autopilot_run entry with status dismissed under the user's actor, and publishes
autopilot.changed and the task so open boards refresh. REST only, no MCP tool: it is the user saying they dealt with it.
Backups leave runs out, so the column is not in the dump.
Retry on the flag. The flag offers Retry beside Dismiss, both on its row at the top of the task panel
(AttentionFlags) and on the Autopilot section's notice, since its message often says to retry and the run's own Retry is
further down. Both use FlagRetryButton, which shows it only when the run's row would (flagRetryRun in
autopilot.logic.ts: the dismissableRun run, not deferred, its automation not paused in the project, and
canRetryRun against the task's runs, so a notice a later run superseded offers only Dismiss). It calls the same
retry, which lifts the flag. The tooltip says what a retry does for that automation (retryTitle, also used on the
run row): one more review round, or one more conflict resolution review, for a Review PRs run that stopped at that
limit (its output's REVIEW_ROUNDS_USED_UP or CONFLICT_REVIEWS_USED_UP), a fresh set of attempts for Fix PRs' gave-up
notice, otherwise "Let Autopilot try this again on its next pass". UI only: the server and MCP are unchanged.
"After" is decided by stored times, so a status change never ties with a flag: statusChangeTime in
services/tasks.ts stores a time a millisecond past the task's latest flagged run when the move would otherwise
land in the same millisecond. A flag raised after a move stands, except in the rare case the move had to step
past an earlier flag in that very millisecond.
tasks.autopilot is a nullable integer like auto_review: null is Default, 1 is On and 0 is Off.
Default never auto-starts a task; only On does, so an automation that starts work (Start planned tasks) checks
for task.autopilot === true on top of its scope being on. The flag does nothing by itself.
- The user sets it in the task panel's Autopilot section, as the start it chip (On saves On; off saves Default). Agents set it with
autopilot: "default" | "on" | "off"onupdate_task,create_taskandadd_to_backlog, and only after the user has said so. A change is logged as anupdatedactivity entry namingautopilot. - After
set_planorcreate_task, when Start planned tasks resolves On for the task (its epic, project or the board) and the flag is Default, the result says Autopilot flag not set and tells the agent to ask the user (autopilotFlagHint). Without the automation switched on there is nothing to opt into, so there's no hint. - Backups carry the column (the dump is
SELECT *and the restore inserts by column name); a dump from before the column restores with every task at Default. - Agents can flag tasks but still can't change any Autopilot setting.
A manual task (task.manual, see task-lifecycle.md) is for a person, so the
automations that act on tasks pass it over: Start planned tasks (notStartable; workingAgents still counts a
thread that is working on a task turned manual mid-run, since nothing stops that agent), the quiet-task and waiting-thread reminders, Review PRs, Fix PRs, and Orchestrate (orchestrateNeedsLooking ignores it, and
its prompt tells the agent to leave manual tasks alone). The unblocked notification still fires when a manual blocker
finishes, since the task it unblocks is code; Auto-archive still tidies it away once Done.
REST only, for the UI. There is no MCP tool, so agents can't switch Autopilot on, lift its limits or unpause it. The
one exception is retry_autopilot_run, which only frees a run's work for the engine to judge again; draft_automation
switches nothing on either, since only the user's import saves the automation it drafts (drafts).
| Route | Does |
|---|---|
GET /api/autopilot |
Pause, engine settings and the catalogue (with each automation's group, field descriptors and defaults), plus today's agent runs and spend, Needs you, auto-pauses, tuning hints and each automation's last finished run, for the settings page |
PATCH /api/autopilot/engine |
Updates engine settings; quietHours may be partial |
POST /api/autopilot/pause, /resume |
Pause all, and back |
GET /api/autopilot/machines |
Each connected machine that runs Autopilot: its limits, whether it has the latest settings and Pause all, its runs today |
PUT /api/autopilot/machines/:id/limits |
A machine's own limits, partially; {"reset": true} goes back to the board's |
PUT /api/autopilot/custom/:id/machine |
Pins a scheduled custom automation to a machine ({"machineId": null}: the board) |
GET /api/autopilot/modes |
Every switch that is set (not Inherit) at any scope, as { scopeKind, scopeId, automation, mode }: the one read the Where it runs widget needs for its exceptions, instead of a scope per project and epic |
GET /api/autopilot/board, /projects/:id, /projects/:id/epics/:epicId |
Each automation at that scope: its own mode and config, and what it resolves to (an epic's through its project and the board) |
PUT /api/autopilot/board/:automation, /projects/:id/:automation, /projects/:id/epics/:epicId/:automation |
Sets mode and/or config; Inherit with no config removes the row |
GET /api/autopilot/runs?taskId= or ?projectId= |
Runs, newest first (limit, default 50) |
GET /api/autopilot/runs/history |
One automation's runs (or automation=all), filtered, a page at a time (see Run history) |
POST /api/autopilot/runs/delete |
Deletes runs by hand, or with preview counts what would go (see Run history) |
POST /api/autopilot/runs/:id/retry |
Retries a failed or skipped run (see A pass) |
POST /api/autopilot/runs/:id/dismiss |
Dismisses a flagged run's attention flag (see Needs attention) |
GET /api/autopilot/automations/:automation/week |
An automation's last seven days (see Health and hints) |
POST /api/autopilot/hints/dismiss |
Dismisses a tuning hint by id |
POST /api/autopilot/auto-pauses/resume |
Resumes an automation that paused itself in a project |
GET /api/autopilot/orchestrate/:projectId |
Orchestrate in one project: next slot, what holds it, Run now, the latest run |
POST /api/autopilot/orchestrate/:projectId/run |
Orchestrate's Run now (202), or 409 with why it can't start |
Auto-archive Done (auto_archive, #91; automations/autoArchive.ts). Needs no agent and is off until switched
on. Archives (never deletes) a task that has been in Done for more than days days (default 14, minimum 1, set
per scope), logged as archived plus the note "Archived by Autopilot after N days in Done" under the actor
autopilot. It skips tasks in an epic (archiving them one by one would leave the epic with none counted and send it
back to Backlog), except Done tasks whose epic is already archived, which count as loose (epics archived before
they took their Done tasks along left those behind), and tasks with an open, draft or not-yet-polled PR. The dedupe key is
archive:<taskId>:<statusChangedAt>, so a manual unarchive sticks until the task leaves Done and comes back.
A finished epic is archived with its tasks instead: an epic that isn't archived, is in Done (so every unarchived
task is Done, closed or not), has been there for more than days days (its statusChangedAt) and has no open, draft
or not-yet-polled PR on it or on any of those tasks. The setting is resolved on the epic (epic, then project, then
board; epicScope: true, so the epic's popover offers it, with its own days), and an epic that is switched on
archives even while its project is off. The action is tasks.archiveFinishedEpic: one write that archives each
unarchived task and then the epic, as autopilot, without re-deriving the epic's status in between (going through
update would drop it to Backlog when the last task leaves its roll-up). It logs archived on each and the note
"Archived by Autopilot with its N tasks after D days in Done" on the epic. Tasks already archived stay as they were.
The dedupe key is archive-epic:<epicId>:<statusChangedAt>, so unarchiving the epic by hand sticks until it leaves
Done and comes back. The engine resolves a candidate that is an epic on the epic itself; a dry run says "Would
archive #N with its K tasks after D days in Done". Unarchiving such a task, or reopening it, unarchives its epic
(epics.md).
Reminders, no longer automations. Remind me about stuck tasks (unstick, #88) and Unblock dependents
(unblock_dependents, #92) needed no agent and only notified, so they left the catalogue: they are the task_quiet,
thread_waited and task_unblocked notification settings, found by sendReminders on the engine's pass
(autopilot/reminders.ts, notifications.md). They have no scopes, no
config (24 hours quiet and 30 minutes waiting are fixed, as their labels say), and no runs: the run history keeps the old ones, named by
RETIRED_AUTOMATION_TITLES, and a Needs-attention reason from an old Unstick run still clears on new activity
(attentionFor). Getting stalled work moving again is Orchestrate's job (below). Migration 047_reminder_notifications
turned each switch on where its automation was effectively on, and dropped the automations' autopilot_settings rows.
Recurring tasks (recurring, #89; automations/recurring.ts). Needs no agent and has no switch: it is alwaysOn, so
every project is on for it (resolve and enabledProjects say so, which is what the engine and Pause all's restart use), while its
scope entries stay Inherit and not enabled, so a lane's pill doesn't read On because of it, and setScope refuses it
with a VALIDATION, and a rule that is enabled runs. Pause all still holds it back; quiet hours and the caps never
did (it needs no agent). Makes a task from a template on a schedule; the rules are rows in autopilot_recurring (below).
It has no config of its own. Migration 048_recurring_without_switch disabled the rules of every project where it was
effectively off, and dropped its settings rows.
- A rule has a name, a template (board-wide or the project's, with a title pattern), a schedule, whether its tasks
carry the Autopilot flag (On), and an enabled switch. The schedule is
weekly(weekdays and a time) orevery(N days from a start date, at a time), in the server's local time (nextDueandlatestDueinpackages/contracts/src/recurring.ts). Slots are found by calendar day, so a DST change never shifts them: a time the clock skips runs an hour later, a repeated one runs the first time. checkreturns, per enabled rule, the latest slot after the rule's cursorlast_due_atthat is due. Only the latest: after downtime of the board there is one catch-up task, not one per missed slot. The dedupe key isrecurring:<ruleId>:<slot>. The cursor and the key hold the slot as a local wall-clock stamp (2026-10-12T09:00:00,localStamp), not an instant, so a machine that moves to another time zone doesn't see a handled slot as new.actcreates the task throughservices.tasks.createwith the template: Planned when the template has a plan, Backlog otherwise, flagged On when the rule says so, under the actorautopilot, then adds the note "Created by Autopilot from recurring rule ". The title and description render{{date}}and{{project}}as of when the task is made, so a catch-up task carries the day it was made, not the day of the slot it stands for.- It skips (the run is
skipped, with the reason) while the task the rule made last is still open: not Done (closed tasks are Done) and not archived. A deleted template fails the run with "pick another one". - Whatever the outcome,
actmoves the cursor to the slot (recurring.handled), so the next pass looks for the slot after it, and never moves it back. The cursor is also what stops a duplicate when runs are gone (a restore doesn't bring runs back). Preview everything records "Would …" and leaves the cursor, so turning it off makes the task. The automation's own Preview does too, but turning it On restarts the rules (onEnabled), so a slot only previewed is not made. - A rule's cursor starts at its creation time, and is set again when the rule is switched on or its schedule
changes, so slots from before that aren't caught up. The same goes for Pause all: when it is lifted,
AutopilotServicecallsonEnabledfor every project and the rules restart from now (recurring.restart). Only downtime of the board itself catches up. - Rules are managed in the Recurring tasks detail in Settings → Autopilot (
components/recurring/); with a project picked in its own menu (local state, not the URL) it lists that project's rules and offers example rules: adding one creates a template for the project (reusing one of the same name) and the rule. The Recurring tasks row in Settings → Autopilot has no switch (alwaysOnhides it, andscopeAutomationsleaves it out of the lane and epic popovers); its detail lists every project's rules (RecurringRulesByProject), each with its switch, next run, last task and a New rule for that project (ProjectRuleRows). The rule editor keeps its path (/settings/project/recurring/$ruleId?project=) and returns to that detail.
REST only, like the rest of Autopilot:
| Route | Does |
|---|---|
GET /api/projects/:id/recurring |
The project's rules, each with nextDueAt |
POST /api/projects/:id/recurring |
Creates one (name, templateId, schedule, flagAutopilot, enabled); 409 on a name the project has |
PATCH /api/recurring/:id |
Edits it |
DELETE /api/recurring/:id |
Deletes it; tasks it made stay |
Every change publishes autopilot.changed, which the web app uses to refetch the rules.
Review PRs (review_prs, #95; automations/reviewPrs.ts, contract in packages/contracts/src/prReview.ts).
Needs an agent and is off until switched on. Reviews a pull request linked to a task and posts the review on GitHub,
as comments only (task PRs only where ownPrs is on). With Other people's PRs on, it also reviews other people's open PRs and
approves, asks for changes or hands them to the user.
-
Trigger. A
prlink whose snapshot (from theghpoller) is open, or draft when Review drafts is on (off by default), and has aheadOidandheadRef. Merged and closed PRs, PRs from forks (isCrossRepository: the branch isn't onorigin), Done and archived tasks, epics and links with no snapshot yet are skipped. The dedupe key isreview:pr:<linkId>:<headOid>: one review per PR and head commit, and a push gives a new one. -
After the local review. With auto-review on for the task, its PR isn't reviewed until the task is in Review and its local review has ended. Before that it waits: a task still in Backlog, Planned or In Progress hasn't started its loop (the move to Review opens round 1), and in Review a loop that is still going (
reviewIsInProgress: a round pending, running or stalled, or blocking or major findings open with rounds left) holds it. An agent that opens its PR early would otherwise get it reviewed on GitHub while the loop is still changing the code. A task sent back to In Progress after feedback waits for its next loop the same way. Once the loop ends (clean, or the round limit, stuck included) the PR's current head is reviewed as usual; a failed round isn't waited on, and tasks with auto-review off are never held back by the loop. -
While the task's agent works. A round that ends with only minors open counts as a finished loop, but the agent is told to fix them, so its push is on the way. So, with auto-review on or off, a PR also waits while the task's agent is at work (
prWaitsForAgentinrunThreads.ts): a T3 thread of the task'sworking(or linked under two minutes ago with no status read yet; not a follow-up, settled or archived thread, nor one whose snapshot the live poll stopped refreshing ten minutes ago), an agent session the board reads asbusy, or a Start planned, Fix PRs, Task sessions or custom automation run on the task that is queued, running, or whose T3 thread is stillworking(t3RunWorking). A thread waiting on subagents, a monitor or the user doesn't hold the PR: an agent watching CI, or waiting for this review to merge, would otherwise wait on Review PRs while Review PRs waits on it. That wait ends 45 minutes (AGENT_WAIT_CEILING_MS) after the later of the latest round's submission and the head's move (headSeenSince), so a session left busy can't hold reviews for ever. And after every head move the PR waits two minutes (PR_SETTLE_MS), so a run of pushes settles first. A waiting PR yields no candidate, so nothing is recorded; the next pass looks again. Only Review PRs waits this way: Merge ready PRs already waits for its verdict at the current head, andmerge_task_prand thelinknote keep the loop's gate alone. -
One at a time, and rounds. While a review of the PR is queued or running, a new head commit waits; the next pass reviews the latest head with the earlier review in view. A PR gets at most Rounds per PR reviews (
rounds, default 3): the rounds used are its real review runs, a failed one included and a skipped one (which posted nothing) not, and neither a carried verdict nor a resolution review (below: their output has abasis,isCountedReview). Every new head still gets a run, rounds left or not, so nothing is skipped silently (see Head moves, below). Fix PRs counts its attempts on Autopilot's review and failing checks against a limit of its own (attempts, also 3 by default); each fix is followed by at most one new head and so one review. Other people's comments have a budget of their own (commentAttempts, below). -
Head moves: base merges and the last round. When the PR already has a verdict,
actfirst asks git how the head got from that verdict's head to the new one (autopilot/headMove.ts):fetchForHeadMovefetches the PR's base and head branches into the project's checkout (its fetch waits its turn at the same per-repository gate as the runner's worktrees), thenclassifyHeadMovereads the history. Only merges of the base branch in leave the PR's own change as it was reviewed, so only those are let off a round: every first-parent commit since the reviewed head must be a two-parent merge whose other parent is already onorigin/<baseRef>. Each is then checked against git's own merge (git merge-tree --write-tree, git 2.38+): the same tree is a clean merge, a different one (conflicts resolved by hand, or an edit slipped into the merge) a resolved one. Anything else (a commit of the PR's own, a rewrite or force-push, a merge of another branch, the base merged the other way round) is a change.- Clean base merge: the verdict is carried. No agent runs and nothing is posted: the run succeeds with the last
verdict at the new head (
basis: "carried",carriedFrom: <old head>, the sameround,handoffand review id), and the task gets a note "Autopilot carried its review of PR #N … No review round used". This holds for any verdict, so a clean one lets Merge ready PRs merge and afixone is still Fix PRs' to act on (once: its trigger key is the review id, which the carry keeps). - Hand-resolved base merge: a resolution review, not counted. The prompt says round N already covered the
PR's own change and asks the reviewer to check only how the conflicts were resolved (a side's change lost or
doubled, code that no longer fits the other side, markers left in, unrelated edits), with
git show --remerge-diffof the resolved merges inlined as untrusted text (cut atMAX_REMERGE_DIFF, 40,000 characters). It is posted like any review, headed "Conflict resolution review (not counted), after round N of M"; its output hasbasis: "conflict_review"and the last counted round. Its verdict also counts what the review before it left open (counts,actionableand sohandoff; the posted body names that review, andopenFrompoints Fix PRs at it), since the merge didn't change the PR's own code: a clean resolution can't wave through points nobody fixed. A git too old to check a merge (nomerge-tree --write-tree) treats it as resolved, and one with no--remerge-diffgets a full review instead, still uncounted. At mostCONFLICT_REVIEWS_PER_PR(5) per PR, as many as Fix PRs' conflict attempts; past that the run is skipped, flagged: "PR #N merged in with conflicts resolved by hand again, after 5 conflict resolution reviews …". A resolution review that fails is flagged like any failure but keeps itsbasis, so it costs no round. - A change of the PR's own is a counted round while rounds are left. With none left the run is skipped and
flagged, so the card says why the PR waits: "PR #N changed after Review PRs' last round (round 3, at
<sha>):<reason>. Review and merge it yourself, or retry this run to allow one more round." Retrying it (the run's Retry, orretry_autopilot_run) grants exactly one more round for that PR at that head: the retried run keepsoutput.roundsUsedUp, and a retried notice whose (retired) key is of the PR's current head adds one to its rounds. A later head goes back to the configured rounds, and a notice of an older head can't be retried (the board calls it history), so no round is banked for later. A resolution review after a granted round still says "round 4 of 4" (maxRoundsis at least that of the review it follows). Retrying the conflict-review notice (output.conflictReviewsUsedUp) allows one more resolution review the same way. - When git can't tell (a project with no folder, a base branch the poller hasn't read, a fetch that fails, a commit git doesn't have), the move counts as a change: it may cost a round, but never lets code through unreviewed. A PR with no verdict yet is always a counted round.
- Clean base merge: the verdict is carried. No agent runs and nothing is posted: the run succeeds with the last
verdict at the new head (
-
Resolving its own threads. From round 2 the prompt asks the reviewer to list, in the verdict's optional
fixed, the comment ids of earlier Autopilot inline comments whose point is fixed at this commit. After posting,resolveConfirmedThreadsreads the threads fresh (reviewThreads) and resolves those (resolveReviewThread), only where the thread's first comment is in one of the earlier rounds' reviews (rootReviewId), so a reviewer can't close someone else's point. A failure leaves the thread open and doesn't fail the review; the count goes on the output asresolvedThreads. This covers points fixed by hand, which Fix PRs' resolver (below) never sees a reply for. -
The agent only reads, and only its worktree. It runs headless in a worktree on the PR's branch with
access: "read-only"and an output schema. It has no way to write to GitHub. Because it reads text anyone can write (the PR's description and comments), the request setsuntrustedInput, which gives it the least it needs:- no board tools and no other MCP servers (
--strict-mcp-config), and--setting-sources user, so the branch's own.claude/settings.json(allow rules, hooks) never applies. The user's own settings stay, because some carry the login;--tools Read,Grep,Glob,Bashkeeps a global allow rule of theirs (WebFetch and the like) from finding a tool, but a broadBashallow rule of theirs would still widen what the reviewer may run; - file tools scoped to the worktree (
Read(./**)and so on; a bareReadreaches any file the user can); - git in three exact commands only (
rev-parse HEAD,status --short,log --oneline -20), becausegit diff,showandlogtake any path, so read any file (a path outside the work tree makesdiffcompare files) and write any file (--output=); - the PR itself only through its run tools (
runTools: {toolSet: "prReview", target}):pr_overview,pr_files,pr_diffandpr_comments, bound to this one PR, served by the board and paged so a diff of any size is read in full. Noghand no network: the run tools' server is its one MCP server.
Before the agent starts the runner checks the worktree is at the commit the run is about (
expectHead,WorktreeHeadError) and, when it isn't, removes the worktree and its branch (the run records neither). A branch that moved past the commit skips the run. So does a rewritten branch (a force-push) oncectx.gitHosts.prHeadsays GitHub's head is no longer that commit; if GitHub still says it is, the checkout is what's wrong (a staleorigin, a fork's branch name that exists onorigin, a PR in another repository) and the run fails, flagged, before any budget is spent. A read-only run may read the default branch (a PR frommain), since it can't push. A review has to be held to read-only, which a T3 thread can't be, so the runner setting is Auto or Headless and both run headless. Its budget and timeout are the board's agent defaults unless it overrides them, and it follows the Review skill chosen (the built-inaboard-reviewby default; a skill on disk is inlined into the prompt). The prompt calls the PR's text untrusted, and says nothing is recorded on the board. The reviewer has no board tools, so the prompt's The task section (taskSection) carries the spec it judges against: the task's description, plan context and plan (a checklist with each step's status and notes), each fenced and cut at 16k, 8k and 12k characters. It also says the plan is the author's progress, not criteria (an open step such as merging isn't unmet), and how to treat acceptance criteria, in the task and in the PR description: each is judged on the evidence (a tick without evidence doesn't count; an unticked one isn't met unless the change plainly meets it), one the change could meet and doesn't is blocking, and one that asks for a person's decision in review (open questions, a sign-off), or a task or document that calls itself a draft for review, is raised as a blocking point titled "Needs a person: …", which only the user settles: the reviewer can't tell who wrote a comment or a change, so once raised it raises the point again on every round (a declined reply doesn't settle it) until the task says it is settled or the user merges by hand. Fix PRs' prompt tells its agent to leave such a point alone and only reply that it waits. The server reads the title (isNeedsPersonTitle): such points are listed in the run'sneedsPerson, still count inactionable(so the merge gate stays shut), and flag the run for the user's attention with the questions (see Hand-off). A conflict resolution review leaves the section out. - no board tools and no other MCP servers (
-
The server posts. The agent answers with a summary and every point (severity, file, line, body, suggestion,
fyi).renderReviewbuilds one review from it: the summary under📋 <displayName> Autopilot review(prReviewHeader, fromBRAND), points with no place in the diff and the FYI ones in the body, and the rest as inline comments starting with📋 <displayName> Autopilot · <severity>.ctx.gitHosts.postReview(GitHub'sGitHost,githubHost.ts) sends it with theghtoken as a GraphQLaddPullRequestReviewwithevent: COMMENT: it can never approve or request changes, and it comes from the user's ownghlogin. It first reads the PR's live head and refuses withStaleReviewErrorwhen that isn't the commit that was reviewed (a push while the agent worked): nothing is posted, the run is skipped, and the new head is reviewed next as the same round. GitHub refuses a whole review over one comment on a line outside the diff, so it then posts again with the inline comments in the body; a body is cut to what GitHub takes. GitHub can also create the review and answer with an error ("An internal error occurred, please try again"): after such a transient errorpostReviewfirst reads the account's own reviews on the PR (findPostedReview) and, when one at that head starts withprReviewHeader, counts it as posted instead of failing or posting twice. The inline fallback runs only for a refusal that isn't transient. Its errors are prefixed "GitHub couldn't post the review: …", so a card doesn't read like an Aboard or Claude failure. The agent doesn't post itself because Claude Code's permission rules can't scopegh apiwrites to a review (and can't see aneventinside a heredoc), it refuses a JSON payload in a heredoc, andgh api -fcan't build the inline comments reliably. -
Verdict. The board counts the non-FYI points by severity; those at or above the fix threshold are the actionable ones. The threshold is Fix PRs'
fixThreshold(default major), resolved where the task is (fixThresholdFor), whether Fix PRs is on or not, since what gets fixed is Fix PRs' call. -
Anti-spiral. From round 2 the prompt carries the round ("round 2 of 3"), the earlier Autopilot reviews with their URLs and counts, and the rules: look for regressions and earlier points still unfixed, don't raise again what was fixed or declined with a reason, and mark new minors and nits
fyi(they go in an "FYI (no action needed)" section). On the last allowed round the bar is raised to at least major (effectiveFixThreshold: minor and nit become major; blocking stays) and the prompt says no round follows. -
What the board keeps. The task gets a note "Autopilot reviewed PR #N at
<sha>(round R of M): review on GitHub", linking the review, and the run gets its verdict inoutput(PrReviewRunOutput: review URL and id, the head commit in full, round, counts, FYI count, threshold, actionable count andhandoff). An answer that isn't a review fails the run, flagged, and nothing is posted; a review GitHub refuses fails it too, and so does an agent that failed (its text is the run's error: for an API error, such as a 403,claudeFailuresays that text rather than only the subtype). GitHub failing in passing (isTransientHostError: "try again", "internal error",HTTP 5xx, a timeout or the network) while posting ends the runskipped("will retry"), not a round used, withoutput.retry; each try is a full review, as the agent runs again. The next pass reviews the same head again under the keyreview:pr:<linkId>:<headOid>:<n>, up toREVIEW_ATTEMPTS(3) tries, after which it fails, flagged. Any other failed run is never retried, so there is one review per head commit even when posting failed. -
Hand-off.
handoffsays what comes next:clean(nothing at or above the bar: the loop ends),fix(something is, with rounds left)gave_up(something is, on the last round: the run ends flagged "Autopilot gave up…", which shows under Needs attention and sends anautopilot_failednotification) orneeds_person(the only points left are "Needs a person" ones: Fix PRs has nothing to do, and the run ends flagged with the questions). Afixverdict that also has such points is flagged the same way, while Fix PRs fixes the rest. Across a base merge they carry over: a carried verdict keeps them and stays flagged, and a resolution review adds the earlier review's open ones to its own. The fix automation readscurrentPrReview(runs, linkId, snapshot.headOid): the newest finished review of the link (highest round; on a tie, which a carried verdict or a resolution review makes, the newer run), and only while itsheadOidis the PR's current head, so a superseded or stale verdict is never acted on. The review ids on the runs are how it tells Autopilot's own reviews from other people's. -
Limits. Switching the automation on reviews every open PR already linked in the project, once per head commit; dry run shows which first.
Board task #21 (epic #123). Review PRs' second source, off until Others' (otherPrs) is on in a
project's config: open pull requests of the project's repository, by the logins in People (otherAuthors), that
no task works on. It replaces the custom "Autopilot PR review" automation the owner ran, and the shipped Review repo
PRs example. The difference that matters: the agent only reads and answers; the server finds the PRs, works
out the mode and the approval gate from the PR's history, and posts. The gate is code, not a line in a prompt.
automations/repoPrs.ts (poll, prompt, posting, board writes), repoPrAssess.ts (which PRs and how), contract in
packages/contracts/src/repoPrReview.ts.
- Settings. In the table (
inWhereTable, so the settings draw no row): Others' (otherPrs), People (otherAuthors, comma separated,parseLogins: lower-cased, a leading@dropped) and Approve (otherApprove, off by default). Advanced: Require a linked issue (on), Sensitive paths (DEFAULT_SENSITIVE_PATHS:.github/,tools/,CODEOWNERS,*.lock,package-lock.json,pnpm-lock.yaml,go.sum;dir/is a root folder, a name with no/matches in any folder,*stops at/,**doesn't:matchesPathPattern), Quiet period (10 minutes), Other reviewers' wait (60 minutes) and Rounds (3). The first three are per project, in the Where it runs table below. On with nobody listed it reviews nothing and raises nothing: the table's row asks for people. - Where it runs (
ReviewPrsProjects,reviewPrs.logic.ts). Columns Your PRs (ownPrs, default true, task PRs skipped where false, unless the task's epic set its own On or Preview:reviewsTaskPrs, which the merge gate reads too, so a PR isn't held for a review that won't come), Others', People and Approve, the last two empty where Others' is off. The engine only looks at projects where the automation is on, so a project runs if either source is on, and a source's switch writes the mode together with both source keys in one PUT, so turning a switched-off project on can't bring back a source left behind. A project stores a key only where it differs from the board, whose keys are the All projects row (no migration: an old board'sotherPrsand friends read the same). A project'sotherAuthorsreplaces the board's list; matching it again drops the key. A header click writes the board first, then each project against the new board;opensAllDetailandexpandsOnTurnOnopen the people where a row has none. A project with no folder (General) is skipped before any read, so it records no failed run. The name pills offer logins already in use: the default, each project's list and authors waiting under Needs you, so nothing new is read from GitHub. - Finding PRs. The check can't read GitHub in a pass, so
otherPrCandidatesstarts a read per project in the background everyOTHER_PRS_POLL_MS(5 minutes, or at once when the settings change) and wakes the engine when it ends; each pass offers what the latest read found. The repository is the project folder'sorigin(CheckContext.repoOf,createRepoUrls), and the reads go throughCheckContext.gitHosts:listOpenPrs(the newest 100 open PRs), thenreadRepoPrfor each one by a listed author (REPO_PR_QUERY, one GraphQL query: closing issues, files, the newest 100 commits with parent counts, the head's checks withisRequired, latest reviews, reviews, comments with edit times, threads with comments, dismissed reviews and the open issues of the same repository that mention it). The base branch's required checks also come from its rulesets (RESTrules/branches/<base>) and its classic branch protection (baseRef.branchProtectionRule .requiredStatusCheckContexts), so a required check that never reported is seen. Drafts, PRs linked to a task that isn't manual (those are the task source's and Fix PRs'), and PRs of anyone else are skipped. A read that fails becomes a failed task-less run, once a day per error, so it isn't silent. - History from the markers. Nothing about a PR's history has to be remembered: everything Autopilot posts ends
with a hidden marker, the same one the custom automation wrote, so switching over keeps rounds, approvals,
hand-offs and stops. A review ends
<!-- autopilot-review head=<sha> verdict=approve|changes counted=1|0 round=<n> -->, a hand-off comment<!-- autopilot-review event=escalated head=<sha> reason=<reason> round=<n> counted=1 -->, an inline point<!-- autopilot-review finding -->. Old posts withoutroundcount one round each when counted; v1 hand-offs have no reason and v2'sno_issuereads asgate./autopilot stopand/autopilot resume(parseControlCommand, at the start of a comment, any case) count only from the signed-in account and without a marker; the newest wins, and a resume starts the history afresh. - Which PR, which mode (
assessRepoPr, a port of the custom automation's check):- skipped while stopped, while a person's approval or request for changes stands (the user's hand review too: it has no marker), while any counted check is pending, until the quiet period has passed since the head commit and its last check, and while another reviewer's unresolved thread is younger than the wait and the author hasn't answered in it;
- the newest of Autopilot's reviews, its hand-offs and the user's own approval that someone else's push dismissed
(
REVIEW_DISMISSED_EVENT) sets the mode: none isfull; the same head after an approval or a hand-off is skipped; the same head after changes is adisputeonly once the author replied on one of Autopilot's open threads (the reply's id goes in the key), else skipped; a newer head after an approval isdelta(skipped when its approval still stands and nothing the author wrote changed); after a hand-off,followup(skipped likewise); elsefull.full,disputeandfollowuppast the rounds becomecap_reached; - "nothing the author wrote changed" is
GitHost.unchangedSince: the PR's change against its base branch (compare <base>...<old head>and...<new head>) is the same patch, hunk line numbers ignored. That holds after merging the base branch in or rebasing onto it, and fails for a merge of any other branch, an edited merge, and any file GitHub serves no patch for (binary, too large), which can't be compared. A hand-off edited later counts from its edit. - The key is
review:repo:<host>/<repo>#<n>:<head12>:r<resume id>[:c<reply id>]; one review of a PR runs at a time.
- The gate (
approvalGate): a closing issue (when required), every required check finished, green and reported, at most 100 files (all of them read), no sensitive path. The rulesets' required checks must be readable (anyone who can read the repository can): a failure to read them fails the read of the PR, so it is judged on a later pass, never as if nothing were required. Classic branch protection's list may be hidden from an account without admin rights; then only the checks GitHub marksisRequiredon the head count. The agent is told the reasons but not asked to obey them. - The review. A task-less, read-only headless run with
untrustedInput, in a worktree of the project's checkout at the PR's head (RunnerRequest.checkout: removed when the run ends; a fork's PR gets an empty folder), on therepoPrReviewrun tools: the PR review set pluspr_threadsandrepo_issue.repoPrPromptgives it the mode, the base commit, the round, the closing and the mentioning issues (the bug report a past approval missed), the gate, what to read (the project's docs and decision records), the severity scale (only blocking and major hold up approval; in a doc, plan or runbook a contradiction, a step that can't be followed or a wrong claim about the system is major, and opinions on strategy are observations in the summary), acceptance gates (below), a concurrency and contract checklist, when a recorded decision is a departure and when it isn't, and the review skill chosen for Review PRs (inlined). It answersRepoPrReviewVerdict(REPO_PR_REVIEW_OUTPUT_SCHEMA): the PR review's answer plusdecision(approve, request_changes, escalate), anescalation(reason: departure, dependency, security, dispute, vague or review_gate; one line; a checklist),disputesper thread of its own (accepted, rejected, unsure, with a reply) andcounted. - Acceptance gates. The prompt tells the reviewer to read the gates in each issue the PR closes and the ticks and
evidence in the PR description, and to judge each gate on the evidence: a tick without evidence doesn't count, and
an unticked gate isn't met unless the change plainly meets it; one the diff could meet and doesn't is a blocking point; one that asks for something to happen in review (open questions answered, a
sign-off, a decision), or an issue or document that calls itself a draft for review, is escalated as
review_gate("an acceptance gate needs your decision") with each open item in the checklist. Approve needs every gate met. - Read again before posting. The poll can be minutes old by the time the agent answers, so
actRepoPrreads the PR again (readRepoPr) before it posts anything: a moved head skips the run,/autopilot stop, a person's standing review or a closed PR skips it with nothing posted (standingBlock), and the gate is worked out afresh, so an approval never rests on a check that has since turned red or aCloses #nthat was removed. - What the server does with it (
settleDecision). Minor points and nits are always FYI. An approval with a blocking or major point open is a request for changes, and a request for changes with none open is a clean review (minor points never block a merge). A request for changes incap_reachedis a hand-off forcap. An approval with the gate failing, or with Approve off, isready. Only a clean approval past the gate is posted as one:postReviewwithevent: "approve"(orrequest_changes, blocking and major points inline, folded into the body when GitHub refuses them), refused withStaleReviewErrorif the head moved, which skips the run.counted: falseis honoured for an approval or a ready-for-approval indeltaorfollowup, so small re-checks don't walk a PR into the round limit. GitHub failing in passing while posting (isTransientHostError) skips the run withoutput.retry, and the next pass tries again under<key>:a<n>, up toREPO_REVIEW_ATTEMPTS(3); so does GitHub failing in passing on the read before the post. A try finds the post an earlier one made if GitHub took it and still answered with an error (postedSince: a post of its own at this head after the plan'slastPostAt), and then posts nothing. - Hand-offs. The head is read again first; a moved PR skips the run with nothing posted or written. One comment
(
renderHandoff): the header, the round, "Handed to @you for manual review (): " or "Ready for @you's approval: ", the summary, every point, the checklist, and that Autopilot looks again by itself on a push. When the latest hand-off on the PR has the same reason, that comment is edited (GitHost.editComment) instead of another posted. A real escalation finds the open manual task for the PR (the one remembered, one linking the PR, or one titledReview PR #n:) or creates one (manual, labelreview, the PR linked, the checklist), and asks for attention only when the task is new or the reason changed; a repeat adds a note. AreadyPR makes no task and pings nobody: it goes under Needs you (AutopilotNeedkindpr_approval, fromrepo_pr_reviews.ready_since) with apr_readynotification, and leaves it once a person reviews it, it is stopped, closed or merged, a new head comes, or its author leaves the list; the list also hides rows of projects where the source or Review PRs is off. While it waits, each poll works the gate out again at that head: a reason that changed is updated, and once the gate passes (a required check re-run green, an issue linked) and Approve is on, the PR gets a fresh look (approveReady, key…:approve:<hash of when its wait was last written>) that uses no round: the agent is told it found the PR clean before and checks what can change without a push (new threads, issues that mention it), and the server approves past the gate or, if it is held again, edits its Ready comment with the new reason. Skips carry a typedcode(ENDS_WAITlists the ones that end the wait). - Afterwards. Its own threads the review says are fixed, and disputes it accepted, are resolved
(
resolveReviewThread); accepted and rejected disputes get the agent's reply on the thread. An approval, or the first review after a resume, closes the PR's hand-off task (a note, attention cleared, Done). Fix PRs never acts on these PRs: they have no task. - What the board keeps.
repo_pr_reviews(migration 046,services/repoPrReviews.ts), keyed by host, repository and number: the last head, round, outcome and reason, the hand-off comment to edit, the manual task andready_since. The run's output isRepoPrReviewRunOutput. Neither is in backups; the markers on GitHub are the history.
Fix PRs (fix_prs, #96; automations/fixPrs.ts). Needs an agent and is off until switched on. Sends an agent
to fix a pull request linked to a task.
-
Triggers, each with its own switch (all on by default), read from the
ghpoller's snapshot of an open or draft PR with aheadOidandheadRef(merged and closed PRs, forks, Done and archived tasks and epics are skipped). Each has a key that fires once:-
failing checks:
checks@<headOid>; -
merge conflicts:
conflict@<headOid>; -
changes requested: while
reviewDecisionischanges_requested, the newestchanges_requestedreview from a trusted author (below) that isn't Autopilot's:changes@<reviewId>. The user's own counts: Autopilot only comments; -
review comments: comments on unresolved threads that aren't
own, are from a trusted author, aren't in one of Autopilot's reviews, and are newer than the newest comment an earlier attempt was given:comments@<newestId>. The poll reads no thread bodies, so it can't tell the user's own comments from Autopilot's replies (Autopilot posts as the user): a thread whose newest comment is the user's account's (ownLast) is left out of the poll's comments altogether: it was answered, and asking again would let two review bots ping-pong. With Review summaries and PR comments on, the fresh thread read below tells the user's own words apart, and they join this trigger; -
review summaries and PR comments (
onSummaries), what is asked for outside an inline thread:- a review summary: each reviewer's newest review, leaving out replies on threads (an empty commented review) and
Autopilot's own (marked, or one of its review ids), counts when it is
commented, has a body (hasBody), is on the current head (commitOid) and is from a requester (below):summary@<newestReviewId>. A summary the same reviewer followed with an approval or a request for changes is superseded; - PR comments: conversation comments (
conversationComments, the newest 10) from a requester, posted after the head commit (headCommittedAt: one from before was there when the last push was made) or after the PR was read for the newest attempt (lastAttemptAt, the attempt'soutput.prReadAt, else when it was decided: one posted while an attempt was at work wasn't given to it, though its push is newer), and newer than the newest an earlier attempt was given:conversation@<newestId>. So a push of the user's after an attempt doesn't count as answering the comments posted since that attempt: they start a run, and the agent judges them; - the user's own replies in threads: the resolving read (below) reports a thread whose newest comment is the
user's own, with no mark, in its output's
requests; while it is still that thread's newest comment, the next pass adds its id to the review comments trigger (ownin the trigger, so the prompt says so).
A requester (
requestAuthor) is a trusted author, or the user: a comment of the user's own counts unless its first line carries the mark every post of the board's agents starts with (isAutopilotMarked): Autopilot's (prReviewMarker, "📋 … Autopilot …") or a Fix in → session's (prFixSessionMarker, "📋 … · fix session"). Another agent posting as the user without a mark looks like the user; the agent's judgement (below) covers it; - a review summary: each reviewer's newest review, leaving out replies on threads (an empty commented review) and
Autopilot's own (marked, or one of its review ids), counts when it is
-
Autopilot's review:
currentPrReview(...)withhandoff: "fix":review@<reviewId>.
Autopilot's own reviews are told apart by the
reviewIds on Review PRs' runs.A trusted author (
trustedAuthor) is one with access to the repository (trusted:authorAssociationOWNER, MEMBER or COLLABORATOR,TRUSTEDingithubSnapshot.ts) or a login in Trusted bot reviewers (trustedBots, comma separated, default empty). GitHub often marks a review bot installed as an app NONE, so without the list its points never start a fix. The list is opt-in per login: nobody marked NONE is trusted otherwise, since some bots post comments that need no answer. Logins are compared withnormalizeLogin(packages/contracts/src/repoPrReview.ts): lower-cased, without a leading@or the[bot]suffix GitHub's REST API adds and GraphQL leaves off. The snapshot doesn't carry whether an author is a Bot, so a listed login matches any account with that name, a machine user's too (an app's own name can't be taken by a user, but a login without an app behind it can). A listed bot's comments and requests for changes arecommentsandchangestriggers like a person's, so they count againstcommentAttempts, and theownLastrule above still keeps two bots from ping-ponging. Fix in → picks a listed bot's changes-requested review too. -
-
Batching and dedupe. One candidate per PR link carries every trigger that hasn't fired yet, with the key
fix:pr:<linkId>:<headOid>:<trigger keys joined by +>. Earlier attempts' triggers are read back from their keys (parseFixKey), so a failed attempt, which leaves no output, still counts what it was given; a skipped one didn't act and counts nothing. Triggers still holding from an earlier attempt are listed in the prompt for context. While a fix or a review of the PR is queued or running, the PR waits. So it does while an attempt handed to a T3 thread (a nudge, or a new thread) is still working on it (t3RunWorkinginpackages/contracts/src/runThreads.ts, shared with Start planned): those runs end as soon as the message is sent, so without this, comments arriving while the agent works would use up the attempts and give up before it pushed. -
Action. When the task's implementing thread (never a follow-up the user opened to ask about the work) is there, not settled, and seen by the live poll in the last ten minutes (so T3 Code is up to take it), and the runner isn't set to headless, the fix prompt is a nudge into it. Otherwise the runner starts a session (T3 or headless, from the runner setting) with
workspace: { branch: headRef }andexpectHead: a branch that moved on skips the run, and one at an unrelated commit fails unlessprHeadsays the PR moved (a force-push). The prompt has a section per trigger with theghcommands to read it. For Autopilot's review it gives the counts and the review'sthresholdand says to fix only points at or above it and leave the FYI section alone. Comments are named by id (gh api repos/<repo>/pulls/comments/<id>), and the agent is told to read only the reviews and comments listed, which come from people with access, reviewer bots the user trusts or the user. With PR comments it is also given, by id, the earlier conversation comments it may read for context (a requester's, or Autopilot's own marked answers and questions), never the whole conversation, which anyone can comment on. When people's comments are in it, the agent judges each request rather than assume it right: it fixes it, declines it with its reason, asks a clarifying question when it can't tell what is wanted (changing nothing for it; the answer starts another attempt), or, for discussion, thanks or a status note, does nothing and posts nothing. With the switch off, none of that is in the prompt, nor the PR comment below: it is as before. The agent pushes toheadRefand then replies on each thread it was sent to, the reply's first line exactlyprFixedReply(sha)("📋 … Autopilot · fixed in ") for a point it fixed,prDeclinedReply(reason)for one it won't, orprQuestionReply()for one it needs clarified. What has no thread (review summaries, PR comments, and points of a request for changes' summary that no inline comment makes) is answered in one PR comment whose first line isprCommentReply()("📋 … Autopilot · reply"), posted withgh pr comment <url> --body-file <file>(PrAgentHints.prComment), one line per point; nothing is posted when none needs an answer. Replies go in a file posted withgh api … -F body=@file, because thegh api *merge*deny rule would refuse a command line that mentions merging. A custom Fix skill is inlined into the prompt. The run'soutputis{ kind: "pr_fix", linkId, headOid, round, attempt, triggers, via: "nudge" | "t3" | "headless" }. -
By hand. The PR row's Fix in → starts the same kind of fix for the user (GitHub PRs), with
manualFix's prompt, and the row shows this automation's state (running, gave up) in its action slot while it is on for the task. That session starts every reply and PR comment withprFixSessionMarker(), so Fix PRs doesn't take them for the user's own requests (parseAutopilotReplyreads them asother, which is settled, never resolved). Those sessions aren't runs: they don't count against the attempts or the caps, and Fix PRs does not see them (it may start an attempt of its own on the branch while one is at work). -
Resolving threads it fixed (switch
resolveThreads, on by default). The poll reads no thread bodies, so with no agent a candidate keyedfix:resolve:<linkId>:<headOid>:<hash of thread@newest comment ids>(resolveDedupeKey,startsNoAgent) picks the snapshot's unresolved threads the account answered last (ownLast) and can resolve, or any it answered last while Review summaries and PR comments is on (to find the user's own words; withresolveThreadsoff it then resolves nothing,ResolveData.resolveThreads), but not one whose newest comment is in one of Autopilot's own reviews (a point it just raised, not a reply). The action reads them fresh withreviewThreads(ReviewThreadDetail: the newest comment's body, and the PR's newest 100 commits) and resolves each whose newest comment is Autopilot's reply sayingfixed in <sha>(reply: "fixed",parseAutopilotReply, lenient enough for replies written before the format was fixed) with that sha prefixing one of the commits. A thread a listed trusted bot reviewer started (rootAuthor, the root comment's login, read only on this fresh read) is also resolved when its newest comment is Autopilot'sdeclined: <reason>reply: bots rarely come back to resolve a thread, an open one blocks a repository that requires conversations resolved, and the reason stays readable on the resolved thread. Only when nobody but listed bots spoke on it (speakers: the root's and the newest five comments' authors other than the signed-in account): a thread a person started or joined stays open for them. The candidate carries the parsed list (ResolveData.trustedBots). The others (a person's declined thread, the user's own words, Autopilot's review comment) go on the run'soutput.settledasthread@newestCommentIdand aren't read again until someone comments; one whose commit isn't on the PR is read again after the next push. With Review summaries and PR comments on (ResolveData.requests), the threads ending in the user's own words (no mark) are also listed inoutput.requests, which the review comments trigger reads (above). So a bot's declined thread settled before the bot was listed stays open until someone comments on it again. A thread GitHub refuses to resolve flags the run under Needs attention; the ones that did resolve drop out of the next poll, so the refused ones form a new set and are tried once more. It doesn't wait for a fix or review of the PR to finish, isn't an attempt and isn't counted as an agent run (FIX_RESOLVE_KEY_PREFIXis left out of the caps like the give-ups). The fix prompt tells the agent not to resolve threads itself; with the switch off it says the reviewer does. -
Limits. At most 2 attempts per head commit (
ATTEMPTS_PER_HEAD), counting every attempt that wasn't skipped or conflict-only (below), and per PR as many as each budget allows (FixBudget;attemptBudgetsreads an attempt's budgets back from its key):review(attempts, default 3) for Autopilot's review and failing checks,comments(commentAttempts, default 10, at most 20:MAX_COMMENT_ATTEMPTS) for people's comments, review summaries, PR comments and requests for changes, andconflicts(below). An attempt given triggers of both uses one of each. A colleague's review bot thus can't use up the attempts Autopilot's own loop needs, nor the other way round. When a budget is used up, a gave-up runfix:gave_up:<linkId>:reviewor:commentsgives up on that budget's triggers and the others still go ahead (a conflict that came with them becomes a conflict-only attempt); past the per-head limit,fix:gave_up:<linkId>:<headOid>. Each ends flagged "Autopilot gave up on PR #N: …". That puts it under Needs attention, logs the run on the task and sends anautopilot_failednotification. A new head commit starts the per-head count again. The gave-up candidate setsstartsNoAgent, so a full concurrency cap, a daily cap or quiet hours don't hold it back. A gave-up run endsskipped(output.gaveUp), so it can be retried.A fresh budget. Retrying a gave-up notice (the run's Retry, or
retry_autopilot_run(task, freshBudget: true), which Orchestrate uses; a plainretry_autopilot_runleaves the notices alone, so it never spends one by mistake) gives that budget a fresh start: its attempts, and the no-action verdicts for:no_action, count only from the newest retried notice of the same budget on (freshBudgets, by the run list's order, since runs made in one millisecond share acreatedAt). A retried:reviewor:commentsnotice also starts the per-head count again, and a retried:<headOid>notice does that alone. The next pass then acts on the triggers it had dropped, through the runner as usual (a nudge to the live thread, or a new session). At mostFRESH_BUDGETS_PER_PR(2) per budget, or per head commit, on a PR: the next retry is refused with the reason (freshBudgetRefusal, throughretryRefusal), from the board and from an agent alike. A gave-up notice never counts as superseded (isSupersededRun): Fix PRs' other runs on the task, such as another budget's attempt or a read of its threads, don't answer it. (Before the budgets were split the key wasfix:gave_up:<linkId>; a PR given up on under it gets a fresh look.)Runs that end in no action use no attempt, with Review summaries and PR comments on (
isNoAction): an attempt whose budgets are onlycommentsthat succeeded, left the head where it started, and was followed by no reply of the account's: no review of its own that isn't one of Autopilot's (a thread reply is one) and no marked PR comment of its own. That is the agent judging the comments discussion, and needs no report from it. Only the newest attempt is judged, once the snapshot was read after it ended, and only on a snapshot withconversationComments, so older snapshots count every attempt as before. An attempt handed to a T3 thread ends when the thread starts, so it is judged once the thread is idle, on a read after the thread'slastActivityAt(attemptEndedAt); when T3 doesn't say, or has seen no activity since the hand-off, the attempt counts. Until such a read comes, a new attempt waits (a poll at most), so the one before isn't left unjudged. It is judged on the first such read, and the verdict, either way, is recorded as a run of its own,fix:verdict:<linkId>:<runId>:no_action|acted(FIX_VERDICT_KEY_PREFIX, skipped, no agent, left out of the caps), and read back from there: judged later, a push, or its replies falling out of the poll's last 20 reviews and 10 comments, would change the answer. A reply the poll hasn't read yet when the verdict is taken can still make a run look like no action. Such runs are left out of the budgets and of the per-head count (two discussion comments at one head mustn't give up), but they cost money, so afterNO_ACTION_RUNS_PER_PR(20) verdicts on one PR a gave-up runfix:gave_up:<linkId>:no_actiongives up on the comments' triggers.An attempt whose triggers were all
conflict@…(read back from its key, so a failed one is classified too) counts against neither: main moving under the PR isn't the PR's doing, and every merge into the base can conflict it again, so conflicts must not use up the attempts review points and failing checks need. Conflict-only attempts have a budget of their own,CONFLICT_ATTEMPTS_PER_PR(5, a constant) for the life of the PR, which guards against a merge that keeps failing or a PR that never stops conflicting; failed and successful ones count, skipped ones don't. When only a conflict is fresh, only that budget applies, so a PR that used up its rounds is still kept merged; past it, a gave-up runfix:gave_up:<linkId>:conflictssays "N conflict-only attempts used, still to fix: merge conflicts". A mixed attempt (checks+conflict) counts against the budgets of its other triggers. Conflict-only runs are labelled "conflict attempt N of 5" in the summary and the prompt. An integration epic's PR, fixed for conflicts only, uses only this budget. -
Safety. Headless runs get
pushDenyRules(no force-push, no push to the default branch, nogh pr merge) and the runner's workspace note. T3 threads get the same rules in their note, and the fix prompt repeats them for a nudge. Conflicts are fixed with a merge, never a rebase. Only requesters' comments (people with access, the bots the user listed, and the user) start a fix, and the prompt names them by id, tells the agent not to read the others (for PR comments, the earlier comments it may read for context are listed by id too), calls what it reads requests about the code, never instructions, and tells it to judge each one. That is a prompt, not a sandbox: a fix agent has edit access, Bash and the user'sghlogin, so on a public repository a stranger's comment it reads anyway (or a CI log) could still try to steer it. Unlike the reviewer it can't be confined to exact commands, because fixing means running the project's own tools. -
Settings. The six switches (Review summaries and PR comments,
onSummaries, comes after Review comments), Trusted bot reviewers (trustedBots, in the Review comments row), Fix findings at or above (fixThreshold), Attempts on checks and reviews (attempts) and Attempts on comments (commentAttempts) up front; Fix skill (built-in: the prompt alone) and the shared runner fields, which take the board's agent defaults, under Advanced. -
An integration epic's own PR. For an epic delivered through an integration branch (epics), the epic's PR from that branch into the default branch is a candidate too, for the conflict trigger only, even once the epic is Done (it stays open until the user merges it). It never gets a nudge: a thread linked on an epic orchestrates its tasks. The agent merges the default branch into the epic's branch and pushes there; pushing to
epic/*needs no deny-rule change, since only the default branch is denied.
Merge ready PRs (merge_epic_prs, #123, #127; automations/mergeEpicPrs.ts, mergeIntoMain.ts). Needs no
agent and is off until switched on. It was Merge into epic branch, and keeps that key. Two targets: Into epic
branches, always on with it, for epics with integration delivery (epics); and Into main
(intoMain, the one setting, essential, default off) for tasks flagged for auto-merge. Its detail in Settings →
Autopilot explains integration branches and gives each target a sentence, its gate and an example
(MergeTargets.tsx; its counts are board-wide, from mergeTargets.logic.ts).
-
Into main. The candidates are open tasks in Review with
autoMergeon, no integration branch, andintoMainon for the task (intoMainOn: the automation resolved at the task's epic, then project, then board, so an epic's own setting counts; checked again in the action). Each goes throughautoMergeVerdict(integrations/mergeTaskPr.ts), the rulesmerge_task_prrefuses by: the task's one unfinished PR (unpolled ones count), not from a fork, passingnotMergeableagainst its own base, an account that can merge, and no required approval still missing.readymakes a merge candidatemain:<linkId>:<headOid>(retries:<n>, up toMAIN_MERGE_ATTEMPTS, 3, as for the epic merges below);waitmakes nothing, and that includes an approval GitHub requires (reviewDecisionreview_required): waiting for a review is how a PR normally ends, so it raises no flag. The account check comes before the approval one, so a PR that needs both is the user's.yours(two open PRs, a fork, an account that can't merge) makes one skipped, flagged notice per PR head and reason (main-hold:<linkId>:<headOid>:<hash>), "Ready to merge into main, but Autopilot won't merge #N by itself: …". One at a time per repository: at most one merge candidate perhost/repoper pass, in order (a task blocked by another flagged task after it, then by number), none while a run of this automation on a default-branch task of that repository is queued or running, and none for a PR whose link was last read (syncedAt) before the latest merge into its base that the board saw in the project (PrChanges.mergedof any merged PR link there), so a PR the merge left conflicting waits for its next read. The action checks the verdict again at the same link and head, then callsctx.gitHosts.mergeAutoMergeTask, which runsmergeTaskPritself withexpectedHeadOid(the flag and gate again, thenmergeIntoDefaultBranch:checkAutopilotMergeTargetwithinto: "default", the host's fresh merge state, the head). Its note on the task says "with Autopilot's Merge ready PRs". Then it rereads (rereadPr, the poller'sreread) the repository's other open PRs of flagged tasks. A refusal frommergeTaskPr(something changed since the re-check) skips as a re-check, and so does any refusal after which the refreshed link gives awaitverdict (the host's own "can't be merged yet (BLOCKED)" refusal for a PR that turns out to need an approval); a race, "try again in a minute" or a network error retries; anything else ends "Ready to merge into main: … Merge it yourself." flagged;MergeTargetErrorfails the run, flagged. -
Into epic branches: merging. A task's PR is merged into its epic's branch when
notMergeable(autopilot/mergeGate.ts, shared withmerge_task_pr) finds nothing in the way: the task is in Review; the PR is open (not a draft), from origin, with the epic's branch as its base (PrSnapshot.baseRef,baseRefNamein the poll) and a head commit; the local review isn't going (reviewIsInProgress) and left no blocking or major finding open; no Review PRs or Fix PRs run of the task is queued or running; when Review PRs is on for the task, its review of the current head (currentPrReview) has nothing actionable (a verdict Review PRs carried across a base merge counts, so a PR that only merged the epic's branch in after its last round still merges; one whose own code changed after it waits, and Review PRs' run says why under Needs attention); no reviewer requested changes on GitHub; checks pass, or none has reported forNO_CHECKS_WAIT_MS(10 minutes) since the board first saw the head (PrChanges.newHead, else the link's creation: GitHub reports no checks for a moment after a push); and GitHub says it merges cleanly and isn't blocked on a check or rule (only a missing review is left to GitHub). A PR GitHub says still needs an approving review (reviewDecisionreview_required) waits, with no run, and so does one GitHub refused for want of an approval, until the PR changes on GitHub (awaitsApprovalinmergeGate.ts). The dedupe key ismerge:<linkId>:<headOid>. The action re-checks all of it, then callsctx.gitHosts.mergeIntoEpicBranch(integrations/prMerge.ts): a fresh read (the host'smergeTarget) of the PR and the repository's default branch,checkAutopilotMergeTarget(refuses the default branch, a base that isn't anepic/branch, and a PR retargeted since the check, withMergeTargetError), andmergePullRequestatexpectedHeadOid. The method comes from the repository'smergeCommitAllowed,squashMergeAllowedandrebaseMergeAllowedas that same read says now, not the snapshot'smergeMethods, which may be stale:epicMergeMethodsorders them merge, squash, rebase (a merge commit keeps each task's commits), and when GitHub refuses one as "not allowed" (a ruleset onepic/*, say) the next is tried in the same call. A repository that allows none fails with a VALIDATION error. The result names the method and the run summary says it ("Merged PR #45 into epic/… (squash)"). The trade-off: a squash can conflict for a task branch built on another task's unmerged branch, which is accepted because tasks normally start from the epic's branch once their blockers are Done. A run that ended "Merge it yourself" is settled for that head (mergeRuns) and isn't reconsidered by a fix or a settings change: useretry_autopilot_runor push to the PR. The refreshed snapshot says merged, which moves the task to Done (completeIfPrsDone), so the unblocked notification notifies and Start planned starts what waited on it, from the updated branch. -
Refused. A failure another try may get past (another PR merged into the branch first, a push, GitHub still computing mergeability, the network) ends the run skipped with
output.retry, and the next pass tries the same head again undermerge:<linkId>:<headOid>:<n>, up toMERGE_ATTEMPTS(3). A refusal for a missing approving review that GitHub's read didn't show (NEEDS_APPROVAL, "At least 1 approving review is required…") also ends it skipped and unflagged, as a counted try, withapprovalRefusal's output: the PR'supdatedAtandreviewDecisionas the merge's refresh left them. The next try waits until one of them changes (awaitsApproval; a review bumpsupdatedAt), so the PR isn't retried every pass; Into main does the same undermain:. Anything else, or the last try failing, ends it skipped withneedsAttentionand "Ready to merge into the epic branch: … Merge it yourself." as the task's attention reason, and the engine notifies. AMergeTargetErrorfails the run, flagged. -
The epic's PR. Once a task PR has merged into the branch and the epic has no PR from it, it opens a draft PR from the branch into the default branch (
ensureEpicPr: an open one already there is used instead) and links it on the epic (epic-pr:<epicId>:<branch>:<task PRs merged>, so a failed attempt is tried again after the next merge). Its title is set only then, so a rename by hand sticks, and it followsepicPrTitle: when any merged task PR (the title on its link's snapshot) is a Conventional Commits header, so is the epic's, because the repo's commitlint would otherwise failEpic #N: …. The type isfeatif any is afeat, elsefixif any is afix, else the most common (ties go to the first of the epic's tasks); a scope only when every conventional one shares it;!if any has it. The subject is the epic's title, whitespace collapsed, without a trailing period and with the first word lowercased (GitHub syncbecomesgithub sync, because commitlint'ssubject-caserejects a capital first character), cut to 100 characters. Only config-conventional's types count as conventional, and an epic title that is already a header keeps its type and scope. It carries no#N, which a squash commit would turn into a link to the repo's issue #N; the body names the epic. With no conventional task PR the title staysEpic #N: <title>. That PR merging is what finishes the epic: the board sees it through the link and the epic goes from Review to Done once its tasks are Done too (epics). Then it keeps the PR's description,epicPrBody(each task with its state, its PRs into the branch, its latest Autopilot review counts and its local review), current: the keyepic-pr-body:<linkId>:<hash of the body>changes exactly when the body does, so nothing in it is a time. A closed epic PR is left alone. Nothing in Autopilot merges it.
Improve automations (improve_automations, #133; automations/improveAutomations.ts). Needs an agent, is in the
Upkeep group and is off until switched on. A weekly (weekday, time) task-less headless agent per project that audits
recent runs, failures and review rounds and writes at most maxSuggestions Suggestions through suggest_change; the
design, tools and cap are in suggestions.md. Its improve operation defaults to
the Deep tier.
Orchestrate (orchestrate, #138; automations/orchestrate.ts). Needs an agent and is off until switched on.
The built-in version of the T3 Code "babysitter" threads: a scheduled agent per project that keeps its work moving.
- When. Every
everyMinutes(default 30, 5 to 1440) from local midnight (latestMinutesSlot), per project it's on in (epicScope: false: it has no task). Only the latest slot counts, so downtime catches up once, and switching it on runs the current slot at once. The dedupe key isorchestrate:<projectId>:<local slot stamp>(orchestrate:<projectId>:standby:<stamp>for a machine's standby, below). A project with nothing to look at gets no run: it needs an unarchived task In Progress, in Review flagged for auto-merge, in Review with a PR stalled on review threads (isStalledPr: open, checks passing, mergeable, not approved, and a thread whose newest comment isn't the account's; flagged for auto-merge or not, and not while a T3 thread on the task is working or a Claude Code session on it is busy, since Orchestrate would only leave it alone), or under Needs attention (a failed Start planned run included), leaving out tasks waiting on the user (anagent_requestor a thread asking for input). So an idle project, or one whose work all waits on the user, costs nothing. One run at a time per project: while one is queued or running,checkreturns nothing for it and the latest slot runs once it ends. The rule isorchestrateNeedsLookingin contracts, so the board's lane pill reads it the same way.nextMinutesSlotgives the next slot (local midnight when the step doesn't fit in what is left of the day; it steps past wall times a DST change repeats). - Nothing new, no run (#241). The user may be away for days, so a slot whose board looks as it did at the last
look is skipped.
orchestrateFingerprintin contracts gives one entry per taskorchestrateNeedsLookingcounts: its status, its attention reasons (kind, key and fingerprint, so another blocked step or a session failing again is new), the newest Autopilot run whose flag stands on it (a run that fails again with the same message is new too), each PR's state, head, checks and mergeability, each thread's or session's status, and a stall bucket (orchestrateStallBucket: under 30 minutes, 30 minutes, 2, 8 or 24 hours) of how long it has been quiet. Quiet (orchestrateQuietSince) runs from the task's last activity by anyone but Orchestrate and Autopilot (Orchestrate's runs write asORCHESTRATE_ACTORthroughboardActor, so their notes and requests don't count, and the quiet-task reminder's note at 24 hours mustn't start it over), its thread's last activity, a session's end and its PRs' head commits (a Fix PRs push writes nothing to the board); a thread or session at work is activity now. The candidate carries the entries asCandidate.output, whichrecordwrites to the run from the start (dry runs too), and the run's scheduled-agent answer keeps them asfingerprint. A slot runs only when an entry is new since the latest run (orchestrateChanged, againstlastFingerprint): a task dropping out (done, or now waiting on the user) needs no look, and a latest run that failed, was cut short or has no fingerprint (from before #241) leaves nothing to go by, so the slot runs. Crossing a bucket is new, so a stall that outlives a look is looked at again, less and less often. Run now always runs. - A day stuck. A task the check finds in the 24-hour bucket that the latest look already saw as it is now (the
same entry but for its quiet,
orchestrateEntry) at 8 hours or more (orchestrateSeenStuck) has outlived Orchestrate's looks, and a skipped slot runs no agent to tell the user, so the check asks them itself:attention.requestasORCHESTRATE_ACTOR("… has been stuck for a day") (escalateStuck). One found a day quiet without such a look (Orchestrate just switched on, the first check after an upgrade, or something new on it since, such as a new head) gets that look first. Not in Preview, nor while paused, auto-paused in the project or in quiet hours, nor for a task a connected machine holds (its own Orchestrate asks). The request makes the task wait on the user, so it drops out of the fingerprint; whoever clears it does so as themselves, which starts its quiet over. - Run now. The first run-now path in Autopilot.
POST /api/autopilot/orchestrate/:projectId/run(requestOrchestrateRun) puts a request for the project inAutopilotService.requestRun, an in-memory map (a restart drops it), publishesautopilot.changedand starts a pass at once (Integrations.autopilotPass, when the pollers run).checkturns the request into a candidate keyedorchestrate:<projectId>:manual:<requested at>that skips the nothing-to-look-at gate, since the user asked; the first pass that finds the key has a run clears it. A slot that began before a manual run in it doesn't run again (ranManuallySince), so Run now doesn't double the next look. One run at a time still holds, and so do the engine's limits: the request is refused (CONFLICT, with the reason) when Orchestrate is off in the project, Autopilot is paused, a run is already going there, in quiet hours or at a daily cap (checked apart from concurrency, so a full run slot doesn't hide it); at the concurrency cap it waits for a free slot like any candidate. Asking again while one waits keeps the first. A request is dropped when Orchestrate goes off in the project, and after an hour without a run (RUN_REQUEST_TTL_MS), so it never starts out of the blue later. - State.
GET /api/autopilot/orchestrate/:projectId(orchestrateState,OrchestrateState) gives the switch,everyMinutes,nextSlotAt,hold(why that slot won't run, the first that applies:off,paused,quiet_hoursat the slot,daily_cap,idle,unchanged: nothing new since the last look, by the fingerprint at the slot),running,requestedAtandlastRun(the latest real run, retried ones left out). Its section of the lane popover reads it (see board-layout.md). The quiet-hours and cap checks are the engine's (agentHoldinautopilot/limits.ts). - The run. Task-less and headless (
startDetached: an empty temporary folder,repofor the default branch's push guard), withaccess: "read-only"anduntrustedInput, since it reads PR and CI text anyone can write: file tools only in its own folder, no settings from a checkout (--setting-sources user), only the built-in tools it needs (--tools Read,Grep,Glob,Bash, so a global WebFetch allow rule finds no tool) and no MCP server but this board's.boardToolsmakes the runner write an MCP config naming only the board (boardMcpConfig, with its API token, in a temporary folder of its own outside the run's, removed afterwards) and pass it with--strict-mcp-config --mcp-config. On top of that, theghreads inORCHESTRATE_TOOLS(gh pr view|checks|list|diff,gh run list|view,gh run rerunfor a flaky CI job, and exactlygh api repos/*/*/pulls/*/comments, with or without--paginate, for the inline review threadsgh pr viewdoesn't show). A rule's*matches spaces too, and gh takes combined short flags (-iXDELETE), soORCHESTRATE_DENIED_SHELLdenies, anywhere aftergh api, a word starting with-that holds an X, f or F, and--methodand--input(deny rules win): a write can't hide between the allowed rule's parts. The rules match each command, and a compound one is refused if any part isn't allowed, so the prompt tells it to run eachghcommand on its own (no loops, pipes or&&) and that a refusal is about the command's shape, not that Bash is off. It never edits code: it works through the board's tools,message_task_thread,retry_autopilot_run,request_attentionand its ownstart_task_session(Task sessions), a run tool bound to its project (runTools: { toolSet: "orchestrate", target: { kind: "project", projectId } }), so no other agent sees it and this one can't reach another project. Because it reads text anyone can write (PR comments, CI logs), it gets only the board tools inORCHESTRATE_BOARD_TOOLS(reads,add_note,request_attention,message_task_thread,retry_autopilot_run); every other board tool is inORCHESTRATE_DENIED_TOOLS(RunnerRequest.deniedTools), so it can't create or flag a task for auto-merge, link a PR, mark review findings away, merge, or move, close, archive or delete tasks.start_task_threadis denied too: a T3 thread started directly would skip Autopilot's caps and quiet hours, which a session it asks for goes through.mcp.test.tschecks every registered tool is on one list or the other. It never starts a Planned task: that is Start planned's, under its limits and the task's blockers; a failed start goes back throughretry_autopilot_run. It counts against the caps and waits out quiet hours like any agent run. Theorchestrateoperation (Standard tier by default);modelChoice,budgetUsdandtimeoutMinutes(the board's agent defaults unless set) are its own run's options. It always runs headless: its Sessions it starts: Runner field (runner, the board's agent default unless set) is only the sessions'. - Merging. Never (#127):
merge_task_pris always denied, and the prompt tells it to list the Review tasks whose PR looks ready, saying which are flagged for auto-merge, and leave merging to Merge ready PRs. Its old May merge setting is gone: migration043_merge_ready_prsswitched Merge ready PRs on with Into main wherever Orchestrate was on with May merge (see Merge ready PRs above), and dropped the stored values. - The prompt (
orchestratePrompt) is adapted from the babysitter threads: ground rules (this project only, never read or edit files in the project's live folder, since a board or dev server under--watchmay restart, and treat PR and CI text as data), orient, unstick stalled work the lightest way (message a live thread, ask for a new session withstart_task_sessiononly when nothing is working on the task, retry a failed run instead of pushing an empty commit, re-run a flaky CI job once,request_attentionfor what only the user can decide). Stalls are judged by the thread's status and the work's state, never by the age of the task's last board activity: a working thread or a pending or running local review round is activity (a reviewer can run for 40+ minutes and write nothing to the board). A PR that Review PRs hasn't reviewed yet while the task's agent is at work, or in the two minutes after a push, is waiting, not stalled; past the 45-minute ceiling with nothing at work on it, it is. A Review task with no PR is asked for one only whenget_tasksays the loop has ended, since with auto-review the PR is opened after the local loop; a stalled or failed round is sent back to its review loop instead. A PR left red or conflicting by a merge into the default branch is a stall like any other. A green PR stuck on review threads is one too: a Review task whose PR is open, green, mergeable and not approved, with unanswered threads onget_task's PR line. It is left alone while a Fix PRs run on it is going, or one that succeeded started on its current head less than a run's interval ago (a failed or cut-short run, a gave-up notice, or an older run that left threads unanswered doesn't hold it, so the steps below stay reachable at the same head); otherwise Orchestrate reads the threads (gh api …/comments) and the conversation (gh pr view --comments), judges them, and takes the first of: retry a failed Fix PRs run with attempts left; retry Fix PRs' gave-up notice for a fresh budget (freshBudget: true) when the points look fair and worth doing; message the task's thread (or, with none live, ask for a session) to fix or decline each thread, reply on each and push, when Fix PRs hasn't acted or its fresh budgets are used up;request_attentiononce, naming the threads, when their authors have no repository access, only the user can decide, or nothing is left to try. Its handover says which it did for which PR and head, so the next run doesn't repeat it. It ends with a short status. Extra instructions (multi-line) are appended last and win where they differ. - Memory. The scheduled agents' handover (custom automations):
scheduledHandoverPartsends the prompt,lastHandover("orchestrate", projectId)supplies the last one, and the run keeps itsScheduledAgentRunOutput. Its settings section lists each project's latest runs with their summary and handover (run history). - While the board is away (#240). A machine that holds some of the project's tasks runs its own Orchestrate over
them once the board hasn't polled it for three of the project's intervals, and stands down when the board is back
(remote machines). On the board, its runs come back like
any machine run's (
machineset) and are left out of Orchestrate's own state: the fingerprint, the handover (lastHandover(…, { own: true })), Run now's slot, one-run-at-a-time,runningandlastRungo by the board's own runs only (ownRuns), and so does its auto-pause, whose failure streak leaves a machine's Orchestrate runs out. What a machine's standby left since the board's last successful look is read as a note: the next prompt carries the latest handover per machine in<machine-handover machine="…" at="…">tags, as data (standbyHandovers). The board's look waits, unrecorded, while a machine's standby started or ended less than an interval ago, or is going (counted only within its timeout, so a run whose end never reached the board holds nothing back for long;standbyLookedLately), so its first look after it is back comes an interval after the standby's.
Task sessions (task_sessions, #211; automations/taskSessions.ts) starts the agent sessions Orchestrate asks
for. It is part of Orchestrate (Automation.partOf): it has no switch or settings of its own, so it is on, in
Preview or off wherever Orchestrate is and reads Orchestrate's config (the same schema and defaults). The service
resolves it on Orchestrate's settings rows (switchKey in chainFor), refuses setScope on it, and leaves it out of
the automations list, the scope popovers, the hints and auto-pause; AutopilotOverview.parts names it instead, and the
run history lists it as Orchestrate › Task sessions (automationChoices). Its runs are ordinary task runs: they
count against the caps, wait out quiet hours and Pause all, record their cost, show in the task's Autopilot section
and can be retried.
- Asking. An Orchestrate run calls
start_task_session(task, note), served to that run only (mcp/runTools.ts, setorchestrate).TaskSessionsService.requestrefuses, with the reason (CONFLICT: Not started: …), an epic, a manual task, an archived one, one in Planned (Start planned's; the refusal namesretry_autopilot_run(…, "start_planned")), Backlog or Done, a blocked task, a project with neither a folder nor a T3 project, a task with a T3 thread or agent session at work (agentAtWorkOnin contracts: a busy thread that isn't a follow-up, one linked in the last two minutes, or a busy session), one with an Autopilot run queued or running, one outside the run's project, one held by a connected machine whose own Autopilot looks after it but whose version can't start these sessions (it answered without thetaskSessionscapability), and one a session was asked for on in the last hour (TASK_SESSION_COOLDOWN_MS). The rules aresessionRefusal, which the run checks again. Otherwise it stores a row intask_session_requests(migration 058: task, project, note, actor, the asking run, created at, the run that took it up, and why it was dropped), adds a note to the task ("Orchestrate asked for a new agent session …", through the task service so a held task's machine gets it) and publishesautopilot.changed, which starts a pass. Request ids come fromcore.newId. Requests are history: backups leave them out, and a deleted task takes its own. - On a machine (#222). A request on a task a connected machine holds whose own Autopilot looks after it
(
holder, boardPlacement's rule: a machine that hasn't said counts as yes) is passed to that machine as a held edit (taskSessions.request, remote machines), and the machine's own Task sessions runs it (Autopilot on the machine); the board never does. The board keeps its row closed (passed_to, migration 059: the check skips it, the hour's rule counts it) and the tool's result says it is queued for that machine. The edit carries the board's id and time (requestedAt), so the machine's row and run have the sametask_sessions:<id>key, its two hours count from when Orchestrate asked, and its project is the machine's copy of the task's. A request that reaches the machine more than two hours late (it was away) is kept dropped with a note; one the machine refuses (the task moved on there) is taken back on the board, withedit_refused, and its row deleted so it doesn't hold the hour. The note on the task is added once: the board's copy is the edit's, and the machine's log replaces it. When the hold ends before the machine ran it (notask_sessions:<id>run came back;takeBack), a release gives it back to the board, whose Task sessions runs it on its own two hours (one past them is closed without another note: the machine noted it), and the machine drops its copy; a forced or lost one forgets it with a note asking Orchestrate to ask again, since the machine may have started it unseen. A machine that doesn't run Autopilot keeps the board's way: the board's Task sessions runs the request and sends the job to the machine, as for any run of a held task. - Check. Each request from the last day not dropped and without a run of its key (
task_sessions:<requestId>) is a candidate. A waiting request is dropped (dropped_at,dropped_reason) when its task is gone, when Orchestrate is off in its project, or after two hours without room to run (TASK_SESSION_REQUEST_TTL_MS), so a session never starts long after the stall it was for. A dropped request adds a note to its task saying why, so the next Orchestrate run knows no session came. One whose task a machine whose Autopilot looks after it has taken since is forgotten with such a note (forget), so Orchestrate's next ask, which goes to the machine, isn't held by the hour's rule. Like Start planned, it leaves room in the concurrency cap for T3 threads still working (workingAgents, which counts both automations' threads). - Action. Re-checks
sessionRefusal(without its own run) and skips with the reason if the task moved on, thenrunner.startwith operationtaskRunand only{ runner }from Orchestrate's config as options: budget, timeout and T3 access are the board's agent defaults, and the model and, headless, the provider are what Settings → Agents gives task runs (Models). Nothing names a CLI: Auto is T3 Code when it is connected, else headless on the first provider that can run it. The prompt istaskHandoffPromptin work mode, then Orchestrate's note in<orchestrate-note>tags, marked as Orchestrate's and not the user's (the task, plan and notes win), then where it works and an unattended note (block a step and stop rather than ask; move to Review when done; never force-push, push to the default branch or merge).taskSessionPromptbuilds it. - Workspace (
sessionWorkspace). A task with an open or draft PR on its own repository's branch with a known head works on that branch at that head (workspace.branch+expectHead; the prompt says to push there and not open another PR). A head that moved before the agent started skips the run as Deferred: head moved, and notes on the task that Orchestrate may ask again (a skipped session isn't retried). Otherwise a new branch from the default branch, or from an integration epic's branch (prBase); since an earlier session's work may be only in its own worktree, the prompt says to read the task's notes and activity first. - Retrying. A failed run (a CLI missing, T3 refusing) is flagged on the task.
retry_autopilot_runfrees its key, so the request runs again on the next pass, within a day of the request; the run takes the request up again. A skipped run (the task moved on, or got an agent) did nothing, so it isn't retryable (canRetryRunin contracts, so the Retry buttons andretry_autopilot_run's default pick pass it over;retryRefusalgives the service's reason): a new session is asked for again, under the once-an-hour rule. A failed run's retry is refused too, with the reason, when its request couldn't run again: dropped, passed to a machine that no longer holds the task, more than a day old (TASK_SESSION_RETRY_MS), or Orchestrate off in its project (retryRefusalgets the board's services for this, as its third argument). On a task a machine whose Autopilot looks after it holds, a run that machine made isn't judged here: the retry is anautopilot.retryedit, and the machine decides by its own copy of the request. A run the board made before the hand-over is refused, since its request stayed on the board. A retried request that can no longer run by the next pass (Orchestrate switched off in its project, or a machine took the task) is dropped with a note on the task, like a waiting one.
Start planned tasks (start_planned, #94; automations/startPlanned.ts). Needs an agent, so it counts against
the caps and waits out quiet hours. Off until switched on. The headline automation: it starts an agent on a task.
- Eligible (
notStartableis the rule; the action re-checks it, so a flag turned off between the check and the action skips the run): not an epic or archived, in Planned,task.autopilot === true(Default and Off never start), a plan (progress.total > 0) and notblockedby unfinished tasks. The caps and quiet hours are the engine's. Candidates go priority tasks first (the priority flag, see board-layout.md), then by project (in the board's order) and board position, and the engine starts as many as the cap leaves room for. - Dedupe
start:<taskId>:<statusChangedAt>: once per entry into Planned, so moving a task out and back in is the way to try again. - Action:
ctx.runner.startwithtaskHandoffPromptin work mode (linkedThread: true: the board links the thread or session itself, and the model line is left out, since the tier picks the model) plus an unattended note (no one to ask: block the step and stop) and, for a chosen skill, a line pointing at itsSKILL.md.tieris the task's suggested tier. The agent moves the task to In Progress itself. - Failure: a runner error, or the task still in Planned when the grace period ends, counted from when the thread
started (the runner may first have waited up to ten minutes for T3, see Runners). A T3 run returns once the thread has started, so the action then waits out the rest of the grace period for
the agent to move the task, unless the live poll sees its thread
failedfirst: that ends the run at once ("its T3 Code thread failed before moving #N out of Planned"; only a snapshot taken after the runner returned counts). A headless run returns when the agent is done, so it is checked once, at once. A runner error after the agent moved the task (a headless budget or timeout) reads "Autopilot's agent stopped before finishing" instead. The run fails with "Autopilot couldn't start this task: …" andneedsAttention, so the task is flagged and the engine notifies. Nothing retries it. The flag clears itself when the task changes status (Needs attention), so there is no clearing step. While the action waits out the grace period its run staysrunningand holds a concurrency slot. - The cap counts working agents. A T3 run ends once the thread has started (so a restart strands nothing), which
would free its slot at once. So
checkalso countsworkingAgents: tasks In Progress, In Review (the agent runs its review loop there) or still Planned (the thread hasn't moved them yet) whose latest Start planned run began a T3 thread (the run'sthreadUrl, whatever the run's outcome: one that failed at the grace period may still move the task) that isworking,waiting(subagents still going),inputorapprovalin its snapshot, and not settled or archived.checkdrops candidates that already have a run (a failed or still-starting task would otherwise use up the room of those below it) and returns only as many asmaxConcurrentleaves after those and the engine's running runs. A snapshot only counts as evidence when it was taken after the run ended (the launch-time poll sees a thread that hasn't run yet, "idle"). A thread with no such snapshot, or whose snapshot the live poll stopped refreshing (T3 gone, thread deleted), counts for ten minutes from the run's end or the snapshot. The slot frees when the thread idles, finishes, fails, settles or is archived, or the task is Done, archived or back in Backlog; a thread stuck waiting for you holds it until you answer, and the waiting-thread reminder tells you. A headless run is a running run, which the engine counts. A dry run ignores this. - Config: the shared runner options plus
skill(aReviewSkillRef; built-in means the default workflow, labelled by the field'sbuiltinLabel),baseRef(the worktree's start; blank is the default branch) andgraceMinutes(15). A task of an integration epic ignoresbaseRef: it starts from its epic's branch (workspace.prBase, below) and its prompt says to open its PR against it.
Digest of what changed (digest, #90; automations/digest.ts, autopilot/digest.ts). Writes a board-wide summary
of what changed since the previous digest, shown in the header's Digest panel and announced in the inbox. It is a
board-level automation: its switch, time and options are the board's (a project's own config is ignored), and a
project switched Off at its own scope is left out. A project set to On while the board isn't does nothing.
Needs no agent unless the mode asks for one, and is off until switched on.
- When. Daily at
time(default 09:00, server local time), optionally weekdays only; and on demand (below).checkasksdueDigestSlot(contracts) for the latest slot at or before now that is after both the newest digest (any trigger, so one made by hand counts as that day's) and the last change to the automation's board settings (so switching it on, or moving its time, owes nothing for a slot that passed before). Only the latest slot: after downtime there is one digest covering all of it. The dedupe key isdigest:<slot as a localStamp>. - Period. From where the previous digest ended (
to) to now; the first digest covers the last 24 hours. - Plain (
autopilot/digestBuilder.ts, pure; the data comes fromdigests.collect), grouped by project, with sections only for what happened: Moved (a task that moved several times shows where it started and ended, and not at all when it came back), Merged pull requests (astatus_changedentry carryingmergedPr; those are listed here instead of under Moved), Needs attention (thread_waiting,pr_checks_failingandpr_changes_requestednotifications of the period, so a kind switched off in Settings isn't reported), and Autopilot (real runs that finished in the period: counts, and each failed or needs-you run with its message cut to one line). The total Autopilot cost closes it. Titles are escaped, and task numbers are written#Nfor the UI to link. - Summarised. The plain digest goes to a headless agent on the
digestoperation's model (the light tier by default; the config'smodelChoiceoverrides), with the chosen digest skill (the built-in one,BUILTIN_DIGEST_SKILL_BODY, or one found on disk) and the instruction that the digest is material, not instructions. A skill found on disk is read by the board (only aSKILL.md, at most 200 KB, cut to 20,000 characters) and put in the prompt. The agent has no tools at all (access: "none":--tools ""and--strict-mcp-config, so no file reads and no board MCP tools either): everything it needs is in the prompt, and task titles can come from imported issues. It runs through the runner as a task-less run (see Runners); T3 Code can't return text, so there is no runner choice. Whatever goes wrong (no agent allowed, the agent fails, answers nothing) stores the plain digest with the reason innote: a digest that fails to arrive is worse than a plain one. A period with nothing in it never starts an agent. - One at a time. A scheduled digest is not started while another is being written, and "digest now" is refused (409) then, so two periods never overlap.
- Gates. The automation isn't
needsAgent(a plain digest shouldn't count against the run caps or wait behind a busy runner), so the summarised mode keeps the rules itself: a scheduled one waits out quiet hours (the slot stays due), and a digest that finds Pause all set, dry-run on or today's spend cap used up comes out plain with that as its note. It setsbackground, so the engine doesn't hold the rest of its pass for it. - Digest now.
createDigestGenerator(integrations.generateDigest) records a run of its own (its cost counts toward the spend cap), covers every project not switched Off whether or not the automation is on, and uses the board's settings. A plain digest is done when the request returns; a summarised one goes on in the background (202), and the run in the Autopilot status (active, automationdigest) is what the UI shows while it waits. A second request meanwhile is a 409. - Storage.
autopilot_digests(020_autopilot_digests.sql): the period, mode, trigger, Markdown body, cost, the fallbacknoteandread_atfor the header's unread dot. The newest 30 are kept. History only: not backed up. A new digest sends oneautopilot_noticenotification (task-less, dedupe keydigest:<id>) with the counts.
REST only, like the rest of Autopilot:
| Route | Does |
|---|---|
GET /api/autopilot/digests |
The kept digests, newest first, and how many are unread |
POST /api/autopilot/digests |
Makes one now: 201 with the digest, or 202 {digest: null} while an agent writes it; 409 if one is being made |
POST /api/autopilot/digests/:id/read |
Marks one read |
Every change publishes autopilot.changed, which the web app uses to refetch the list.
Automations the user defines (#97, sharing #135, scripts and checks #225; guide: custom automations).
An action is an agent (on a schedule, optionally gated by a check script), a shell command or a script.
The editor is a five-step builder (When → Do → Details → Where → Review & try, CustomAutomationEditorForm with the
steps in BuilderSteps.tsx): one form, so moving between steps keeps everything; stepProblem (builder.logic.ts)
checks each step only for what it shows, and Save jumps to the first step with a problem. Review shows the
sentence, what it would run for right now (rightNow: a stale trigger's tasks already past the limit), the prompt
preview or a script's test run, and the name, pre-filled from the trigger and action. A new one saves in Preview where
the Where step put it, or Save and turn on switches it On there after it is created (useTurnOnCustomAutomation:
the board, or each of its projects); an existing one opens at Review.
Where decides where it runs with its switches, and nothing else: the same project table as the
automation's page (ProjectTable.tsx). For a saved automation the step is WhereProjects, which writes its switches
as they are picked, like its page; for a new one (or an import, or Edit first) it is DraftProjects, kept in the form
(everywhere, projectIds) and sent as the create input's
projectIds: empty saves a board row in Preview, otherwise a project row in Preview for each, with the board off. Under
it, for a task trigger: With any of these labels (filters.labels) and a Tasks in epics switch
(filters.epicTasks, default on). Off, a task in an epic is skipped unless that epic has a setting of its own for the
automation (epicsWithOwnSetting, passed to customTaskMatches), so the epic popover still switches one epic on. A
schedule has no task, so neither shows and the definition can't carry them (checkCustomDefinition).
The project and epic filters became switches (049_custom_filters_to_scopes), so one place decides where it runs
and no stored automation runs anywhere new or stops anywhere it ran. A non-empty projectIds filter becomes Only in
those projects: each keeps the state it had (its own row, or the board's), the board goes off, and the projects left
out and their epics' rows go to Inherit. An epicId filter becomes that epic's own row at the state the epic had (off
when its project was off or left out), every other row of the automation goes to Inherit, and Tasks in epics turns off.
Rows keep their config and last on-mode. Since Tasks in epics replaced the epic filter, it counts as where it runs: an
agent's change (replaces, applyDraft and proposedDefinition) and a PATCH whose filters leave it out keep the
automation's own. Details for a
command ("Which command?") or a script ("The script") has a small amber Runs as you pill by its heading
(RunsAsYouBadge in ScriptWarning.tsx) instead of an alert: its card opens on hover, on click or tap, and on
keyboard focus, and Esc closes it (it stays closed until focus leaves the pill). It says the code runs on this machine
as the user, with their logins, can do anything they can in the project's folder, and that text from GitHub can come
from anyone who can comment; on a board with connected machines it names them, since a task one of them holds runs
the code there, as the runner's user; a command's adds the Windows advice (let the program read the variable itself, since
PowerShell doesn't escape quotes and npm and pnpm hand arguments to cmd.exe). Code someone else wrote keeps the full
ScriptWarning: the import page, an agent's draft or change, and the script confirmation.
Each row of
autopilot_custom (name, trigger_json, filters_json, action_json, armed_at) is a catalogue entry
custom:<id>, built by customAutomation (autopilot/custom.ts). The service's catalogue is a function
(built-ins, then every custom row), so a create, edit or delete applies from the next pass; nothing is reloaded.
Their switches and config are ordinary autopilot_settings rows, and the table's delete trigger removes them with
the automation. Runs stay, under the old key.
| Trigger | Candidate | Dedupe key |
|---|---|---|
status_change |
A task in to (moved from from, if set, by its latest status_changed or closed event) |
status:<taskId>:<statusChangedAt> |
pr_event |
Per PR link: linked, new_head, checks_failing, conflict, merged, timed by PrChanges |
pr_linked:<link>, pr_head:<link>:<oid>, pr_checks:<link>:<began>, pr_conflict:<link>:<began>, pr_merged:<link> |
stale |
A task in status for hours |
stale:<taskId>:<statusChangedAt> |
blocker_finished |
A task whose blockers are all Done | unblocked:<taskId>:<latest blocker statusChangedAt> |
schedule |
Per project in scope, no task: weekly (latestDue), every N hours (latestHourlySlot) or every N minutes, 5 to 1440 (latestMinutesSlot), counted from local midnight; only the latest slot counts, so downtime catches up once |
schedule:<projectId>:<local slot stamp> |
-
Arming. Events before a task came into the automation's scope don't fire, so switching it on doesn't act on the board's history.
customArmedAttakes the latest of:armed_at: set at creation and when the trigger, the filters or the variables the action needs change (which also clears the times below);- the scope's time in
armed_projects_json: a project's when its switch turns on there (onEnabled), an epic's (epic:<id>) when its effective state goes from off to on for an epic with a setting of its own (onEpicEnabled, which also covers it going back to Inherit). Lifting Pause all stamps every project and such epic that is on. A task in an epic with its own setting follows the epic, not the project, so switching the project doesn't drop events the epic is waiting on (held by quiet hours or a cap). An epic that gets a setting of its own takes over the project's time (onEpicOwnSetting), so its floor doesn't move either way; - when the task came into that scope: its latest
epic_changed,moved_projectorunarchivedevent, or its epic'sarchivedorunarchived(scopeChangedAt): an archived epic no longer counts, so its tasks move to the project's scope.
staleis a state, not an event, and ignores arming. -
Epic scope. Task-based custom automations can be switched per epic like the built-in ones (the engine resolves each task's epic). A schedule has no task, so it has
epicScope: false, epics don't list it, and changing a trigger to a schedule deletes its epic switches. -
Event times are
statusChangedAt, the latest blocker's, a PR link's creation, or for PR states the time the board saw the state begin.setSnapshotkeeps that intask_links.pr_changes_json(PrChanges,nextPrChangesin contracts): when the PR merged, its checks started failing, a conflict appeared and its head moved from one commit to another. The PR's ownupdatedAtisn't used: a comment moves it. The first snapshot of a link only records what is true (failing,conflicting), so a state the board finds in place never counts as beginning: not on linking a PR, and not on the first poll after a restore, which leaves snapshots and this column out of the backup. Pending checks and unknown mergeability keep the last known state, so checks that fail again after a push, or a conflict GitHub recomputes, aren't new; passing and then failing again is. -
Filters: projects (on top of the scopes), labels (any of, normalised) and epic (
customTaskMatchesin contracts). Epics and archived tasks never match. A schedule has no task, so it takes only the project filter (checkCustomDefinition, run by the service and the form), and an agent on it can't useonPrBranch. -
Agent action (
needsAgent):customAgentPrompt(contracts) is the skill line, the prompt with its{{…}}placeholders filled (CUSTOM_PLACEHOLDERS; unknown ones are refused on save) and the task's context. It goes toctx.runner.startwith the action'smodelas itsmodelChoiceand thecustomTaskoperation (see Models) and, withonPrBranch,workspace.branchset to the PR's head branch. Its config is the shared runner options, per scope. On a schedule there is no task: the prompt's footer names the project and its folder instead (customAgentPromptwith a null task), the run has notaskId, and the runner runs it headless in an empty temp folder throughstartDetached, as it does the digest (never in the project's checkout, which the board may be running from, so the runner option is ignored: it is always headless). It has the usual edit access and the board's tools, andrepo(the project's folder) gives it the default-branch push guard and the safety note a worktree run gets; the prompt names the folder as the live checkout to read from, not edit (advisory only: the run has edit access and Bash, and only pushes are denied; a project with no folder gets the safety note without a branch name and the generic denials). The model is the automation's Model setting, else the action'smodel, else the board's forcustomDetached, else the light tier (Models). One at a time per project: while a run of the automation for the project is queued or running (status().active),checkreturns no candidate, so the slot isn't recorded and the latest slot runs once the run ends. It also counts againstmaxConcurrentand the daily caps like any agent run.Handover. A scheduled run has no memory of the last one, so it is asked for
{summary, handover}(SCHEDULED_AGENT_OUTPUT_SCHEMA,outputSchemaon the runner request) and keeps it inoutput(ScheduledAgentRunOutput,kind: "scheduled_agent", the handover cut toHANDOVER_MAX_CHARS= 4000 bycapHandover). The prompt's footer (customAgentPromptwith a null task) says what a handover is for (what the next run needs, not a log; it replaces the last one) and, when there is one, passes on the last run's under "Handover from the last run", inside<handover>tags and labelled as data (the agent reads external text, so it may echo some), not instructions.AutopilotService.lastHandover(automation, projectId)reads it from the newest real, succeeded, task-less run of the same automation in the same project that has such an output (lastScheduledAnswer): a failed run leaves none, so the one before it carries on. A run with no structured answer fails (the runner'soutputSchemahandling), and what it did isn't carried over, so the next run may repeat it; an answer of the wrong shape that got through anyway keeps nooutput. Other projects and other automations never see it. A dry run's preview includes it. The editor links to the automation's run history, which lists its runs with their summary and handover, since a task-less run has no task panel to show in.- Allowed tools (
allowedTools,CustomToolRulein contracts): extra tools the agent may call unattended, such as the user's own MCP servers, asmcp__<server>,mcp__<server>__<tool>(a*only in the tool part) or a built-in tool fromCUSTOM_BUILT_IN_TOOLSwith an optional specifier (Skill(name)); a built-in rule only adds a tool, it never narrows one the run already has (an edit run allows all of them but Agent and Skill); at most 20, 200 characters each, deduped. The shell tools (Bash, PowerShell) are refused: the push and merge deny rules areBash(...)patterns, so another shell tool would sidestep them, and an edit run has Bash anyway.actpasses the rules asRunnerRequest.tools, for a task's run and a scheduled one alike, whichagentArgsappends to--allowedTools. They make the run headless (a T3 thread can't be given tools, so with the runner set to T3 Code only, a task's run fails and says so; a scheduled run is headless anyway). Everything else about the run is unchanged: the push and merge deny rules still win, since deny rules beat allow rules. That covers git and gh run through Bash; a tool of an MCP server that runs commands is the user's call, which is why the editor warns. The dry-run preview lists the tools under the prompt. Nobody can approve a call in a headless run, so a tool not listed is denied, and one listed runs with no prompt: the editor warns about that. The server has to be one the run can start without approval: the user's own (claude mcp add --scope user, a plugin or a connector), as for issue import. A server from the project's.mcp.jsonneeds an approval nobody can give. Only the agents of untrusted check items setuntrustedInput(check scripts); an untrusted run starts with--strict-mcp-config, so MCP rules would find no server there anyway, and the definition check refuses allowed tools and slots with them.
- Allowed tools (
-
Shell action (
background, notneedsAgent, so the agent caps and quiet hours don't hold it):integrations/shellCommand.tsruns the command with/bin/sh -c, or, on Windows, Windows PowerShell with-EncodedCommand(never cmd.exe, which expands%VAR%before parsing, so a value could add a command; values passed as arguments to another program are still unsafe there, since Windows PowerShell doesn't escape their quotes and.cmd/.batprograms re-parse them in cmd.exe; only the guide and the editor can warn about it), in the project'sworkspaceRoot, with the server's environment minus everybrandEnvvariable (the API token) and inherited git config (see the agent's environment) plus the values asbrandEnvvariables (customShellEnv). The command is never interpolated, and{{…}}in it is refused on save. A timeout kills the process tree (processTree.ts, shared withclaude -p), with SIGKILL and giving up on the run 5 seconds later if it doesn't end. Non-zero exits and timeouts fail the run and flag the task; the output's last 4,000 characters and the exit code go on the run. At mostAUTOPILOT_BACKGROUND_MAX(4) go at once; the engine skips further candidates until one ends, without recording them. -
Script action (
{kind: "script", language: "python" | "node" | "powershell" | "sh", body, timeoutSeconds}; the body is at mostCUSTOM_SCRIPT_MAX, 100,000 characters): like a shell action in every other way (background, same environment, same results, same cap), butintegrations/scriptRunner.tswrites the body to a file in a temp folder of its own, removed afterwards, and runs it with the language's interpreter in the project'sworkspaceRoot.nodeis the server's ownprocess.execPath(as Node under Electron);pythonispython -I -X utf8(python3first off Windows;python, thenpy -3, on it);powershellispwsh, else Windows PowerShell;shisshon the PATH. The interpreter is looked up on the PATH before anything starts, so a missing one fails the run with "python not found on PATH" (and flags the task) rather than a spawn error. The context goes to stdin as JSON (customScriptContext:automation,projectwithid,name,pathandrepoUrl,inputs,vars,taskandpr, null when the trigger has none), with non-ASCII characters escaped so every runtime reads it the same. The result keepsstdout(the firstSTDOUT_MAXcharacters) andstderrapart for a caller that parses what the script printed; the run gets the interleaved tail and exit code as for a shell action. A{{…}}in a body that names a placeholder is refused on save, as in a command (other{{…}}text is left alone). Known limits: a PowerShell script gets the shell action's two-line prelude (progress and encoding) and exit handling around it, so it can't open withparam(...),[CmdletBinding()]orusing; it runs with-File, which an execution-policy Group Policy can block, unlike a shell action's-EncodedCommand; and on Windows only.exeprograms are found on the PATH (not.cmdshims). The spawn, output buffering and timeout kill are shared with shell actions inintegrations/captureProcess.ts. The storage is the sameaction_jsoncolumn, so no migration. -
REST only:
GET/POST /api/autopilot/custom,PATCH/DELETE /api/autopilot/custom/:id. Over MCP an agent can only draft one, which the user imports. A write whose action is (or stays) a shell command, a script or an agent with a check script needs anOriginheader, which browsers send and the guard checks is the board's; agents and scripts usually send none. It's a guard rail against an agent setting up a command by accident, not a boundary. Every change publishesautopilot.changed. -
UI: listed under Yours in Settings → Autopilot → Automations (
AutomationsSplit), with the editorCustomAutomationEditorFormas a sub-page,/settings/autopilot/custom/<id>. The preview runs the same contracts helpers as the server on the newest board task the filters let through, in a project it runs in (customAutomations.logic.ts). Switches are the usual rows and lane popover entries, since those list the catalogue.
Every action carries inputs, and an agent action slots too (AutomationInput, AutomationSlot in contracts), both
empty by default, so rows saved before them still parse (#238 added inputs to shell and script actions).
- Inputs are
{name, label, type: text | number | boolean, default, value}. A prompt reads{{inputs.<name>}}(renderCustomPromptwithCustomValues.inputs), for declared names only; every action kind, checks included, also gets each as<PREFIX>_INPUT_<NAME>(inputEnvName) and in stdin'sinputs. A value is data: it isn't filled in again, so one that looks like{{task.title}}stays as written.checkCustomDefinitionrefuses an undeclared{{inputs.x}}, repeated names and a value that doesn't fit its type (inputValueProblem), for every kind. - Slots are
{name, label, description, tools};toolsfollow theallowedToolsrules.customAllowedToolsis the allowed tools and every slot's tools together, which is whatactpasses asRunnerRequest.toolsand what the dry-run note lists.customAgentPromptadds a "Tools to use for this" line per filled slot after the prompt. - Waiting for the slot's server.
claude -pconnects MCP servers in the background, so a slow server's tools may not be there on the agent's first turn. WhenRunnerRequest.toolsname anmcp__<server>other than the board's, and the run gets the user's servers (notaccess: "none", nor read-only and untrusted, which use--strict-mcp-config), the runner addsMCP_CONNECTION_NONBLOCKING=falseto the agent's environment beside the push guard's (mcpWaitEnv), so Claude Code connects them first. Such a run waits for every user server, up to Claude Code's MCP timeout, within the run's own timeout; runs that need only the board's server don't wait. A run with run tools waits too, locked down or not: its only way to read its target is that server, and a locked-down run has no ToolSearch to find a late one. Same cause as ticket imports (issue-import.md). - Blocked. While a slot has no tools,
customBlockedReasongives "Won't work until you fill in: Jira tools". The catalogue entry carries it asAutomation.blocked(AutopilotAutomation.blockedin the API):setScoperefusesmode: "on"with that message (VALIDATION), the UI shows it in orange and disables On, and the automation'scheckfinds nothing meanwhile, so emptying a slot of one that is already on stops it rather than starting an agent without its tools. Inherit and Off are unaffected.
Named values an automation reads instead of branching on the project (#238): a Jira key, a team, a board id.
AutomationVariable is {name, value} (names follow the input rule, values are plain text up to 2,000 characters, at
most 50 per list; automationVariables.ts in contracts).
- Where they live. The board's are the
automationVariablessetting (PATCH /api/settings, edited under Settings → Autopilot → Limits & safety → Variables); a project's overrides areprojects.variables_json(migration 036,PATCH /api/projects/:idwithvariables, edited in the same section with the project picked in its menu).effectiveVariableslays the project's over the board's. Both writes publishautopilot.changed, since a row's "Needs" line depends on them. - How they are read. A prompt reads
{{vars.<name>}}; a command, script or check reads<PREFIX>_VAR_<NAME>(variableEnvName) or stdin'svars. Like inputs they are filled in once and never read again for placeholders, and a{{vars.x}}in a command or script body is refused like any placeholder. - A missing value skips the project.
variablesNamedBy(action)lists the names an action needs: the prompt's{{vars.x}}, and, best effort,vars.x,vars["x"](also["vars"]["x"]) and<PREFIX>_VAR_Xin a check, script or command. A method call such asvars.get("x")reads one as optional and isn't counted, and a name built at run time isn't seen. A variable has a value when it is set and not blank, so a project can opt out by overriding one with nothing. The custom automation'scheckdrops every project missing one (missingVariables): no candidate, no run, no check script. What happened meanwhile is dropped, not held: when a settings or project write leaves a project with every variable an automation needs where it lacked one before,rearmWhereFilled(wrapped around both updates increateServices) re-arms the automation there (rearm, with the project's epics that have an arming of their own), so it starts from that moment rather than firing every move, PR event or missed slot of the gap. In a dry run it records one skipped run per project and set of names (needs:<project>:<names>) saying "Needsjira_keyin billing". The catalogue entry hasAutomation.needs(projects), which the overview calls with the projects the automation is on in (directly or through an epic) to giveAutopilotAutomation.needs, "Needsjira_keyin: billing", shown in orange on its rows (NeedsVariablesWarning). Unlikeblocked, it doesn't stop the automation being switched on: the other projects still run it. - Repository URL.
{{project.repo_url}},<PREFIX>_PROJECT_REPO_URLand stdin'sproject.repoUrlholdhttps://<host>/<repo>from the project folder'sorigin(repoWebUrloverremoteRepoinintegrations/gitRemote.ts, credentials dropped).createRepoUrlsrunsgit remote get-url originthrough the services'runGit, cached per folder for 10 minutes, and gives "" when there is no folder, no repository or no origin; it never blocks a run.checkresolves it for the projects in scope (so previews show it) andactagain for its own project, asCustomScope.repoUrl, the fifth argument ofcustomValuesbesidevars. The test run gets both. - The editor and import page list the variables the action reads with the projects that have no value for each
(
variableNeedsinvariables.logic.ts). The preview fills the sample project's variables and shows the repository URL as a placeholder (the browser can't readorigin). A bundle never carries values (they are the sharer's); the import page derives the names from the file's action. - Not secrets. Values show in dry runs, previews, run details and backups, so the editors say to keep tokens out.
An agent action on a schedule can carry a check (a CustomScript: language, body, timeout) that runs before any
agent and decides what, if anything, they start for (#227). Null, the default, runs one agent per slot as above. Only a
schedule takes one for now (checkCustomDefinition); task triggers would need a check per task event.
- Output. The script prints JSON lines on stdout, each an object with a non-empty string
key(at mostCHECK_KEY_MAX, 200 characters) and any fields of its own;parseCheckOutput(contracts) reads them. Blank lines are skipped and a key printed twice counts once; any other line (not JSON, not an object, no key, a key with a control character, which would end up in the run's label and session name, overCHECK_LINE_MAX) fails the whole output with its line number, so a script that prints a strayDone!starts nothing. At mostCHECK_ITEMS_MAX(500) items are read per run. It gets the same environment and stdin context as a script action, with no task, and runs in the project'sworkspaceRoot. A{{…}}in it that names a placeholder is refused. - In the engine.
checkmust not wait on a script (the engine awaits each automation'scheckin turn), so the first pass of a slot starts the script in the background and returns nothing; when it ends it callsCheckContext.wake(the engine's debounced pass) and the next pass returns what it printed. Where each project's check stands (running,donewith the items,failed) lives in aCheckRunsmap made once increateServices, keyed<automation id>:<project id>and stamped with the slot and the automation'supdatedAt, so it runs once per slot and again after an edit. One runs at a time per automation and project: a check that outlasts its interval is waited for rather than started again beside itself, what it printed is acted on once (offered) in the slot it ended in or the one after (finishedSlot, by the engine's clock,CheckContext.clock), however many intervals it ran for, and the slot due then gets a run of its own. Output no pass read by then (Autopilot paused, the automation switched off) is dropped rather than acted on late. It is in memory only: after a restart the slot's check runs once more, and the items' dedupe keys keep that from starting anything twice. The check doesn't start while no agent could (agentHold: quiet hours,maxConcurrent, the daily caps), so it isn't run only for its items to wait (a dry run runs it anyway), nor whileAUTOPILOT_BACKGROUND_MAX(4) checks are already running, across automations and projects: the agent caps don't bound scripts. The one-run-per-project hold of scheduled agents doesn't apply: each item is a run of its own. - Items. Each item becomes a candidate keyed
check:<projectId>:<item key>. The board is the memory, not the script: a key with a run (going, done or failed) is never started again, so a script can print every open item each time, and a failed item starts again only throughretry_autopilot_run. Keys that already have a run are dropped before counting, and at mostCHECK_NEW_ITEMS_MAX(50) new ones go per pass. Items go through the engine's per-candidate hold as usual: one held bymaxConcurrentor a cap isn't recorded, and a later pass in the same slot takes it from the same output (a finished agent run asks for a pass). Printing nothing is a quiet pass: no run. - A failed check (non-zero exit, timeout, a missing interpreter, output past
STDOUT_MAX, a bad line) becomes one candidatecheck-failed:<projectId>:<slot stamp>:<updatedAt>(CHECK_FAILED_KEY_PREFIX) withstartsNoAgent, whichactrecords as a failed run with the error, the tail of what it printed to stderr (or, with nothing there, of all its output) and the exit code. No task, so nothing is flagged; the automation's run history shows it.actthen forgets the failure, and that run's key keeps the slot's check from running again until it is retried (which retires the key), the automation is edited (a newupdatedAt) or the next slot comes. Like Fix PRs' give-ups, these runs (retried or not) don't count towards the daily run cap ormaxConcurrent. - The agent. Each item's agent starts headless with no task, like a scheduled one, labelled
<name> · <item key>.customAgentPromptfills{{item}}(the item as JSON) and{{item.<field>}}(a dotted path; a string as it is, anything else as JSON, a missing field empty) in the same single pass as the other placeholders, so an item's text is never read for placeholders itself; a prompt can name them only with a check. The footer quotes the whole item inside<item>tags as data, not instructions, and asks for no handover: one run of the check starts many agents, and the check is their memory. - Untrusted items (
untrustedItems, on by default): items usually carry text anyone can write, such as PR titles and comments. Their agents run read-only withuntrustedInputandboardTools, like Orchestrate: no MCP server but this board's, file tools only in their empty folder, and the board's tools narrowed byCHECK_ITEM_DENIED_TOOLS(Orchestrate's deny list plus starting, messaging or retrying other agents' work and merging). What is left reads the board, adds notes and asks the user. Allowed tools and slots can't be used with it, so the definition check refuses them; off, the agents get a scheduled agent's access and the action's tools. - Dry run and Preview. The check really runs (the preview says so), and each new item is recorded as a skipped run whose preview is its agent's filled prompt; a failed check records a skipped run with the failure.
- Sharing and the editor. The bundle carries the check with the action (a version 2 file, imported only with the script confirmation; see Sharing automations), and the import page shows it and says how its items' agents run.
- In the editor. A schedule's agent form has Check first with a script: a switch that reveals the
script editor, the untrusted-items switch (with a warning when it is turned off) and
ScriptWarning(the check has no heading of its own for the Runs as you badge). The section is hidden for the other triggers, andcustomFormToInputleaves a check out unless the trigger is a schedule, so what was typed survives switching the trigger and back. The prompt hint names{{item}}and{{item.<field>}}while a check is on.
ScriptField (components/autopilot/) is the one editor for both scripts of the form: a script action, picked as Run a
script beside Start an agent and Run a command, and an agent's check. It holds:
- A language toggle (Node.js, Python, PowerShell, sh) with what each needs installed (
SCRIPT_LANGUAGESinscripts.logic.ts): Node is always there, since it runs on the board's own Node. - The code, in CodeMirror 6 (
ScriptEditor, which lazy-loadsScriptEditorImplso the ~470 kB chunk stays out of the main bundle; until it loads, a plain text area edits the same value). It has a monospace font, line numbers and highlighting for the language, coloured from the theme's tokens so it follows the theme and the Contrast setting. Tab indents with spaces; Esc then Tab leaves the editor so a keyboard user is never trapped. - Load from file (the file's extension picks the language; a file over
CUSTOM_SCRIPT_MAXcharacters is refused) and Copy. - A starter per language and role (
scriptStarter): it shows how to read the JSON context on stdin and, for a check, how to print JSON lines. A new script starts from it, and changing the language swaps it for the new language's only while the text is still some starter (withLanguage), so nothing the user wrote is lost. - The timeout, and the test run below.
- Insert chips over the code (
InsertChips,insertChips.logic.ts), coloured by group (sdkStyle.tsx): project, task and PR (left out for a schedule, which has no task), automation, the variables set on the board or any project, and the automation's inputs. A chip puts the value's read at the cursor. There is one convention, shared by the starters, the examples and the authoring skill: a script parses the stdin JSON intoctxand reads from it (ctx.project.name,ctx['project']['name'],$ctx.project.name); only sh and a command read the environment ("$X"), since they can't parse JSON. The same chips sit over a command and an agent's prompt ({{…}}placeholders, plus the item for a check's agent), in place of hints that listed every name. - A status line under the code and under a command (
SdkStatusBar): how values arrive, exit 0 succeeds, the output kept, and two links. Examples opens the snippets for the language and role (AUTOMATION_SDK_SNIPPETS) to copy or insert at the cursor. Full reference opens a side sheet with every value by stdin path or environment variable (AUTOMATION_SDK_SCOPE), the rules as titled cards (AUTOMATION_SDK_RULES) and the examples. The text is in contracts (automationSdk.ts) so the authoring skill can quote it; a test checks that the snippets' variable reads are whatvariablesNamedByfinds. The starters readproject,varsandinputswithout naming a variable, so starting from one never makes an automation need one.
POST /api/autopilot/custom/test-script (TestScriptInput → TestScriptResult; services/testScript.ts) runs a draft
script once, now, in the folder of a project the user picks, and returns the exit code, stdout and stderr (each cut to
TEST_OUTPUT_MAX), the duration and whether it timed out. It is not a dry run: the script executes with the same
interpreter, environment and stdin context a real run gets, so it can do whatever it does (approve a PR, push), and the
editor says so and asks for a second click ("Run it for real") naming the project. Nothing is saved or recorded: no run
row, no event.
- Inputs reach an action and a check alike, as in a real run, with the project's variables and repository URL. An action may be given a task (the form's sample task, or none) and then reads that task's values; a check has none, like the scheduled agent it belongs to.
- For a check that exits 0 the response also has the output read as the board reads it (
parseCheckOutput): the items and how many were dropped, orproblemnaming the bad line, and the prompt the first item's agent would start with (customAgentPromptwith the form's prompt and skill, so it shows the<item>block). A check that fails or times out has no items. - A missing interpreter, or a project with no folder, is an answer (
error) or aVALIDATIONerror, not a server error. - Like writing a script, it needs an
Originheader, so only the board's page can start one, and one test runs at a time (CONFLICTotherwise), so a double click can't act twice. There is no MCP path. - The test uses the script's own timeout, and a client that goes away doesn't stop it.
An automation is shared as a versioned JSON file, an AutomationBundle (packages/contracts/src/automationBundle.ts,
format: "<brand id>.automation", version: 1, 2 for a file that carries a script (SCRIPT_BUNDLE_VERSION), or 3
(AUTOMATION_BUNDLE_VERSION) for one whose action reads a variable or is a command
or script with inputs, so a board from before those says the file is newer instead of refusing it as invalid; a file
below 3 that declares inputs on a command or script is refused). It holds the name, description,
trigger, the filters' labels only, the action, the declared inputs of any action kind ({name, label, type, default}), an agent's declared slots ({name, label, description}) and
optionally the skill as {name, body}, and filters.epicTasks (missing reads as true). Not in it: where it runs,
arming, switches and slot tools, so the importer's own servers and projects are theirs to choose. parseAutomationBundle checks a file, telling one from a newer
version apart from a malformed one.
Scripts (a script action, or an agent's check; actionScripts lists them) are someone else's code run as the
importer, so they get more care. A file is written as version 2 only when it carries one and needs nothing of version 3
(bundleVersionFor), so every other file stays version 1 and a board from before scripts still reads it; a version 1 file that carries a
script is refused, since an older board would read it without the script. Language, body and timeout travel as they
are, the body held to CUSTOM_SCRIPT_MAX by the contract. Importing a file with a script needs confirmScript: true (the
service refuses with a reason otherwise, whoever calls it) and, like creating one, the board page's Origin
(actionRunsCode, in the route's guard, also covers a check script on create and patch). There is no MCP path that
writes one (an agent's draft only reaches this import, from the board's page), and a suggestion (which can only change an agent's prompt) leaves the check as it was. Dump, restore and
the git backup keep the whole action_json, so a script comes back as written.
| Route | Does |
|---|---|
GET /api/autopilot/custom/:id/export |
The bundle (automationBundle): inputs' current values as defaults, slots empty, and the action's skill read from the user's installed skills when it is there and fits BUNDLE_SKILL_BODY_MAX |
POST /api/autopilot/custom/import |
Body {bundle, inputs, slots, projectIds, installSkill, confirmScript}; 201 {automation, skill} |
customAutomations.importBundle parses the file again (a body that isn't one is VALIDATION), fills the inputs and
slots (bundleToDefinition; an input left out takes its default), starts it Only in projectIds when there are any (the
import screen's Where it runs, DraftProjects), gives it a free
name (Name (2)) and runs the usual definition check before writing anything, so a file that can't run leaves no
skill behind. The skill goes to ~/.claude/skills/<name>/SKILL.md (installSkill in skills.ts) only when
installSkill is true; a name taken by any installed skill (folder or frontmatter name) becomes <name>-2, -3, with
the frontmatter name rewritten, and the automation names what was written. Without installSkill it names no skill. It
is saved like any new one, in Preview for the board (or those projects). As when creating one, a shell or script action needs the board page's
Origin, and so does installSkill with a skill in the file: a skill persists into every later session that reads
the user's skills. The skill's frontmatter name: is always set to the name it was installed as (added, with a
frontmatter block, when missing), so a file can't install a skill under another name. Export carries only the skill's
SKILL.md, not other files beside it, and the UI says when a skill went into the file.
The web import screen (CustomAutomationImportForm, /settings/autopilot/custom/import) reads the file in the browser
and shows the prompt, command, scripts (each with its language, and a check script as such), allowed tools and skill
text in full, as untrusted, before Import. A file with a script also shows ScriptWarning (the shared notice for
the editor too: it runs as you and can do anything you can, such as approve PRs through gh; text it reads from GitHub
comes from anyone who can comment, so it should check who wrote it) and a switch ("I've read the script above and I understand it runs on my machine as me"), which
Import waits for. It also offers the
file in AUTOMATION_EXAMPLES (automationExamples.ts). The "Improve prompts and skills" example that was here is now the built-in
Improve automations; a copy someone imported is an ordinary custom automation and is unaffected.
Review repo PRs (#230), an example check script that commented on any repository PR, was retired by #21: Review PRs' other people's PRs does it as a built-in, and an imported copy keeps working until deleted.
Agents can't save a custom automation, but they can write one for the user (#241): draft_automation (in
mcp/tools/autopilot.ts) keeps it as a draft, and only the user's import on the board's page saves it. The Origin guard
on the REST writes is unchanged, so this opens no path to setting up a command or script without the user.
- The shape is a shared file's. The tool takes
automation, anAutomationBundlewithoutformatandversion(they are filled in, at the newest version, so the agent needn't work out which), and anoteto the user.checkAutomationDraft(automationDrafts.tsin contracts) parses it and runs what an import runs on it with the inputs at their defaults and the slots empty (labels,checkCustomDefinition), and lists every problem with where it is, so the agent can fix them all in one go; a newerversionis told as such. Capped at 500,000 characters of JSON and a 2,000-character note. - Stored apart.
autopilot_drafts(migration 037: id,bundle_json, note,created_by,created_at,expires_at) holds it for 14 days (AUTOMATION_DRAFT_TTL_DAYS), at most 20 at once (the oldest go). Expired ones are left out of reads and pruned on the next draft. Not in backups: it is a hand-off, not the user's data until it is imported. - What the agent is told. The import page's URL (
automationDraftPath,/settings/autopilot/custom/import?draft=<id>on the board's URL), the expiry, whether a script needs confirming (or, for a command, reading), the slots to fill and, per variable the action reads, the projects with no value for it, so the agent can tell the user. The result says nothing is set up until the user imports it, and that it then saves in Preview. Orchestrate's agent is denied the tool. - The user. Each draft sends an
automation_draftnotification (task-less; the inbox opens Needs you in Settings → Autopilot). That section lists the drafts with Review and Dismiss. The import page with?draft=loads it (GET /api/autopilot/drafts/:id, NOT_FOUND once gone) into the same untrusted preview, script confirmation, inputs and slots as a file, under a banner naming who drafted it and their note, and sendsdraftIdwith the import, which deletes the draft once the automation is saved. Dismiss draft isDELETE /api/autopilot/drafts/:id. Every change publishesautopilot.changed. - Review, or Edit first. The import page is the builder's review step for someone else's automation: the
formSentencesentence, the read-first sections, Saves in Preview or On (On sets the board's mode after the import), and Edit first, which opens the builder (CustomAutomationEditorForm) at Details onformFromBundlewith what was filled in. Saving there creates it over the ordinary route (Origin-guarded) and dismisses the draft; a skill the file carries isn't installed that way. Opened on a script (or, for a change, a changed one), the builder'sconfirmScriptholds Save until the same "I've read it" switch is on, so editing first doesn't skip it. - Changes (
replaces). A draft can name the custom automation it is a new version of:replacestakes its id,custom:<id>key or exact name, resolved on drafting (a built-in's key or title is refused as VALIDATION, anything else unknown as NOT_FOUND) and stored as the id (autopilot_drafts.replaces, migration 044; no foreign key, so a draft whose automation was deleted says so when applied). Needs you shows it as Change to (AutopilotNeed.replaces), and the page opensAutomationChangeReview: per field, a line diff of the current and proposed definition (changeReview.logic.ts), the agent's note as Why, and a warning for tools it adds. Apply change isPOST /api/autopilot/drafts/:id/apply→customAutomations.applyDraft: the draft's definition with input values and slot tools kept by name (new ones from the request), the automation's own projects and epic, saved withupdate, so the id, switches and run history stay (a changed trigger, filters or variables re-arm it, as any edit does). A changed script needsconfirmScript, checked in the service; the route holds a draft with code or a skill install to the board's Origin, as the import route does. Keep current dismisses the draft; Edit first opens the builder on the automation with the change filled in, and its Save changes dismisses the draft.
A run for a task a connected machine holds is carried out on that machine, by the same runner code, from origin; so are a custom automation's command and script for such a task (remote machines). Set to T3 Code or Auto, it is a thread in the machine's own T3 Code when that is connected and has the project, else headless with a note saying why; there a T3 only automation runs headless rather than failing, and a nudge the machine can't deliver starts afresh from the PR's branch (T3 Code threads from Autopilot). The rest of this section is what happens on whichever machine runs it.
An agent action calls ctx.runner.start({ run, prompt, operation, options, … }) (autopilot/runner.ts); operation is what the run's model is resolved for (Models). The engine
binds the run's update into it, so the session, thread or worktree is on the run as soon as it exists, and a
run that fails afterwards still shows it. A runner throws when the work couldn't be done, and the run fails
with that error.
kind: "start"(the default) begins a new session. The automation'srunneroption picks the runner: Auto (a T3 Code thread when T3 is detected and its live poll is ok, else headless), T3 only (fails when T3 isn't connected) or Headless only. Once Auto has asked T3 it never falls back to headless: the thread may have started even when the reply was lost. Before choosing, a status that isn't ready is refreshed (t3.test(): discover and poll again), because the cached one is empty just after a restart.- A T3 that can't be reached is waited for. A T3 launch or nudge that fails because T3 isn't answering
(
isT3Unavailable: not running yet, shell, socket or branch listing unreachable), and T3 only finding T3 not detected, is retried every 15 seconds for up to ten minutes in all (T3_HOLD_MS,T3_RETRY_MS; the clock starts at the first failure and is shared by the readiness check and the launch). Auto doesn't wait: a T3 that isn't ready after a fresh look sends it headless, as before. T3 only waits while T3 isn't detected; a detected T3 whose shell isn't answering goes on to the launch, which waits if it is unreachable and fails if T3 refuses (an expired token). A request can passstillWanted, asked after each wait: Start planned uses it so a task started by hand, moved or archived meanwhile ends the run as skipped (no thread, no flag). The run staysrunningmeanwhile: no failed run, no attention flag. A retried launch keeps its command id, so T3 never starts two threads. Anything else fails at once (no model ready, no token, project not in T3, a changed protocol), and so does a T3 that is still unreachable when the ten minutes end. A board restart during the wait fails the run like any run a restart strands. labelis what the run is, short, and leaves the task's number out: "Review PRs · PR #73 round 1", "Fix PRs · PR #73", "Start planned", "", "Digest". Each automation supplies it, and the runner names the session withautopilotSessionName(label, task). A run on a task is#<n> <task title> · Autopilot: <label>(the title cut to about 60 characters with…, the automation part never cut), the task first like a thread started by hand, so the useful part survives a truncated sidebar. A run with no task (a digest, Orchestrate, a scheduled or item-driven custom agent) isAutopilot · <label>, andAutopilot sessionwithout a label. That one name is the session link's label,claude --nameand the T3 thread's title (TaskThreadInput.title, default the task's number and title).isAutopilotSessionNamestill recognises the oldAutopilot ·prefix, so session links named before the change stay marked as Autopilot sessions.kind: "nudge"posts the prompt into the task's implementing T3 thread (implementingThread, see agent-handoff.md;sendToThread). It never starts a session, and fails when the task has no live thread. Fix PRs passes itsworkspaceandexpectHeadwith a nudge too, which a board ignores and a machine starts afresh from when it can't reach the thread.workspace.prBase: the branch the agent's PR goes to when it isn't the default branch (an integration epic's). The session starts from origin's copy of it (T3:baseRefwithstartFromOrigin; headless:createWorktreewithbaseFromOrigin), and both workspace notes say to open the PR against it withgh pr create --base.workspace:{ baseRef }starts a new branch from that ref (default: the default branch);{ branch }starts from an existing branch, such as a pull request's, and the agent pushes back to it. The default branch is refused either way, except for a read-only run, which can't push.- No task. A run with no task (a digest's) is headless only: its CLI in an empty temporary folder that is
removed afterwards, with no worktree and no session link. T3 Code and
nudgefail for it. - Headless only:
access: "none"gives the agent no tools at all (no built-in tools, no MCP servers), for one that must work from its prompt alone. - Headless only:
access: "read-only"for agents that only read (a reviewer),toolsto allow more (Bash(gh pr review *)),deniedToolsto deny more (Orchestrate'sORCHESTRATE_DENIED_TOOLS), andoutputSchemafor a structured answer, returned asoutput. A T3 thread can't be held to these, so a request with any of them runs headless under Auto, and fails under T3 only. Also headless only:untrustedInputfor a read-only agent that reads text anyone can write (no MCP servers or checkout settings, file tools limited to the worktree, only exact git commands),runTools, the board-served tools the run reads its target through (Run tools), andexpectHead, the commit the worktree must be at, checked before the agent starts (WorktreeHeadError, withmovedwhen the branch is ahead of it).
Every agent automation spreads the shared runner options into its config (autopilot/runnerOptions.ts:
RUNNER_OPTION_SHAPE, RUNNER_FIELDS, RUNNER_DEFAULTS). All but the model take the board's
agent defaults where no scope sets them; the defaults below are those defaults' own:
| Option | Default | Meaning |
|---|---|---|
runner |
auto | auto, t3 or headless |
budgetUsd |
5 | Headless: --max-budget-usd |
timeoutMinutes |
60 | Headless: the agent, and everything it started, is killed after this long |
modelChoice |
inherit | The model runs start on: inherit, a tier, a custom model or a typed model (Models) |
t3Access |
default | T3: the most access a thread gets. Never more than T3's own default |
T3 thread. launchTaskThread with the command id autopilot-<runId> (T3 de-duplicates by it), in work mode,
so the model is the run's model (Models) when its T3 model is ready, else T3's default. The thread gets a new T3 worktree; for a
branch it starts from origin's copy of it. The prompt ends with a note on where to push and the safety rules.
- One launch per repository at a time. T3 answers the launch at once and prepares the workspace afterwards,
starting with a
git fetchin the project's checkout. Fetches side by side in one checkout race for its ref locks and all but one fail ("Workspace preparation failed during provision worktree: … git fetch origin failed"), and the engine doesn't await agent actions, so every launch of a pass would start together. So each launch holds the repository's gate (autopilot/repoGate.ts, keyed by the project folder) from the launch until T3's shell shows the thread with a run that is pastpreparing(threadWorkspace, every 2 s), for up to three minutes (T3_PREPARE_MS; then the gate is let go and the run carries on), twice that when the preparation is retried. The headless runner's worktree fetch takes the same gate (gateFetches). What the user asks for doesn't, since a hold can last minutes: launches from the dialog andstart_task_thread, and an epic's branch (ensureEpicBranch). A wait for an unreachable T3 lets the gate go meanwhile. - A failed preparation is retried once. When the thread's run goes
failedduring that wait, the runner asks T3 to prepare it again in the same thread (retryPreparation: T3'sprepared-run.retrycommand, idautopilot-<runId>-retry), still holding the gate, so the link and thread stay. The shell may still show the old failure for a moment, so a failure counts only once the thread has changed since the retry. A second failure fails the run with "T3 Code couldn't prepare the thread's workspace: <T3's error>". T3 refuses the retry for a run that failed for another reason, which fails the run with "T3 Code couldn't start the thread: …".
Headless. A CLI in a worktree of its own (autopilot/worktrees.ts): claude -p by default, or codex exec or
the Copilot CLI or Antigravity's agy when the run's model says so (Headless drivers):
git worktree add --no-track -b autopilot/<task#>-<run8> <data dir>/worktrees/<repo>/<task#>-<run8> <start>, where<start>is the base ref,origin/<default branch>ororigin/<branch>, after a best-effort fetch. The new branch tracks nothing, so a baregit pushcan't land on the branch it started from. A worktree folder that overlaps the project's checkout is refused. The worktree then gets its push guard.- The board picks the session id and records it on the run, with the worktree, before the agent starts (Codex and
Antigravity pick their own: it is recorded as soon as their first JSONL event names it). It
also links the session to the task as an
agent_sessionlink (agent sessions) with the run's name as its label and the worktree as its folder, under the harness that ran it, so the card offers Open in terminal (claude --resume <id>,codex resume <id>,copilot --resume=<id>,agy --conversation <id>). Sessions are kept: there is no--no-session-persistence. The link's status comes from the run, not the harness's files: Working while the run goes, then Finished or Failed with the time it ended (agent sessions). --permission-mode acceptEdits, with Bash, the file tools and this board's MCP tools (mcp__<id>) allowed. Read-only runs usedontAskwith the reviewer's read-only list. The agent reaches the board through the user's own MCP config.- Push safety: Claude Code checks deny rules before allow rules, and in every part of a compound command.
The deny rules block force-pushes (
--force*,-f,+ref),--mirrorand--delete. They block pushes to the default branch, including ones written*:mainorrefs/heads/mainor run asgit -C <dir> push. They also blockgh pr mergeandgh api …merge…. They match the command as written, so they are a guard rail, not a sandbox; the prompt states the same rules. - The cost (
total_cost_usd) is recorded even when the run stopped early (budget, turn limit). An early stop or a timeout fails the run. The CLI is each provider's path (harnessCliSetting, Settings → Agents → Providers), else its name on PATH.
Each harness has a HeadlessDriver (integrations/headlessAgent.ts for Claude Code, integrations/headlessDrivers.ts
for the others): the argv, a parser that turns its output into an outcome, and what it can be held to.
| Capability | Claude Code | Codex | Copilot CLI | Antigravity |
|---|---|---|---|---|
Structured output (outputSchema) |
yes | yes | no | yes |
Isolated read-only run (readOnly) |
yes | yes | no | no |
Untrusted-input lockdown (untrusted) |
yes | no, warns | no | no |
No tools (access: "none") |
yes | no | no | no |
Extra tool rules (tools, deniedTools) |
yes | no | no | no |
Board-served run tools (runTools) |
yes | yes | no | no |
Spending cap (budgetUsd) and cost |
yes | no | no | no |
| Session id given up front | yes | no | yes | no |
Each "yes" for Codex was checked against codex-cli 0.166.0, and each Antigravity cell against agy 1.5.19; the findings are below. "No, warns": Codex has every other part of the lockdown but can't confine its file reads, so an operation that reads text anyone can write runs on it only when the user chose it, with a warning (Warnings).
- Which one. The provider the run's operation resolves to (Models): the chosen model's preferred
provider when it can do what the run needs, else the first in the user's Providers order that can. A run that needs
what only Claude Code can do (a no-tools digest, tool rules, the full untrusted lockdown, or an editing run with no
task, which has no worktree and so no push guard) runs on Claude Code, and its detail says why; with Claude Code not
added, it fails with the reason instead. Codex also runs the structured operations on the user's own input (the
board reviewer, the settings Ask) and, when the user chooses it, those that read
text anyone can write (PR review, GitHub issue import), with a warning.
Antigravity runs edit runs in a task's worktree, with or without a schema (task runs, PR fix, custom automations on a
task). The Copilot CLI runs only edit and plain read-only runs. Every operation goes through
headlessDriverFor: the Autopilot runner, the board reviewer (headlessReview.ts), Ask (settingsAsk.ts) and issue import (headlessImport.ts, throughstructuredRun.ts). - Needs. Each operation's needs are in
OPERATIONS(contractsoperations.ts): the board reviewer and Ask needoutputSchemaandreadOnly(isolated read-only, for the user's own diff or question); PR review needsoutputSchema,untrustedandrunTools; issue import needsoutputSchemaanduntrustedfor a GitHub issue (its text is in the prompt) andtoolRuleson top for a ticket (IMPORT_TICKET_NEEDS: it reads through the user's own MCP servers).checkNeeds(harness, needs)sorts what a CLI lacks into missing (it can't run it) and warned. - Structured output on Codex:
--output-schema <file>. Checked on codex-cli 0.166.0: Codex sends the schema as an OpenAI strict response format and holds the answer to it (asked for an enum value outside the schema and extra fields, it returned a conforming object). Strict mode refuses a schema whose objects don't sayadditionalProperties: false(a 400 inturn.failed) and wants every property required, sostrictSchema()(integrations/strictSchema.ts) closes every object and makes an optional field nullable, andfromStrict()drops the nulls the model then writes for them before the caller's zod schema reads it.withDriverArgswrites the converted schema to a temp folder outside the run's working folder and removes it when the run ends. The answer is the lastagent_messageitem's text, parsed as JSON; one that isn't fails the run. - Isolated read-only on Codex (
readOnly, and every untrusted run):--sandbox read-only --ignore-user-config --ignore-rules -c web_search="disabled" --disable apps, plus--ephemeralfor a run with nothing to resume (the board reviewer, Ask, import). Checked on codex-cli 0.166.0: the sandbox refused a write in the working folder ("Read-only file system", andapply_patchwas rejected) and the shell had no network (curlcouldn't resolve a host that the machine could). Two things sit outside the sandbox and are turned off: the model's hosted web search (web__run) and, once the shell is off, the hostedcodex_appsconnector. Claude Code's isolated read-only run is its reviewer's read-only tool list without the board,--strict-mcp-configand--setting-sources user. - Codex can't confine reads, so it lacks
untrusted. Its read-only sandbox read a file outside the working folder.--disable shell_tool --disable unified_execdoes remove the shell, but the run keeps code-modeexec,spawn_agentsubagents andview_image, several of the features involved are marked under development, and what the model lists as its tools changed from run to run, so no reliable confinement was found. - Codex:
codex exec --json --skip-git-repo-check --sandbox danger-full-access [--model <m>] [-c model_reasoning_effort=<effort>] -(read-only runs use--sandbox read-only), prompt on stdin. Checked against codex-cli 0.166.0 (recorded output is inintegrations/fixtures/codex/). Edit runs leave Codex's sandbox off. Itsworkspace-writesandbox does work for git when both the worktree's git dir and the repository's common git dir are added as writable roots (-c sandbox_workspace_write.writable_roots=[…], with-c sandbox_workspace_write.network_access=true):add,commit(the repository's hooks run) and an HTTPSpushto GitHub all succeeded. Without the rootsgit addfails (Unable to create '…/index.lock': Read-only file system). But only the worktree, those roots and temp folders are writable then;mkdir ~/.cache/xandmkdir ~/.local/share/xfail withRead-only file system, which is where a package manager keeps its store and caches, so an edit run that installs or tests would fail. SSH pushes weren't tried. So the access is the one a Claude Code edit run has (Bash allowed outright); the push guard still applies, and the guard refused a force-push, a branch delete and a push to the default branch from a real Codex run. The effort is the config key (codex exechas no flag for it): the model's Codex effort (nonetoultra, as Codex'smodel/listnames them) goes through when the profile sets one; Codex's own session file confirmed the model, effort and sandbox of a run. A bad value isn't refused by the CLI but by the API (the run ends witherrorandturn.failed). The parser readsthread.started(the session id), the last completedagent_messageitem (the answer) andturn.failedorerror; a run with noturn.completedfailed. A refusal from the API arrives as its response body inmessage, and the parser shows the error inside it. Items of typeerrorare warnings (an unknown model's metadata) and are ignored. The agent's shell hasCODEX_THREAD_ID, the same id asthread.started's. - Copilot CLI:
copilot --output-format json --no-ask-user --session-id <id> --allow-tool write --allow-tool shell --allow-tool <board> --deny-tool 'shell(gh pr merge)' [--model <m>] [--name <name>], prompt on stdin. Read-only runs allow onlygit status,log,diff,showandrev-parseand denywrite. The parser takes the lastassistant.messageorsession.task_completesummary as the answer, andsession.erroror a printedError:line as the failure. Copilot's rules match a command's first-level subcommand (git push), so they can refuse merging but not a force-push alone: the push guard does that. - Antigravity:
agy --output-format stream-json --input-format stream-json --disable-slash-commands --dangerously-skip-permissions [--json-schema <file>] [--model <m>] [--effort <e>], with the prompt on stdin as one message,{"event":"user","message":{"content":"<prompt>"}}(HeadlessDriver.stdin, applied bydriverStdin). agy reads no plain-text prompt from stdin, and print mode with stream-json input needs no-p. Checked against agy 1.5.19 (recorded output is inintegrations/fixtures/antigravity/):- Permissions. A headless agy asks nobody, so it soft-denies any action that needs approval and reports it in
denied_actions. With its terminal sandbox off (the default) that is every shell command, evenls. An edit run therefore passes--dangerously-skip-permissions, the access a Codex or Claude Code edit run has, and the push guard still applies. The driver refuses any run that isn't an edit (antigravityArgsthrows), so a caller that forgot to ask forreadOnlyfails instead of running unguarded. - Merging. A
command(…)deny rule passed with--settingsholds even under--dangerously-skip-permissions(command(echo forbidden)refusedecho forbidden now; the rule matches the command's leading words, sogit -C . statuspassedcommand(git status)). But--settingsreplaces the user's ownpermissions.denylist for the session rather than adding to it (checked with/permissions), so acommand(gh pr merge)rule would drop the user's deny rules. The board doesn't pass one: like Codex, agy is only told not to merge. - No read-only run. Its file tools wrote a file in the working folder under every combination tried: the default
mode,
--mode plan(which also has no effect with slash commands off),--sandbox(which confines commands to the workspace, and still letecho > filewrite inside it) and a--settingspermission deny rule (agy accepts any rule name, andwrite(*)didn't stopwrite_file). So it lacksreadOnly, and with ituntrustedandnoTools. - No run tools.
--settingstakes onlysettings.jsonkeys and refuses others (unknown setting "mcpServers"). MCP servers live in the user'smcp_config.json, which the board doesn't write, so print mode can't be pointed at one run's endpoint. agy acpdoesn't change that enough to build on. Its Agent Client Protocol sessions (JSON-RPC on stdio) were tried as a second driver, on agy 1.5.19:- Run tools work.
session/newtakesmcpServers({type: "http", name, url, headers}, so the token goes in a header), and agy called the endpoint. The user's own servers load too unless--gemini-dirnames a fresh folder. The login still works from an empty one, so the board would write nothing under~/.gemini. Every MCP call asks the client first (session/request_permission), even for a tool markedreadOnlyHint. - Writes and commands can be refused. With the default settings,
write_fileandedit_filewrite inside the workspace without asking; deny rules in that folder'ssettings.jsonhave no effect over ACP, and agy never calls the client'sfs/*methods. With{"toolPermission": "strict", "agentMode": ""}in that folder'santigravity-cli/settings.json, every file read and write (inside the workspace or not), shell command,run_workflowscript, MCP call and subagent write asks first, with itskindand path. The client can refuse each one, and nothing was written. - But the hosted
search_webtool never asks, and nothing turns it off: no setting, deny rule or the session'sdisableBuiltInToolsfield had any effect. Given a URL as its query, it returned the page.readOnlymeans no network, and both other read-only drivers turn web search off, soagy acpdoesn't givereadOnlyeither, and with ituntrustedandnoTools. - Run tools alone would move nothing onto Antigravity. Every operation that needs
runToolsalso needsuntrusted(PR review, Orchestrate), and the structured read-only ones (the board reviewer, Ask) needreadOnly. So no ACP driver was built. Should agy add a way to turnsearch_weboff, the rest is known:- Structured output would be a result run tool. agy checks a call's arguments against the tool's input schema and refuses ones that don't match.
- The session id is the conversation id, known as soon as
session/newreturns.agy --conversation <id>reopens it, unless it was run in a temporary--gemini-dir. - A bad model id is a JSON-RPC error on
session/set_model.session/cancelends the turn withstopReason: "cancelled". - A killed
agy acpexits 0, so a prompt that never answered has to fail the run.
- Run tools work.
- Structured output:
--json-schema <file>with the schema as given (schemaFile: "as-is"; agy wants an object at the root). The result carriesstructured_output. One without it fails the run. - Model and effort.
agy modelslists ids that name a level (gemini-4-neon-high), and agy refuses one of those with a different--effort("conflicts with --effort=high"). So for a model id that ends in a level (modelNamesItsEffort) the resolver drops the effort, which keeps the run's recorded model honest, and the driver passes none either. - Parser.
initnames the conversation (the session id). The finalresultevent holdsresponse,statusand, when the turn was cut short,finished_reason. A status other thanSUCCESSor anyfinished_reasonfails the run with itserror. A turn cut short by--print-timeoutstill saysSUCCESSand exits 0, so the reason is what counts. The board passes no--print-timeout;timeoutMinutesstops the run, which leaves noresultline, and that fails it too. A failed tool call (a step withstate: "ERROR") is the agent's to handle. The token counts agy reports are ignored (token usage).
- Permissions. A headless agy asks nobody, so it soft-denies any action that needs approval and reports it in
- Run tools: Claude Code gets
--mcp-config <file>naming only the run's server (aboard-run,RUN_SERVER_NAME) with its token in a header, andmcp__<server>allowed; a locked-down run keeps--strict-mcp-config, any other keeps the user's servers too. Codex gets--ignore-user-config -c mcp_servers.<server>.url="…" -c mcp_servers.<server>.bearer_token_env_var="<RUN_TOKEN_ENV>" -c mcp_servers.<server>.default_tools_approval_mode="approve", with the token in that variable. The approval mode matters in the read-only sandbox: there Codex asks before calling a tool withoutreadOnlyHint, and with nobody to answer the call fails ("MCP tool call requires approval, but approval policy is never"; a tool with the hint ran, checked on 0.166.0). The run tools all carry the hint, and the endpoint serves only the tools the run may use. Checked on codex-cli 0.166.0: acodex execpointed at a run endpoint calledpr_overviewandpr_diff(mcp_tool_callitems, no approval asked) and answered from the diff; and with--ignore-user-configa stdio server named in aconfig.tomlwas not started, while without it it was. The login underCODEX_HOMEstill applies. The Copilot CLI can't yet be held to one given MCP server, and Antigravity's print mode can't be given one for a run, so they lack the capability. (agy acpcan, but nothing needs run tools without the read-only lockdown it can't give; see Antigravity above.) - Cost: Codex, Copilot and Antigravity report none and take no cap. Only
timeoutMinutesstops them, the run records no cost, and the spend cap doesn't count them.
A provider that has the isolated read-only run but not the untrusted lockdown (Codex) meets untrusted with a
warning rather than not at all (checkNeeds puts it under warned, needsWarning gives the text: it can't confine
its file reads, so text anyone can write could make it leak local files into what it returns, such as a review the
board then posts):
- Never a fallback.
resolveOperationModelfalls back only to providers with nothing missing and nothing warned. With none, it refuses, and says which provider could run it with a warning if the user chose it. - Only when chosen for the operation: a typed model on that provider, at any level, or a tier or custom model whose preferred provider it is, set for this operation (on the task, the project, the automation or the Models page). A tier that is only the operation's default, or the task's own model, was chosen for other work: its preferred provider is passed over like any other with a warning, and the note says why.
- Said where it runs:
ResolvedModel.warning, also appended tonote, so a run's detail repeats it; an import logs it. The picker shows the provider with a warning dot and its tooltip, the warning under its list, and ", with a warning" on a tier that resolves to it; a provider with a need missing stays greyed out with the reason.
A headless run that reads a git host gets that host's reads as tools the board serves for it alone, instead of gh
and tool rules only Claude Code can follow (ADR 0013):
- The scope.
RunnerRequest.runToolsis{toolSet, target}(mcp/runTokens.ts): one tool set per kind of operation and the one thing it is bound to. The sets areprReview(a task's PR) andrepoPrReview(another person's PR), whose target is a PR, andorchestrate, whose target is a project ({ kind: "project", projectId }). - The token.
runOnDrivermints one before the agent starts (RunTokens.mint, through the runner'srunToolsdep): 32 random bytes, kept in memory by its SHA-256 only, alive for the run's timeout plus five minutes and never more than a day (RUN_TOKEN_MAX_TTL_MS). It writes the MCP config (runToolsMcpConfig) to a temp folder of its own outside the worktree, mode 0600, and in afinallyrevokes the token and removes the folder, however the run ended. Only a driver that reads the token from its environment (runTokenFromEnv: Codex) gets it there, inRUN_TOKEN_ENV. The token is never logged, never in a URL, never on a command line. - The endpoint.
POST /mcp/runwithAuthorization: Bearer <run token>(mcp/runTools.ts): stateless streamable HTTP like/mcp, but each request gets a server with only its grant's tools. A missing, unknown, revoked or expired token gets 401 without the token in the answer; the board's own API token is neither needed nor accepted. The localhost guard applies. - The PR review set.
pr_overview,pr_files,pr_diff(path?, page?)andpr_comments(page?). None takes a target: each reads the grant's PR, so arguments naming another one are dropped, and a path the PR doesn't change is refused. The diff comes in pages of at most 400 lines and 20,000 characters (PAGE_LIMITS, small enough that Codex shows a result whole), by file or for the whole PR in order; a file split across pages repeats its header with(continued), each result names its page, the count and the next call, and only a line longer than half a page is cut, with a marker. The file list is read once per run (RunGrant.cache) however many pages follow. Results mark the PR's own text as untrusted. - The other-people's-PR set (
repoPrReview): the same four, pluspr_threads(page?)(every review thread, resolved or not, each comment with its id and author, Autopilot's own threads marked, read throughGitHost.readRepoPr) andrepo_issue(number)(one issue of the PR's own repository: the issues it closes and the open ones that mention it). Neither reads another repository. - Orchestrate's set (
orchestrate): onlystart_task_session(task, note), the one run tool that writes. It writes nothing but a request on the board (Task sessions), for a task in the grant's project, under the actorautopilotwith the run's id; the board decides whether and when a session runs, under the user's switches and limits (ADR 0018). It reads no git host. - What they read through. A
GitHost(integrations/gitHost.ts):getPr,listFiles(with each file's patch),getDiff(path, page),getComments(conversation comments, review bodies and inline comments with their ids, oldest first) andgetIssue(GitHostReads, found by the run's target host through theGitHostsregistry). GitHub's (integrations/githubReads.ts) reads REST (GithubApi.rest) with theghtoken, 100 a page up to 30 pages; a file GitHub serves no patch for (binary, too large) says so. - Which providers. The
runToolscapability: Claude Code and Codex. A run withrunToolsadds therunToolsneed, so the resolver never picks the Copilot CLI for it, and it runs headless only.
Codex and Copilot can't be given Claude Code's deny rules, so git refuses the pushes itself. Every headless worktree
(createWorktree({ pushGuard: true }), autopilot/pushGuard.ts) gets a pre-push that refuses a delete, a push to
refs/heads/<default branch>, and a push whose remote commit isn't an ancestor of the local one (a force-push; a
remote commit the worktree hasn't fetched is refused too, as it can't be told apart). It is a guard rail, not a
sandbox: git push --no-verify skips it, and Codex has nothing that refuses gh pr merge; only the prompt says not
to. For a repository that matters, turn on branch protection for its default branch on the git host as well (no
force-push, no deletion, changes through pull requests), which nothing on the agent's machine can get around.
Where the guard lives. installPushGuard writes two copies inside the worktree's git dir, so git worktree remove takes them along: <git dir>/<brand>-guard/pre-push for the config guard, and <git dir>/autopilot-hooks/
for the folder guard (its pre-push, and for every other hook one that runs the repository's own). If they can't be
written the worktree is removed and the run fails.
How the agent's git finds it. Only through the agent's environment: entries in GIT_CONFIG_PARAMETERS (how
git -c passes config on), so every git the agent starts uses the guard and no config file changes, not the
repository's (turning on extensions.worktreeConfig would break a bare repository's worktrees), not the user's. Git
run by the board itself, or by the user in that worktree, doesn't use it. The server's own GIT_CONFIG_PARAMETERS
isn't chained in: an agent doesn't inherit it (the agent's environment), so the guard's is
the only one it sees. GIT_CONFIG_COUNT/GIT_CONFIG_KEY_0 would be the documented way, but a Codex shell was only
seen keeping them in a read-only run, and a tool that drops variables with KEY in their name would break git
outright. At the start of each run, armPushGuard picks one of:
| Mode | Environment (GIT_CONFIG_PARAMETERS) |
Used when |
|---|---|---|
Config guard (configGuardEnv) |
core.hooksPath=<git dir>/autopilot-hooks (the folder guard, as a backstop), hook.<brand>guard.event=pre-push, hook.<brand>guard.command=<the guard, sh-quoted>, hook.<brand>guard.enabled=true, hook.pre-push.enabled=true |
git hook list pre-push, run in the worktree from the agent's PATH with the environment the agent gets (childEnvironment), lists <brand>guard |
Folder guard (folderGuardEnv) |
core.hooksPath=<git dir>/autopilot-hooks |
anything else: an older git without config-based hooks or git hook list, an error, a git that couldn't be run |
The probe runs every run, not once per machine, since the agent's git can change; it can only ever choose between the two guards, never none.
Why the config guard is preferred. A project's hook installer (lefthook, husky, pre-commit, simple-git-hooks, a
setup script; often run by pnpm install or the like through a prepare script) writes into the folder
git rev-parse --git-path hooks names. With the folder guard that is the guard's own folder, so an installer with a
pre-push replaces the guard for the rest of the run. The config guard lives outside that folder, so the installer
can't reach it: git runs it, then the hooks folder's pre-push, and it doesn't pass on to that itself. Command-line
config is read last, so a repository's hook.<brand>guard.enabled=false, hook.pre-push.enabled=false or an empty
hook.<brand>guard.event can't turn it off.
The backstop. The probe runs the server's git, but Codex and Copilot run commands through the user's shell,
which may find another git first: a macOS login shell puts /usr/bin (Apple's older git) ahead of Homebrew's, and
version managers (mise, asdf, a nix shell) put their own first. A git without config-based hooks ignores every
hook.* entry, so config mode sets core.hooksPath to the folder guard as well. Such a git runs the folder guard; a
newer one runs both, and the folder's pre-push passes on to the repository's own, which so runs once. A hook
installer the agent runs then writes into the folder guard, as in folder mode, while the config guard holds.
The folder guard. Its pre-push runs the guard and then the repository's own pre-push; every other hook just
runs the repository's own (where git would look: git rev-parse --git-path hooks before the guard, so a ~ in
core.hooksPath is expanded), so its lint and commit-message checks still apply. An installer the agent runs writes
its hooks into this folder, where they run in place of those shims. Its pre-push, if it has one, replaces the guard
until the check below puts the guard back; from then on the guard passes on to the repository's own pre-push, not
to the installer's.
Checking it. installPushGuard records the sha256 of both pre-push files. checkPushGuard compares them at
the start of the run (in armPushGuard) and again when the agent has finished, however it finished, and writes back
any that changed, went missing or became a symlink (removed, never written through). A guard folder that was deleted,
or swapped for a file or a symlink (a setup script may rm -rf the folder git names as the hooks folder, or link it to
the project's own hooks), is made again, with the folder guard's other hooks. A check that can't put the guard back
flags the run too, with a note that says so. Only the guard the run's mode relies on counts: in config mode an
installer writing over the folder's pre-push is routine (the config guard holds), so it is put back without a flag.
A replaced guard flags the run (needsAttention, raised by the runner through the
run's patches; finish keeps a flag raised while the run went on, whatever the action returns) and notes on the task:
"The project's hook installer replaced Autopilot's push guard during this run; restored. Check that the run didn't
push to the default branch or force-push." The check comes after the fact: with the folder guard, pushes between the
installer and the end of the run weren't guarded. One case goes unflagged: in config mode, an agent whose shell finds
an older git and runs an installer with a pre-push loses the backstop until the end-of-run check puts it back. The Needs attention message is the run's own summary or error; the
note says why it is flagged. There is no check when the board accepts a run's push or PR (there is no such point
yet). T3 Code threads get no guard.
The guard can be skipped (git push --no-verify, a git that runs no hooks), so after each headless task run that
can edit, on the board or on a machine, autopilot/pushCheck.ts reads what the clone itself recorded. A push updates
the clone's remote-tracking ref and logs it in that ref's reflog as update by push, whatever harness or flags made
it; worktrees share the clone's refs, so the record is in the user's checkout's .git. It works for every harness and
needs nothing from the agent.
- The window.
startPushCheckruns just before the agent starts: it notes the tips oforigin/<default branch>andorigin/<the branch the run pushes to>(the worktree'spushTo) and their reflogs.checkRunPushesruns when the agent has finished, however it finished (inrunOnDriver'sfinally, after the guard's check). The run's entries are those above the start's newest one, so a push a moment before the run, even in the same second, isn't counted; if that entry is gone (git expired old entries meanwhile), those since the second the run started. - What counts. Only
update by pushentries, judged against the worktree's own HEAD reflog (each worktree keeps one). A push to the default branch is the run's when the pushed commit builds on a commit the run made: a HEAD entry since the start that isn't a checkout, a reset, a fast-forward, the start or finish of a rebase (git pull --rebasetoo) or the worktree's creation, and isn't part of what the run started from; or on one of the commits the branch it started on had and the default branch didn't (a run on a PR's branch that pushes that branch to main). So a push the user made from the same clone isn't the run's, even once the run merges it in; a bare "is it reachable from HEAD" would flag exactly that. A push of the run's branch is flagged when what was there before (the previous entry, or the start's tip) isn't an ancestor of the new commit, a force-push, and the run's HEAD was on that commit at some point (areset --hardto main and a force-push counts). Fetches are ignored, so merging the default branch into the run's branch and pushing never flags. With no HEAD reflog, the worktree's HEAD now decides. - On a hit. The run is flagged (
needsAttention, throughflagRun, the same path a replaced guard takes) and the task gets a note naming each ref and its commits ("pushed to the default branch: origin/main 1a2b3c4 → 5d6e7f8"). Nothing is reverted and the task's Autopilot flag is left alone: the user decides. - Unknown, never clean.
core.logAllRefUpdatesset to false, a default branch the board can't tell, a ref with no reflog (turned off or expired), one git can't read, a ref that vanished (a deleted ref takes its reflog along), or a ref that moved with no entry saying how: the run's detail says "Autopilot couldn't check what this run pushed: …" and the server logs it. That doesn't flag the run, so a clone with logging off doesn't flag every run.
Not covered: pushes to another branch name or another remote, and T3 Code threads (no worktree of the board's).
Every agent, command, script and terminal the board or a runner starts gets childEnvironment(extra)
(integrations/childEnv.ts): the server's environment without its own variables (every brandEnv name: the API
token, a runner service's SERVICE and LAUNCHER, HOME, PORT, ROLE...) and without inherited git config
(GIT_CONFIG_PARAMETERS, GIT_CONFIG_COUNT/KEY_n/VALUE_n), then the run's own values on top, untouched: the
push guard, the run token, MCP_CONNECTION_NONBLOCKING, a command's task values. Names compare case-insensitively,
as Windows treats them. The board's own git (backups, a runner's checkouts) drops inherited git config the same way.
Agents reach the board through their MCP config, never these variables. Without it, a runner service's SERVICE=1
made an agent's own test suite see a self-updating install, and a parent run's push guard refused the pushes its
test fixtures make to temp repositories.
This repo's server tests are immune to both too: a vitest setup file (src/test/inheritedEnv.ts) removes the same
variables, the git fixtures (src/test/gitRepo.ts, gitEnv.ts) take git redirects out of what their git sees, and
the self-updater tests inject an empty environment. pnpm --filter @repo/server test:hostile-env runs the suite with
a runner service's variables and a refusing push guard exported and the setup file's cleanup off, to prove it.
Cleanup (autopilot/cleanup.ts) runs hourly with the pollers. It removes a finished headless run's worktree
once the task has a merged PR, or worktreeRetentionDays after the run finished. It uses git worktree remove
without --force, so a worktree with uncommitted changes is kept and logged once. The branch is deleted with
git branch -d, which keeps a branch that has unmerged commits, or with -D when it has no commits of its own (none
that aren't on a branch of origin: hasOwnCommits, deleteRunBranch), which -d would keep when the checkout is
behind. A run that was skipped, or was a second start (another real run of its automation on the task began before it and
was still going),
loses a worktree with no changes and no commits on the next sweep; every other run keeps its worktree until then, so
its session can still be resumed in it.
Every operation that runs a model has one model choice, ModelChoice (packages/contracts/src/modelProfiles.ts):
"inherit", a tier ({tier}), a custom model ({profile}), or a model typed for one provider
({provider, model, effort?}). The operations are the OPERATIONS registry (packages/contracts/src/operations.ts),
each with what it needs from the provider and a default that is a tier or inherit, never a provider's model:
Operation (OperationId) |
Default | Needs |
|---|---|---|
Task runs (taskRun), PR fix (prFix) |
inherit | edit |
New sessions, terminal and T3 (launch) |
inherit | nothing |
Reviewer subagent (reviewer) |
inherit | nothing (it is a line in the brief) |
Board reviewer (boardReviewer) |
standard | structured output, tool rules |
PR review (prReview) |
standard | structured output, untrusted lockdown, run tools |
Orchestrate (orchestrate) |
standard | untrusted lockdown, tool rules, run tools |
Improve automations (improve) |
deep | untrusted lockdown, tool rules |
Digest (digest) |
light | no tools |
Custom agents on a task (customTask) |
inherit | edit |
Custom agents without a task (customDetached) |
light | nothing |
Issue import (issueImport) |
light | structured output, tool rules |
Ask (ask) |
light | structured output, no tools |
Project checklists (projectChecklist) |
light | structured output, untrusted lockdown |
Which choice applies (resolveOperationChoice), most specific first; inherit defers to the next:
- The task's reviewer override, then the project's (
reviewModel; the two reviewer operations only). - The automation's Model field (kind
model, config keymodelChoice, default inherit) at its scope, then a custom agent action's ownmodel(RunnerRequest.modelChoice). - The board's setting for the operation (
AppSettings.operationModels[op]). Set to inherit on an operation on a task, it skips the default and takes the task's own model (step 5), so PR review or the board reviewer can follow the task. - The operation's default.
- When everything inherits, a task-scoped operation takes the task's own model (
resolveTaskModel): a custom model one of its labels picks (Settings → Agents → Models → Custom models, the first in the list when several claim a label), else its suggested tier, else the light tier. Anything else takes the light tier.
A choice naming a custom model that was since deleted is passed over with a note, and the next level decides.
Which provider runs it (resolveOperationModel, pure, so the web can show it too). Only providers the user added
and switched on (Settings → Agents → Providers) that can do what the operation needs (HEADLESS_CAPABILITIES, and what the run
asks on top: driverNeeds in integrations/headlessDrivers.ts) count:
- A typed model runs on its own provider, with its effort when that CLI takes it. If that provider isn't on, or can't do what the operation needs, the operation refuses.
- A tier or custom model runs on its preferred provider (
ModelTierSetting.provider, the Preferred radio on Settings → Agents → Models; it has no default) when that counts; otherwise on the first provider in the Providers order that counts and has a model for it, else on the first that counts, on the CLI's default model. A CLI model comes with its effort; when a tier has no CLI model for a provider, its T3 model stands in when T3 files it under that provider (t3InstanceHarness:claude…,codex…,copilot…/github…,antigravity…), with no effort. - A provider that meets the needs only with a warning counts for a typed model on it and as the preferred provider of a tier or custom model chosen for the operation, never as a fallback or through a default.
- No provider counts: the operation refuses with the reason ("Ask needs a provider that can return structured output and run with no tools; add one in Settings → Agents → Providers"). It never runs something else quietly. The refusal is the Ask error, the issue-import failure, the board review round's error and the Autopilot run's failure.
Every fallback (another provider, no model for it, a deleted custom model) goes in the run's detail, with a
Model: … line naming the model, what picked it and the provider. The run records what it ran on in
AutopilotRun.model (autopilot_runs.model_json: {provider, model, effort, source}). A T3 launch passes the
tier or custom model the run's operation resolved to on to launchTaskThread (modelChoice), whatever picked it, so
the board's model for new sessions (launch) never replaces it; there it is checked against T3's providers
(resolveSuggestion). A model typed for a CLI provider, or the light fallback, has no T3 model: the launch gets
defaultModel and T3's default runs. The run records {provider: "t3-code", model} with the T3 model it asked for
(null when T3 couldn't use it, or there was none).
041_operation_models moved what was saved before into this shape: see ADR 0012.
One file under apps/server/src/autopilot/automations/, added to AUTOMATIONS in its index.ts, wrapped in
defineAutomation:
key: stored in settings and runs, so never renamed. Start planned tasks usesAUTOPILOT_START_PLANNED.needsAgent: whether the action starts an agent, and so counts against the caps.backgroundmarks a slow action that isn't an agent run (a digest waiting on its summary): the engine doesn't wait for it before the next candidate. Agent actions always go on in the background.epicScope(optional, default true): false when no candidate is ever a task in an epic, so an epic can't switch it.group: the heading Settings → Autopilot lists it under (ship,prsorupkeep; unset isyours, as for a custom automation).schema,fields,defaults: the config, parsed with zod over the defaults;fieldsdescribe the form the UI renders (boolean, number, text, time, select, skill; a skill field'sbuiltinLabelrenames its built-in entry, and a text field'smultilinemakes it a text area). A field'stierisessentialfor what most people set, shown with the automation; anything else (and unset) sits under its closed Advanced section. Runner, model, budget, timeout and T3 access are always advanced, and the detail pane shows them as two lines rather than a row each, the same for every automation (see Advanced overrides). A field'shelpis one short line andinfothe rest, behind an info button by its label;inRowOfdraws a field's control in another field's row (Fix PRs' threshold beside Autopilot's review) instead of a row of its own. Add the automation's sentence toautomationSentencetoo.check(ctx): reads the board and returns candidates, only forctx.projects(and the board whenctx.boardis set). It must be cheap: it runs every pass.act(candidate, ctx): does the work, withctx.actoras the actor of any change, and returns the outcome. Agent work goes throughctx.runner.start(see Runners);ctx.updaterecords runner details while it runs. ReturnneedsAttention: truefor a failure the user should see.
An automation must never close or delete tasks, force-push or push to the default branch. Its merges are Merge ready
PRs': into an epic's branch through ctx.gitHosts.mergeIntoEpicBranch, and into the default branch only through
ctx.gitHosts.mergeAutoMergeTask, which is merge_task_pr's own mergeTaskPr (the auto-merge flag and the gate are
checked there). No agent an automation starts merges: Orchestrate is denied merge_task_pr.
How Autopilot looks on the board (the lane pill, the epic button, the header pause button, the card badge and the
task panel's Autopilot section) is in board-layout.md. The settings are in
components/autopilot/:
Settings → Autopilot is three tabs (AutopilotTabs in AutopilotPage.tsx), each a sidebar entry:
- Automations (
/settings/autopilot, sectionautopilot.automations,AutopilotAutomationsTab):- The status strip: Running, Paused or Nothing is on; today's agent runs and spend (
overview.today,todaySummary) and the limits in one line (limitsSummary, both inpackages/contracts/src/autopilotSentence.ts); Pause all (autopilot.automations.pause-all) and a link to Limits & safety. - Needs you (
autopilot.automations.needs-you, hidden when empty), fromoverview.needsYou(AutopilotNeed, built by the service'soverview()): failed runs whose flag still stands on their task (one per task, the latest; Retry whencanRetryRun, Dismiss), other people's PRs Review PRs found clean that only the user can approve (kindpr_approval, oldest first, Open PR), drafts agents wrote (Review opens the import page, Dismiss), and automations that can't run as set up, theirblockedorneeds(Fix picks the built-in, or opens a custom one's editor). - The list and detail (
AutomationsSplit), the Providers page'sSplitCard. Every automation is listed once, under itsgroupheading (AUTOMATION_GROUPS: Ship work, Pull requests, Upkeep, then Yours for custom automations, which have no group of their own). A row has an icon, the name with the row's full width (no marker beside it: the switch says On or Off), a subline (rowSubline, from each project's scope andoverview.lastRuns), and its board switch (on saves the moderestoreModegives); that switch, and the detail header's Switch on (useBoardMode), turn it on as Everywhere, so the rows Only in… left go too and a later off is off everywhere (while it is already on or in Preview, only the board's own row changes). The subline says where it is on and how its last run went ("every project · ✓ 2m"), led by what the switch can't show, as a coloured word: Paused (amber) "in storefront", Preview (amber), Last run failed (red) "· 3m ago". A project's own setting beats the board's, so with the board off and some projects set On it does run there: the switch is then mixed (switchState, a centred thumb on a tinted track) and the subline reads "On in 5 projects". Switching off a mixed automation, or one whose board is on while projects or epics set their own On (whereOwnOn), asks first (SwitchOffDialog): Off everywhere (whereOffEverywhere: the board and every own On or Preview back to Inherit; rows set Off stay) or, when the board is on, Board only, which leaves those projects running; a plain one saves the board'sinherit. An automation off on the board and in every project is dimmed, as a switched-off provider is; its switch stays. + Add automation opens the Add gallery, and Ask an agent beside it is the hand-off.?automation=<key>picks a row; with none, the first is shown. - The detail: a header with the status line (
statusLine, "Preview · …" in Preview, "On in 5 projects · Off for the board" when mixed, agreeing with the list switch) and Switch on/off (Switch off when mixed), plus Export and Delete for a custom automation; in Preview, a notice with how often it would have run this week (previewHint), See them (its run history) and Turn on; What it does, one sentence read from its effective config (automationSentence; a custom automation's from its trigger and action) with All runs, and the Mode · for the board row, the board's Off · Preview · On, saying what the mode does (modeDescription; with a check script, that it still runs for real; when mixed, "Off for the board. On in 5 projects, which set their own." (a project only in Preview is named as Preview) with a Turn off everywhere link); Where it runs (WhereItRuns), the sharedProjectTable: a Stacked header row, All projects, over one row per project. All projects is the board's scope and each project row an override, written only where it differs from the board (a dot marks one; when the table is collapsed, "N differ" counts them). The rows are the project's effective state. The header shows what they add up to, so on, off or the middle position (columnState, the list's tint): a click on on or middle switches the column off (whereOffEverywhere, which also clears epics set On), a click on off turns it on for every project (whereOnEverywhere, in the moderestoreModegives), and when that would drop switches a person set it asks first (headerLoss,HeaderClearDialog). "New projects: on." under the table says what the stored board value gives, which a mixed header can't. Epics are not in the table: they stay in the board's epic popover, and an epic's own setting still beats its project's. PastPROJECT_CHIPS_MAX, 8 projects, a search box shows above the rows; about ten rows fit before they scroll, with the header outside the scroll area and both reserving the same scrollbar gutter so the columns stay in line. Clicking a project row expands it, with one labelled Preview switch (whereProjectPreview, nothing stored when the project matches the board); in Preview the row's switches turn amber and it shows a badge. An automation withneedsRepo(Start planned tasks, Review PRs, Fix PRs, Merge ready PRs) leaves out the General project, which the board names withgeneralProjectIdon its snapshot. Only the table leaves it out: no row's switch can reach it, and a header click clears General's own setting along with the rest. It readsuseAutopilotModesand the board's projects and unarchived epics (epics only for an automation withepicScope), writes throughuseApplyWhere(one PUT per write, shown at once and refetched on error), and a blocked automation can't be switched on or into Preview from it: anything that would is disabled and shows why; Settings, the fields whosetierisessential; and Advanced, closed, with every other field. Its heading says how many differ from their default ("Agent, Fix skill · 2 changed",advancedChangedCount). A field without a tier is advanced. Every row has one short description line, the rest behind an info button (InfoHover), as docs/reference/style.md asks. A custom automation's trigger and action are edited in its editor (Edit,/settings/autopilot/custom/<id>). - Quick setup as the empty state: while nothing is on at any scope (
isOffEverywherefor every row), the tab shows Quick setup above Needs you. - At phone width the card shows one side at a time: the list, then the detail with an All automations link back.
- The status strip: Running, Paused or Nothing is on; today's agent runs and spend (
Every automation's Advanced section uses one pattern (ModelLine, AgentDefaultsLine and AutomationField in
AutomationsSplit.tsx and AutomationRows.tsx, with the helpers in automationList.logic.ts):
- Closed: one short line on where the value comes from, a "Now: …" status and Override on the right. The model comes from Agents → Operations; runner, budget, timeout and T3 access from Limits & safety's agent defaults.
- A field's reset (
SettingResetButton, ↶) shows by its label only while the value differs from its default (fieldChanged; the default isfieldDefault: the board's agent default for those four keys, Inherit for the model, else the automation's own), and resets that field alone. Its tooltip names the default ("Reset to $5",fieldValueText). Setting the default back by hand saves no key, so the ↶ hides and it follows the default again. Resetting one keeps the group open. - The group ("Runner, budget, timeout and T3 access") says "N set here, the rest from Limits & safety" while overriding, and its control becomes ↶ Reset, which clears all four and closes it: also the way out when nothing changed. Its field rows are tinted rather than indented, since an indent would push a row in the narrow detail pane under its container breakpoint and stack its control.
- The model is one row, so its ↶ shows the whole time it is overridden; that is its way back to the one-line row.
- Controls follow docs/reference/style.md: one right edge, numbers in
UnitInput, selects atSETTINGS_TEXT_WIDTH, the model picker atSETTINGS_PICKER_WIDTH.
The Merge ready PRs detail (MergeTargets.tsx) follows the same rule: what an integration branch is sits behind the
Merges into heading's info button (DetailSection's info), each target is one line with one fact from the board
(epicsStatus, flaggedStatus), and Ready means is one line with the full definition behind its info button.
AddAutomationDialog (components/autopilot/), opened by + Add automation, is one place to start anything:
- Quick setup, a row with Choose… that opens the card inside the dialog.
- Quickest: ask your agent, with the Ask an agent menu.
- Recipes (
AUTOMATION_RECIPES,automationExamples.ts): ready-made custom automations as bundles. A card opens the import page with?recipe=<id>, where the bundle is read like a shared file and saves in Preview. They are plain custom automations; nothing marks one as a recipe afterwards. A recurring-task rule is not a recipe: it needs a project and a template. - Import a file (the import page) and Start from scratch (the editor,
/settings/autopilot/custom/new).
Built-ins that are switched off stay in the main list, dimmed, so the gallery doesn't repeat them.
QUICK_SETUP_PRESETS (packages/contracts/src/quickSetup.ts) names three one-off presets: Notify (Digest, Remind
me about stuck tasks, Unblock dependents, Auto-archive Done), Assist (Review PRs, Fix PRs, Digest, stuck-task
reminders, Auto-archive) and Hands-off (Start planned tasks, Orchestrate, Review PRs, Fix PRs, Merge ready PRs,
stuck-task reminders, Auto-archive). Quick setup writes only each automation's mode: Merge ready PRs' Into main setting, like every other config, is left as it is.
quickSetupChanges(level, state) is pure and drives both the list the card shows and the writes it makes
(quickSetupWrites): each preset automation that is off or inherits at the board scope is switched on there; one
already On or in Preview is listed as "already on" and left alone; one with blocked is listed and skipped. A project
that switches one Off for itself is named in the row ("Stays off in …"), since the board write doesn't override it.
Automations that start an agent or act on GitHub start in Preview while "Start agent automations in Preview"
(on by default) is on; the rest start On.
Apply (useApplyQuickSetup) sends the writes one after another through the board scope's PUT, since the server has
no batch; a refused write is reported in one toast and doesn't stop the others. Nothing stores the level: the writes
are ordinary board switches, and the next Quick setup reads what is on then.
There is no chat box. AskAgentMenu (handoff/HandoffActions.tsx) hands a prompt to the user's own agent as New T3
Code thread… (one item per project that can start one, canStartProjectT3Thread; the dialog's prompt launch kind
shows the prompt for editing first and starts it in a project thread linked to nothing) or Copy prompt. It sits
beside Add automation (createAutomationPrompt), as Ask an agent to change this in each automation's detail
header (changeAutomationPrompt) and as Ask an agent to fix on a failed run in Needs you and the Runs tab
(fixRunPrompt), all in packages/contracts/src/automationPrompts.ts.
The prompts name the aboard-automations skill and draft_automation. A custom automation's prompt carries its id and
definition (as a shared-file bundle, cut at 6,000 characters), and the agent drafts a replacement for the user to
review; a built-in's tells the agent it can't change settings and should say which to change. A fix prompt carries the
run's summary, error, exit code and the last lines of its output, and retry_autopilot_run when the run was on a
task. They all say a draft isn't active until the user imports it. A session in a CLI harness isn't offered: those
launchers are task- and planning-specific.
- Runs (
/settings/autopilot/runs/$automation): the run history of every automation (all) or one. - Limits & safety (
/settings/autopilot/limits,AutopilotLimits): spending and timing (concurrency, the daily caps, quiet hours), the defaults for agent runs (agent defaults, with a link to Agents → Operations for the models), Advanced (autopilot.limits.advanced: Preview everything,engine.dryRun, and worktree retention), and the board's variables. A number that is out of range is put back with a toast; an empty cap means no cap.
Old links still work: redirectSettingsTarget sends autopilot.engine.* to the limits rows or, for
autopilot.engine.automation-<key> and autopilot.engine.orchestrate, to autopilot.automations.<key> (which picks
it), and autopilot.custom to the list (its variables to Limits & safety). The old Dry run and Safety anchors go to
Preview everything and Advanced. The router redirects such a hash to the
tab's path. Orchestrate's Countdown on lanes (showAutopilotTimer, a per-browser display preference) is
Autopilot countdown on lanes in Settings → Appearance.
The fields are a form generated from the automation's fields: a switch, number, text, 24-hour time or select per
field, and for skill the review skill picker (built-in skill plus skills found on disk; a skill is stored as a
ReviewSkillRef, and an unset one is the built-in skill, labelled with the field's builtinLabel when it has one,
such as the digest's own skill). The board's fields are edited in the detail, as above; where an automation runs in
each project is its Where it runs table. A project has no form for its own config: a value already stored for a
project still applies over the board's, so the detail lists such projects under Projects' own settings
(ProjectsOwnSettings), each with Clear own settings (it saves the scope's config as empty, which the
server turns into removing the row when the mode is Inherit); nothing in the UI sets one. The lane and epic popovers are the widget's compact form (WhereRow, see
board-layout.md). Config set at a scope is sent whole (the server replaces
it), so editing one key sends the scope's other keys with it; the reset button beside a field's title (shown only
while the key is set at that scope) removes the key so it inherits.
- Saves reach the server one at a time per scope, each built from the latest saved config when it runs, so two quick
edits can't undo each other. The server's reply goes straight into the query cache, and
autopilot.changed(which every settings change also publishes) refetches the scopes, so another window's edit shows up too. The forms wait for the real entries to load before they can be edited.
- The review watchdog stays separate. It is part of local review, on whenever local review is, and must not wait for an Autopilot switch or count against Autopilot's caps. See the ADR.
- Attention is derived, not cleared. Comparing a flagged run with the task's status change and later runs needs no hook in the task service, and can't be left stale by a move made any other way.
- Held candidates aren't recorded. A queue of held runs would need its own ordering and expiry; checking again next pass gives the same result with nothing stored.
- Engine settings are one key. They are always read and validated together; pause is its own key because it is a switch, not configuration.
- The board picks the headless session id (
--session-id) rather than reading it from the result. That way the session is linked while the agent works, and survives a timeout that leaves no result. - Headless worktrees live under the data dir, never in the project's folder. They can't show up in the
user's checkout or its
git status, and cleanup can't touch anything Autopilot didn't make. - The digest isn't an agent automation. Counting a plain daily list as an agent run would use up the run cap and hold it behind a busy runner, so the summarised mode applies quiet hours, Pause all and the spend cap itself.
- The digest has no agent tools. The summary is written from the plain digest alone: it has nothing to look up, and an agent that could call board tools could be steered by a task title imported from an issue.
- Self-made events are ignored by a depth counter around the engine's synchronous writes, including the
synchronous part of an action. Changes an action makes after an
awaitdo start a pass, which dedupe keys make harmless.
| Option | Why not chosen |
|---|---|
| Headless runs in the project's own checkout | Would switch the user's branch and mix the agent's edits with theirs |
--permission-mode bypassPermissions for headless runs |
Allows tools nobody listed; acceptEdits with an explicit list says what the agent may do |
| A long-running agent watching the board | Costs tokens while nothing happens, and its choices can't be tested or reasoned about |
Clearing needs_attention on task moves |
Needs a hook in every path that changes status; deriving it can't go stale |
| Recording held candidates as queued runs | Needs queue ordering and expiry; re-checking each pass is simpler |
| Filling task values into a custom shell command | A title with quotes or ; would change what runs; environment variables can't |
| Acting on everything that matches when a custom automation is switched on | A "moves into Review" automation would fire for every card already there |
| File | What it does |
|---|---|
packages/contracts/src/autopilot.ts |
Modes, scopes, runs, engine settings, field descriptors, resolveAutopilot, inQuietHours |
apps/server/src/db/migrations/010_autopilot.sql |
autopilot_settings, autopilot_runs, the scope clean-up triggers |
apps/server/src/db/migrations/013_task_autopilot.sql |
tasks.autopilot, the per-task flag |
apps/server/src/db/migrations/016_autopilot_recurring.sql |
autopilot_recurring, the recurring-task rules |
apps/server/src/db/migrations/021_autopilot_custom.sql |
autopilot_custom, and the runs' detail and exit_code |
apps/server/src/db/migrations/020_autopilot_digests.sql |
autopilot_digests, the digests |
apps/server/src/mcp/format.ts |
autopilotFlagHint, the planning-time nudge to flag a task |
apps/server/src/db/repos/autopilotSettings.ts, autopilotRuns.ts |
Their SQL, and attentionFor |
apps/server/src/db/migrations/057_machine_autopilot.sql |
A run's machine, a machine's own limits, a scheduled automation's machine pin |
apps/server/src/autopilot/placement.ts |
Which engine (the board's or a connected machine's) acts on a candidate |
apps/web/src/components/autopilot/machines.logic.ts, RunsOnSection.tsx |
Limits for a machine, Pause all not yet delivered, Runs on |
apps/server/src/services/autopilot.ts |
Settings, pause, scopes, the run lifecycle and restart recovery |
apps/server/src/autopilot/types.ts |
Automation, Candidate, Runner, RunnerRequest |
apps/server/src/autopilot/runner.ts |
The T3, nudge and headless runners and the runner choice |
apps/server/src/autopilot/runnerOptions.ts |
The runner options every agent automation shares |
apps/server/src/autopilot/worktrees.ts, cleanup.ts |
Headless runs' worktrees and their removal |
apps/server/src/autopilot/pushGuard.ts |
The worktree's push guard: the config and folder guards, the probe that picks one, the hash check |
apps/server/src/autopilot/pushCheck.ts |
The push check after a run: the clone's reflog, pushes to the default branch and rewrites of the run's branch |
apps/server/src/autopilot/repoGate.ts |
One git fetch per repository at a time: Autopilot's T3 launches and headless worktrees |
apps/server/src/integrations/headlessAgent.ts |
claude -p arguments for agent runs, the push deny rules, the outcome, the driver interface |
apps/server/src/integrations/headlessDrivers.ts |
The Codex, Copilot CLI and Antigravity drivers, capabilities and the fallback to Claude Code |
apps/server/src/mcp/runTokens.ts, mcp/runTools.ts |
Run tools: the tokens, /mcp/run and the tool sets |
apps/server/src/integrations/gitHost.ts, githubReads.ts |
GitHost, the paging helpers, and GitHub's reads |
apps/server/src/integrations/gitHosts.ts |
The GitHosts registry and gitHostActions, what ctx.gitHosts is |
apps/server/src/autopilot/engine.ts |
The pass, the event and tick wiring |
apps/server/src/autopilot/limits.ts |
agentHold: quiet hours, concurrency and the daily caps, for the engine and Orchestrate's state |
apps/server/src/autopilot/automations/index.ts |
The catalogue |
apps/server/src/db/migrations/022_autopilot_run_output.sql |
autopilot_runs.output_json, an action's structured result |
apps/server/src/autopilot/automations/autoArchive.ts |
Auto-archive Done |
apps/server/src/autopilot/automations/startPlanned.ts |
Start planned tasks |
apps/server/src/autopilot/automations/orchestrate.ts |
Orchestrate: the schedule, Run now, its state, the tools it gets and orchestratePrompt |
apps/server/src/autopilot/automations/taskSessions.ts |
Task sessions: the requests' candidates, the session's prompt and workspace |
apps/server/src/services/taskSessions.ts, db/repos/taskSessionRequests.ts |
start_task_session's requests and sessionRefusal |
apps/server/src/mcp/tools/autopilot.ts |
retry_autopilot_run, draft_automation |
apps/server/src/autopilot/reminders.ts |
The quiet-task, waiting-thread and unblocked reminders (sendReminders) |
apps/server/src/autopilot/automations/reviewPrs.ts |
Review PRs: the trigger, the prompt, the verdict and the hand-off, carried verdicts and resolution reviews |
apps/server/src/autopilot/headMove.ts |
classifyHeadMove: whether a PR's head moved only by merging its base in, and whether git made those merges on its own |
apps/server/src/autopilot/automations/repoPrs.ts, repoPrAssess.ts |
Review PRs' other people's PRs: settings, the poll, which PRs and their mode and gate, the prompt, posting and hand-offs |
apps/server/src/integrations/githubRepoPrs.ts |
GitHub's reads and writes for other people's PRs: the open PRs, one PR in full, unchangedSince, comments |
packages/contracts/src/repoPrReview.ts |
The other-people's-PR verdict, run output, markers, /autopilot commands and sensitive paths |
apps/server/src/autopilot/automations/fixPrs.ts |
Fix PRs: the triggers, batching, the limits and the fix prompt |
apps/server/src/autopilot/automations/mergeEpicPrs.ts |
Merge ready PRs: Into epic branches (the merge, the epic's draft PR and epicPrBody) and the dispatch to Into main |
apps/server/src/autopilot/automations/mergeIntoMain.ts |
Merge ready PRs' Into main: candidates one per repository, the hold notice and the merge through mergeAutoMergeTask |
apps/server/src/autopilot/epicBranch.ts |
ensureEpicBranch: making an epic's integration branch on origin |
packages/contracts/src/runThreads.ts |
t3RunWorking: whether a T3 thread a run handed work to is still working on it, for Start planned, Fix PRs and the PR row |
apps/server/src/autopilot/threads.ts |
threadSeen: whether the live poll has seen a thread lately |
packages/contracts/src/prReview.ts |
The review verdict, PrReviewRunOutput, currentPrReview, the threshold rules, the header |
apps/server/src/integrations/githubHost.ts |
GitHub's postReview (the comment review, with its head check and inline fallback), ensurePr, setPrBody, review threads and agentHints (the fix prompt's gh commands) |
apps/server/src/integrations/prMerge.ts |
mergeIntoEpicBranch, checkAutopilotMergeTarget, epicMergeMethods |
apps/server/src/autopilot/automations/recurring.ts, services/recurring.ts |
Recurring tasks: the automation, and the rules' service |
packages/contracts/src/recurring.ts |
Rule and schedule schemas, nextDue, latestDue |
packages/contracts/src/customAutomations.ts |
Custom triggers, filters and actions, placeholders, the shell environment, the definition check |
apps/server/src/autopilot/custom.ts, services/customAutomations.ts |
Custom automations as catalogue entries, and their service |
apps/server/src/integrations/shellCommand.ts, scriptRunner.ts, captureProcess.ts |
Running a shell or script action, and the spawn they share |
packages/contracts/src/quickSetup.ts |
Quick setup's presets and quickSetupChanges |
packages/contracts/src/automationPrompts.ts |
The Ask an agent prompts: create, change this, fix this run |
apps/web/src/components/autopilot/AddAutomationDialog.tsx, QuickSetup.tsx, AskAgentButtons.tsx |
The Add gallery, the Quick setup card, and the change and fix menus |
packages/contracts/src/automationVariables.ts |
Variables: the schema and effectiveVariables |
packages/contracts/src/automationSdk.ts |
What a script can read, and the snippets the editor's panel shows |
apps/server/src/integrations/gitRemote.ts |
remoteRepo, repoWebUrl and the cached repository URL per folder |
apps/server/src/db/migrations/036_project_variables.sql |
projects.variables_json, a project's variable overrides |
apps/web/src/components/autopilot/VariablesEditor.tsx, VariablesSection.tsx, variables.logic.ts, SdkStatusBar.tsx, InsertChips.tsx |
The variables editors, the "Variables it reads" list, the insert chips and the status line |
apps/web/src/components/autopilot/CustomAutomation*.tsx |
The custom automation editor and import page |
apps/web/src/components/autopilot/ScriptField.tsx, ScriptEditor*.tsx, scripts.logic.ts |
The script editor (CodeMirror, lazy), language notes, starters, the test run panel |
apps/server/src/services/testScript.ts |
Running a draft script once for the editor's test run |
packages/contracts/src/automationBundle.ts, automationExamples.ts |
The shareable file (version 2 with a script), and the shipped example |
apps/server/src/autopilot/reviewRepoPrs.test.ts |
The example's bundle, and its script run against a fake gh |
packages/contracts/src/automationDrafts.ts, apps/server/src/db/repos/autopilotDrafts.ts |
Agents' drafts: the input, the check, the caps, and their table (migration 037) |
apps/server/src/autopilot/automations/digest.ts, autopilot/digest.ts |
Digest of what changed: the automation, making a digest (plain, summarised, the fallback) and "digest now" |
apps/server/src/autopilot/digestBuilder.ts, digestConfig.ts |
The plain digest's Markdown, and the automation's config |
apps/server/src/services/digests.ts, db/repos/autopilotDigests.ts |
Collecting the period's activity, storing digests, the inbox notification |
packages/contracts/src/digest.ts |
Digest, dueDigestSlot |
apps/web/src/components/recurring/ |
The rule rows in Settings → Autopilot (with their project picker), editor and examples |
apps/server/src/http/routes/autopilot.ts |
The REST routes |
packages/contracts/src/autopilotRunHistory.ts |
The run history's filter, query and page, and the delete's input, result and kept reasons |
apps/server/src/db/migrations/034_autopilot_runs_automation_index.sql |
The index the history page's filter and paging read |
apps/web/src/components/autopilot/RunHistory.tsx, RunHistoryRow.tsx, runHistory.logic.ts |
The run history page, a run's row, and the URL-to-filter logic |
apps/web/src/components/autopilot/AutopilotPage.tsx |
Settings → Autopilot's tabs, the status strip and Needs you |
apps/web/src/components/autopilot/AutomationsSplit.tsx, automationList.logic.ts |
The list and detail: groups, rows, dimming, the Advanced section, its override pattern and change count |
apps/web/src/components/autopilot/AutopilotSettingsSection.tsx |
The Limits & safety tab, and a project's read-only Autopilot list |
packages/contracts/src/autopilotSentence.ts |
automationSentence, limitsSummary, todaySummary |
apps/web/src/state/autopilotRunHistory.ts |
The history's infinite query, the delete preview and the delete |
apps/web/src/components/autopilot/ |
The pill, epic button, their shared popover (ScopePopover), badge, panel section and settings (autopilot.logic.ts holds the tested logic) |