Skip to content
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Detailed guidance lives in `docs/contributing/` and topic-specific guides under
| [Mintcore Architecture](docs/contributing/mintcore.md) | Changing `internal/mintcore/`, `cmd/mint-wasm/`, `cmd/mint/`, `internal/mint/`, or mint deploy provisioners (`internal/dispatch/gcf/`, `internal/dispatch/cf/`) — covers platform accessors, load-site construction, WASM-safe wiring, and deploy-time build-metadata stamping |
| [Go Code](docs/contributing/go-code.md) | Changing Go code under `cmd/` or `internal/` — covers mint sync, coverage, vet, e2e tests, concurrency testing, suite-timeout policy, WASM binary size constraints, credential redaction for external content, and preferring `go run` for the CLI |
| [Behaviour Testing](docs/guides/dev/behaviour-testing.md) | Modifying behaviour test repo provisioning, fork handling, or workflow dispatch — covers forge API constraints (`auto_init`, fork name derivation, Actions readiness, CI timeout budgeting) |
| [Steering](docs/contributing/steering.md) | Changing how a run in flight absorbs updates to its work item — covers the two concurrency switches, the `runtime.Steerer` contract and its sandbox-lock obligation, the mailbox transport, and the harness `steer:` block |

Copy link
Copy Markdown

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.

Copy link
Copy Markdown
Member Author

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.

Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
| [Workflow Contracts](docs/contributing/workflow-contracts.md) | Changing GHA reusable workflows — covers dispatch sync, secret/input threading across installation-mode chains, and review rules |
| [Shell Scripting](docs/contributing/shell-scripting.md) | Writing or reviewing shell scripts — covers `gh api --paginate` pitfalls, jq patterns, and stdout contamination in command substitution |
| [Forge Abstraction](docs/contributing/forge-abstraction.md) | Adding forge operations — covers `forge.Client` interface rules |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,11 @@ security controls remain in force.
- Per-run infrastructure timeouts remain effective, but a single pending slot
does not bound consecutive runs; sustained triggering still requires rate,
cost, or loop circuit breakers.

**Note (ADR 0113):** the clause above stating that `fullsend run` does not poll
for later events is revisited in
[ADR 0113](0113-steer-the-running-agent-on-work-item-updates.md), which lets a
run in flight absorb updates to its own work item. It still invokes no run of
its own, every event still creates its pending run, and a steered run does not
extend its timeout window. The deferral of content provenance and actor
authority to a separate ADR stands.
103 changes: 103 additions & 0 deletions docs/ADRs/0113-steer-the-running-agent-on-work-item-updates.md
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
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
topics:
- concurrency
- dispatch
- runtime
---
Comment thread
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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 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 it: payload validation, a merged or draft check, an author skip-list, an iteration cap, an instruction size cap.
  • The runner applies its own gates instead: the Route job's authorization of the event, the split 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, enforces it in the agent from the envelope, or leaves steering off for that harness. The post-script is unaffected.

The steer section of harness-reference.md now says the same in one sentence, so agent creators see it where they configure steering.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The head is now 49d716b, moved only by a rebase. The ADR 0113 bullet is unchanged, now in ade3a6d.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The head is now 9c8d16e. The ADR 0113 pre-script bullet is unchanged, now in 4b7b48e. The head moved for a rebase onto main and for the Codex interrupt update on OpenShell 0.1.2.


