Repository navigation
refactor(runtime): add the steer interface, off by default #6959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
aea0299
34c7cbb
cf6ad88
14e9f82
443d614
adc2dc6
841eeca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| --- | ||
| title: "113. Steer the running agent instead of only preserving it" | ||
| status: Accepted | ||
| relates_to: | ||
| - security-threat-model | ||
| - operational-observability | ||
| - flapping-convergence | ||
|
waynesun09 marked this conversation as resolved.
Resolved
|
||
| topics: | ||
| - concurrency | ||
| - dispatch | ||
| - runtime | ||
| --- | ||
|
waynesun09 marked this conversation as resolved.
Resolved
|
||
|
|
||
| # 113. Steer the running agent instead of only preserving it | ||
|
|
||
| Date: 2026-09-18 | ||
|
|
||
| ## Status | ||
|
|
||
| Accepted | ||
|
|
||
| ## Context | ||
|
|
||
| [ADR 0106](0106-serialize-agent-runs-and-coalesce-subsequent-events.md) stops the cancellation: the | ||
| stage job already working on a work item finishes, and one run waits behind it as the pending run, | ||
| working from the item's current state. This ADR addresses what preserving alone leaves standing. | ||
|
|
||
| Three costs survive it. The run in flight finishes on the state it started with and posts output | ||
| that is already stale, such as a review of a commit that no longer exists | ||
| ([#1207](https://github.com/fullsend-ai/fullsend/issues/1207)). The run queued behind it then redoes | ||
| the full job over the same diff ([#1014](https://github.com/fullsend-ai/fullsend/issues/1014), | ||
| [#6573](https://github.com/fullsend-ai/fullsend/issues/6573)). And a person on the work item cannot | ||
| add direction to a run already working: their only lever is a `/fs-` comment, which starts another | ||
| run rather than reaching this one. | ||
|
|
||
| ## Options | ||
|
|
||
| ### Preserve only | ||
|
|
||
| ADR 0106 unchanged. Cheapest, and already correct for harnesses that reconcile durable entity state | ||
| on their next run. It leaves all three costs in place for event-only harnesses, and leaves a person | ||
| with no way to reach a run in flight. | ||
|
|
||
| ### An end-of-run re-check | ||
|
|
||
| The run finishes, then checks whether the item moved and re-stages itself if it did. No new | ||
| transport and no runtime capability — it is the shape of the fleet-agent backstop and of gh-aw's | ||
| steer issue. But it cannot change what the agent is doing while it is doing it: the stale turn is | ||
| still paid for, and the correction costs a second full run. | ||
|
|
||
| ### Steer the run in flight | ||
|
|
||
| Deliver the update into the running session as a message, so the agent's next turn works from the | ||
| item's current state. It buys the absorbed turn and the human's mid-run direction, at the price of a | ||
| runtime capability, a way to learn the item moved, and a way to tell the queued run the work is | ||
| already done. | ||
|
|
||
| ## Decision | ||
|
|
||
| Steer the run in flight. While the run in flight holds the work item it absorbs updates to that item | ||
| itself, and the queued follow-up run becomes the **notification** rather than the worker. | ||
|
|
||
| This revisits one clause of ADR 0106, which decided that `fullsend run` does not poll for later | ||
| events or invoke another run itself. A steered run polls, and only polls: it still invokes nothing, | ||
| every follow-up event still creates its own pending run, and a steer never extends the run's timeout | ||
| window — the rest of that clause stands. How a run in flight learns the item moved is the | ||
| queue-monitoring decision that follows this one. | ||
|
|
||
| Steering requires preserving, not the reverse: every failure path — no delivery ack, no time left, | ||
| cap reached, runtime cannot steer, provenance refused — is ADR 0106 on its own, and the queued run | ||
| does the work exactly as it does today. | ||
|
|
||
| A steer is **content, never capability**: it cannot widen tools, role, model, scope or the L7 network | ||
| policy, and runtimes render it as a user message. The runner authorizes nothing itself; who may steer | ||
| a run, and on whose authority, is the provenance decision that follows — the question ADR 0106 | ||
| explicitly deferred to an ADR of its own. | ||
|
|
||
| This ADR decides only that steering happens. Five decisions follow it, each recorded separately: the | ||
| steer interface and its envelope contract; provenance and actor authority; how a run in flight learns | ||
| the item moved; the receipt that lets the queued run skip its work; and whether steering is on by | ||
| default. | ||
|
|
||
| ## Consequences | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand correctly, one of the consequences is that the new input doesn't pass through the pre-script. I believe this is important enough to be written in here. This could have behaviour and security considerations on agents so they should be explicitly declared so agent creators are aware of them.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, and added in c35c90d. ADR 0113 now has a Consequences bullet for this (in 4b8a665):
The
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| - A burst of events on one work item produces one agent run that absorbs them plus at most one short | ||
| follow-up, instead of a full re-run per event. | ||
| - Agents stop posting output computed from state the subject has already moved past. | ||
| - A run holds its sandbox until it settles, so a steered run occupies a VM longer and can cost as | ||
| much again per absorbed update. | ||
| - Absorbing an update saves nothing unless the queued run can be told the work is done, so the | ||
| receipt decision is load-bearing rather than an optimization. | ||
| - Steering is unavailable wherever the run in flight cannot learn that the item moved, so the | ||
| capability is per-platform rather than universal. | ||
| - An absorbed update never passes through the harness pre-script. The pre-script runs once, on the | ||
| host, for the event that dispatched the run; an update the run absorbs goes straight into the | ||
| sandbox. So no per-event gate a pre-script implements applies to an absorbed update: payload | ||
| validation, a state check such as merged or draft, a skip-list of authors, an iteration cap, a | ||
| size cap on an instruction. The runner applies its own gates instead: the `Route` job's | ||
| authorization of the event, the split of the update into one amendment and context, the | ||
| envelope's sanitizer and size bounds, the exclusion of fullsend's own output, and `max_steers`. | ||
| An agent creator whose gate must hold for every event keeps it in the dispatch arm, which runs | ||
| per event, enforces it in the agent from the envelope, or leaves steering off for that harness | ||
| (`steer.enabled: false`). The post-script is unaffected: it runs once, on the shipped output. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| --- | ||
| title: "117. The steer interface: a runtime capability fed through an in-sandbox mailbox" | ||
| status: Accepted | ||
| relates_to: | ||
| - agent-architecture | ||
| - security-threat-model | ||
| topics: | ||
| - runtime | ||
| - concurrency | ||
| --- | ||
|
|
||
| # 117. The steer interface: a runtime capability fed through an in-sandbox mailbox | ||
|
|
||
| Date: 2026-09-18 | ||
|
|
||
| ## Status | ||
|
|
||
| Accepted | ||
|
|
||
| ## Context | ||
|
|
||
| [ADR 0113](0113-steer-the-running-agent-on-work-item-updates.md) decides that a run in flight absorbs | ||
| updates to its work item. This ADR decides how an update reaches the agent, and what a runtime must | ||
| implement to be steerable. | ||
|
|
||
| The constraint is the sandbox. The runner reaches it only through `exec` and `upload`, and neither | ||
| gives it a handle on the stdin of a process already running inside, so it cannot write to the | ||
| agent's stdin from outside. The runtimes differ too: Claude Code and pi can take a message into a | ||
| live session, Codex exec cannot. | ||
|
|
||
| ## Options | ||
|
|
||
| ### Restart the session with the new input | ||
|
|
||
| Kill the agent and start it again with the update appended to the prompt. Works on every runtime and | ||
| needs no new channel, but throws away the turn in progress — the cost ADR 0113 exists to avoid. | ||
|
|
||
| ### `upload` the message as a file | ||
|
|
||
| The runner already uploads files into the sandbox, but an upload only lands a file: nothing tells the | ||
| agent it arrived, and a runtime reading a live input stream never notices it. | ||
|
|
||
| ### Write to the agent's stdin over `exec` | ||
|
|
||
| The direct route, and the one the live runtimes' input formats are designed for. An `exec` gets its | ||
| own stdin, not the stdin of the process already running, so there is no channel to write on. | ||
|
|
||
| ### A mailbox the agent's stdin is already tailing | ||
|
|
||
| Start the agent with stdin connected to an in-sandbox feeder — `tail -n +1 -f` over a mailbox path — | ||
| and steer by appending one line to that mailbox with `exec`. It needs only the two operations the | ||
| sandbox already gives the runner, and starting at the first line means the opening prompt is | ||
| delivered by the same channel as every later steer. | ||
|
|
||
| ## Decision | ||
|
|
||
| Steering is an optional runtime capability, `runtime.Steerer`, with `Steer` and `Settle`. | ||
| `RunParams.Steerable` asks a `Steerer` runtime to keep its session open; `Run` then returns only after | ||
| `Settle` and the agent's current turn. A runtime that does not implement `Steerer` ignores the field | ||
| and its command line is unchanged. | ||
|
|
||
| The transport is the mailbox. The live runtimes — Claude Code over stream-json input, pi over its rpc | ||
| steer — start with stdin connected to the in-sandbox feeder, and `Steer` appends one line over `exec`. | ||
| Codex exec has no live channel. The runner stops the sandbox, which ends the turn and keeps the disk | ||
| state, starts it again, and resumes the same session with the message as the next prompt. The | ||
| interface is therefore two methods rather than a single send. | ||
|
|
||
| Stop is the Codex interrupt because an exec's processes are not expected to exit with the caller | ||
| ([NVIDIA/OpenShell#3159](https://github.com/NVIDIA/OpenShell/issues/3159)), and `sandbox stop` is the | ||
| released way to end them. On OpenShell 0.1.2 a clean stop and start take about a second. The | ||
| sandbox can also come back broken: in about 2 of 35 steered runs it reported Ready and then entered | ||
| an Error phase it never leaves ([NVIDIA/OpenShell#3308](https://github.com/NVIDIA/OpenShell/issues/3308)). The runner re-reads the phase for 2 seconds after the | ||
| start and fails closed on that flip. The steer is not delivered, `Steer` returns | ||
| `ErrSteerSessionLost`, and the run fails, so the queued run redoes the work. | ||
|
|
||
| Both methods are called **with the runner's sandbox write lock held**. They write into the running | ||
| sandbox and would otherwise race the credential refreshers the runner already serializes through that | ||
| lock. The lock lives in `internal/cli`, so a runtime cannot take it itself; this is a caller | ||
| obligation documented on the interface. | ||
|
|
||
| Delivery is **acknowledged, not assumed**: a steer counts as delivered only when the runtime observes | ||
| the agent echo that specific message, matched by the message's own identity rather than by counting. | ||
|
|
||
| Three ceilings bound a steered run, all owned by the runner rather than the runtime: `steer.max_steers` | ||
| per **run** rather than per validation-loop iteration, a remaining-time floor below which the run | ||
| settles instead of starting a turn it cannot finish, and a budget of `min(agent timeout, forge token | ||
| life − margin)`. | ||
|
|
||
| The bytes the agent receives are a contract with the fleet agent definitions rather than an | ||
| implementation detail of one runtime, and are versioned separately in | ||
| [normative/steer-envelope/v1](../normative/steer-envelope/v1/README.md). The mechanics are in | ||
| [steering.md](../contributing/steering.md). | ||
|
|
||
| ## Consequences | ||
|
|
||
| - A runtime becomes steerable by implementing two methods, and the runner needs no per-runtime | ||
| branching beyond the capability check. | ||
| - The live runtimes need no new sandbox operation: `exec` and `upload` are the whole transport. The | ||
| Codex interrupt adds `sandbox stop` and `start`, and costs about 3 seconds per steer on | ||
| OpenShell 0.1.2, including the 2-second settle check. | ||
| - A Codex steer that hits the gateway race fails its run closed, and the queued run redoes the | ||
| work. | ||
| - On the live runtimes a steered run keeps one process, so the per-process guards run once for the | ||
| run; interrupt-and-resume re-runs them per steer. | ||
| - A resume reads a session store the agent controls, so steering widens the prompt-injection surface | ||
| — documented rather than signed, with tools still gated by | ||
| [ADR 0090](0090-runtime-neutral-sandbox-hooks-contract.md). | ||
| - Changing what the agent sees becomes a versioned change to the envelope contract rather than an | ||
| edit to a runtime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[medium] protected-path
This PR modifies AGENTS.md (a protected/governance path), adding the Steering row to the Topic-specific guidance index table. The PR links to tracking issue #6957 and the PR description explains the rationale (the row points at the new docs/contributing/steering.md, required by AGENTS.md's own indexing convention). Human approval is always required for protected-path changes regardless of context.
Suggested fix: A human reviewer must explicitly review and approve this AGENTS.md change before merge. No code change is required — this is a process/governance gate, not a defect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, and left open deliberately rather than resolved. The edit is one row in the topic-index table pointing at docs/contributing/steering.md, added because a previous review round raised the page as missing from the index; the rationale and the tracking issue are in the PR description. It changes no rule, gate or instruction. What this thread asks for is a human reviewer's approval, which is not something the change can assert for itself and not something I can satisfy by replying — so resolving it would make the gate look met when it is not. It stays open for the reviewer.