AutopilotService
Defined in: src/autopilot.ts:120
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AutopilotService(
deps):AutopilotService
Defined in: src/autopilot.ts:135
Parameters
Section titled “Parameters”Returns
Section titled “Returns”AutopilotService
Methods
Section titled “Methods”onBlock()
Section titled “onBlock()”onBlock(
id,block):Promise<void>
Defined in: src/autopilot.ts:256
session:block handler. Only steerable shapes are eligible; menu/stall surface as-is.
Parameters
Section titled “Parameters”string
BlockReason | null
Returns
Section titled “Returns”Promise<void>
onDone()
Section titled “onDone()”onDone(
id):Promise<void>
Defined in: src/autopilot.ts:263
session:status “done” handler — agent exited / idled. Read its tail and classify;
a finished verdict drives it to a PR (resuming the pane if needed).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<void>
onGit()
Section titled “onGit()”onGit(
id,git):void
Defined in: src/autopilot.ts:325
session:git handler. Two jobs, both keyed off the PR’s live state:
- PR-open transition (none/closed → open): hand off to the critic loop once (onPrOpen).
- Open PR with FAILING CI: the dead zone — the critic only reviews a green PR and pre-PR
autopilot has stood down (a PR exists), so nobody steers a red PR. Drive the task agent
to fix its own CI. Replaces the old
if (open) onPrOpenwiring in index.ts.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
onPrOpen()
Section titled “onPrOpen()”onPrOpen(
id):void
Defined in: src/autopilot.ts:308
The critic handoff: clear pause + complete + reset the step budget. Invoked once per PR-open by onGit (for a non-red PR) — the single place this transition is applied.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
onStatus()
Section titled “onStatus()”onStatus(
id,status):void
Defined in: src/autopilot.ts:292
session:status “running” handler. A paused→running or complete→running transition is the operator re-engaging the session: clear the hand-back and refresh the step budget. Running while neither paused nor complete is a no-op (autopilot’s OWN gate-steers resume the agent — those must not reset the cap). Known limitation: a manual operator steer while the loop is active-but-NOT-paused also produces “running” and is indistinguishable from autopilot’s own steer here, so it does NOT refresh the budget — a slight deviation from the design’s “reset on manual intervene”. The cap still resets on PR-open (onPrOpen) and on answering a pause, which covers the cases that matter; conflating the two would let the cap never bite.
Parameters
Section titled “Parameters”string
status
Section titled “status”string
Returns
Section titled “Returns”void
tick()
Section titled “tick()”tick():
Promise<void>
Defined in: src/autopilot.ts:431
Recurring re-engagement sweep (driven by a ~30s setInterval in index.ts). Iterates all sessions and re-engages the idle ones stuck on a red PR. A timer fires regardless of events, so it is the one trigger that reliably re-fires while an agent idles on an UNCHANGED red head — the case onGit/considerCi provably cannot reach. Only the idle filter lives here (status done/idle, i.e. NOT running/blocked — mirrors the active grouping at poller.ts:314); all eligibility/red/full-auto checks live inside reEngageCi.
Returns
Section titled “Returns”Promise<void>