- 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.
109 changes: 109 additions & 0 deletions docs/ADRs/0117-steer-interface-in-sandbox-mailbox.md
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.
11 changes: 11 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,17 @@ The existing design principle is that [the repo is the coordinator](problems/age
their own workflow on the shim's `workflow_run` event
([guide](guides/user/chaining-follow-up-workflows.md),
[ADR 0124](ADRs/0124-criteria-for-adding-a-built-in-agent-role.md)).
- A run already working on a work item may **steer**: absorb updates to that
item into the session it is already running, rather than ending on the state
it started with. Steering requires preserving, never the reverse, and a steer
is content, never capability
([ADR 0113](ADRs/0113-steer-the-running-agent-on-work-item-updates.md)). The
interface is an optional runtime capability, `runtime.Steerer`, fed through a
mailbox the agent's own stdin is tailing, with delivery acknowledged by the
agent's echo of that specific message
([ADR 0117](ADRs/0117-steer-interface-in-sandbox-mailbox.md)). Steering is off
by default; a harness will opt in with `steer: {enabled: true}`, which is accepted and
validated but not yet consulted by any caller.
- Per-repo **polling** complements webhook dispatch: `fullsend poll` uses poll
input drivers to discover work from remote systems (Jira first), coordinates
via source-native write-then-verify locks, and feeds the same dispatch pipeline
Expand Down
2 changes: 2 additions & 0 deletions docs/contributing/harness-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ per-overlay:
| `max_runtime_fetches` | Fetch cap is operational, not forge-specific |
| `trigger` | CEL trigger expression is evaluated against normalized events, not forge-specific (ADR-0061) |
| `privilege_levels` | Mint privilege per run-stage is forge-agnostic (ADR-0073). **Top level only** — not a `ForgeConfig` field |
| `steer` | Steering settings are operational, not forge-specific (ADR-0113) |

## Merge and inheritance rules

Expand Down Expand Up @@ -94,6 +95,7 @@ Two independent precedence axes govern field resolution
| `api_servers` | Concatenated (base + child) | Absent (nil) = inherit |
| `env` | Sub-maps (`runner`, `sandbox`) merged independently; forge/child keys win (ADR-0055) | Absent (nil) = inherit |
| `security` | Child replaces base entirely (if non-nil) | Absent (nil) = inherit |
| `steer` | Child replaces base entirely (if non-nil) | Absent (nil) = inherit the base's whole block; a child setting `steer:` gets the defaults for any key it omits, not the base's values |
| `overlays` | Concatenated (base + child); all matching entries merged at resolution with later precedence (ADR-0088) | Absent (nil) = inherit |

## `ForgeConfig` struct
Expand Down
1 change: 1 addition & 0 deletions docs/contributing/runtime-implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ Harness `security.fail_mode` controls whether critical findings **block** the ru
| `runtime.ContextBridger` | Optional — runtime auto-loads only `CLAUDE.md`, so the runner injects a `CLAUDE.md`→`AGENTS.md` pointer (Claude Code: yes; runtimes that read `AGENTS.md` natively: omit) |
| `runtime.OpenAICredentialSeeder` | Optional — for a runtime that reaches OpenAI through the run-scoped provider (ADR 0092): names the in-sandbox credential file the agent re-reads per request and the `sh` fragment that writes the current placeholder into it, so a mid-run credential refresh reaches the running process. Omit when the runtime has no OpenAI path; a stub returning `""` means "no re-seed" and the provider is still created and refreshed |
| `runtime.ProviderResolver` | Optional — multi-provider runtimes return the OTEL GenAI serving-endpoint identity for the model the run will call (`ProviderFor`). The runner writes it as both `gen_ai.system` and `gen_ai.provider.name`. Single-vendor runtimes omit this and `GenAISystemFor` falls back to `System()` |
| `runtime.Steerer` | Optional — delivers a mid-run message into a running session, and settles it ([steering.md](steering.md)). Consulted only when `RunParams.Steerable` is set; `Run` then returns after `Settle` and the agent's current turn. **The caller must hold the runner's sandbox lock across every `Steer` and `Settle`**: both write into the running sandbox and race the credential refreshers the runner serializes through it. Omit and the runtime runs single-turn, exactly as it does today |

**Per-iteration cleanup contract.** When a validation retry reuses the sandbox, the runner calls `ClearIterationArtifacts` before the next iteration. Every runtime runs the shared `clearStrayProcesses` sweep first (it terminates the processes the previous iteration left running as the sandbox user, sparing the exec channel and the `sandbox.KeepAliveCommand` main process), then deletes the iteration's output, sessions and debug log. A failed sweep is reported as a warning and never fails the iteration. The runner holds its sandbox lock (`withSandboxLock` in `internal/cli/run.go`) across the call so the credential refreshers' uploads are never killed mid-write. The same sweep runs as `TerminateStrayProcesses` right after an iteration ends at its budget: OpenShell's exec timeout drops the relay but leaves the agent's processes running, and a killed iteration is not followed by another `ClearIterationArtifacts` (see [`fullsend run` § Budget and deadline](../cli/run.md#budget-and-deadline)).

Expand Down
Loading
Loading