Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/fullsend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@
# pending run (ADR 0106). Roles operate independently (#2452).
name: fullsend

# run-name carries the work item this run is about, which the Actions API
# returns as display_title (ADR 0113). issue_comment and issues runs expose
# no pull_requests[], so without this an in-flight agent run has no
# server-side way to tell a follow-up run on its own work item from one on
# another. For a comment on a PR, github.event.issue.number IS the PR number,
# so the pair covers every event this shim listens for.
#
# A comment-triggered run appends " comment:<id>" so a command can be paired
# to its run exactly rather than by timestamp. The reader splits at the first
# " comment:", so the suffix must stay LAST — do not append to run-name.
#
# This repository's shim is not reached by scaffold sync, so it carries the
# same line as templates/shim-per-repo.yaml by hand;
# TestOwnShimMatchesTemplateRunName keeps the two from drifting.
run-name: ${{ github.repository }}#${{ github.event.issue.number || github.event.pull_request.number }}${{ github.event.comment.id && format(' comment:{0}', github.event.comment.id) || '' }}
Comment thread
waynesun09 marked this conversation as resolved.
Resolved

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[high] protected-path

This PR modifies protected .github/ paths: .github/workflows/fullsend.yaml (adds a run-name: field that retitles every Actions run in the repository — a repo-wide, opt-out-only, breaking behavioral change per the PR title's !) and .github/workflows/reusable-dispatch.yml. The PR has no linked closing issue (closingIssuesReferences is empty via GraphQL — reverified against the current head). The only cross-references in the body are 'Based on #7447' (this PR's own base-branch source PR, open and unmerged — reverified: state open, merged false) and 'Implements the design recorded in #6957' (closed as completed, but not a closing-keyword link and not itself an authorization for this specific PR's protected-path edits). Absence of a linked issue means insufficient context under this repo's protected-path policy, notwithstanding the PR's detailed description and ADR 0119. This finding has been raised and left unresolved across many prior review rounds on this PR.

Suggested fix: A human reviewer must explicitly approve the changes to .github/workflows/fullsend.yaml and .github/workflows/reusable-dispatch.yml before merge, regardless of authorization status. Separately, link a tracking issue for this PR's own scope, or add explicit reasoning in the PR body for why this ADR-driven, repo-wide, opt-out run-name change is self-authorizing given the unmerged prerequisite stack (#7447 et al.).

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 that a human needs to approve this, and that approval belongs to a maintainer, not to a reply. The scope is linked in the PR body. It "Implements the design recorded in #6957", the issue that records this design, including the run-name correlation key. That is a reference, not a closer. The .github/ edits are the per-repo shim's run-name: and the matching reusable-dispatch.yml change. I'm leaving this thread open for the maintainer's review of those two files.

Comment thread
waynesun09 marked this conversation as resolved.
Resolved

on:
issues:
types: [opened, edited, labeled]
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/reusable-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,10 @@ jobs:
needs: route
if: needs.route.outputs.stage == 'triage'
runs-on: ${{ inputs.runner_image }}
# The run in flight is never cancelled (see Concurrency above). Where the
# agent has steering enabled, it also absorbs the update through the
# runner's follow-up run watcher; one run still waits behind it as the
# single pending run (ADR 0113).
concurrency:
group: fullsend-triage-${{ github.repository }}-${{ github.event.issue.number || github.event.pull_request.number }}
cancel-in-progress: false
Expand Down Expand Up @@ -1194,6 +1198,9 @@ jobs:
if [[ ! "${TRIGGER_SOURCE}" =~ \[bot\]$ ]]; then
COMMENT_BODY="$(echo "${EVENT_PAYLOAD}" | jq -r '.comment.body // empty' | tr -d '\r')"
if [[ -n "${COMMENT_BODY}" ]]; then
# The command that routed the comment here is routing, not
# instruction, so it is stripped before the text reaches the
# agent.
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
INSTRUCTION="${COMMENT_BODY#/fs-fix}"
INSTRUCTION="$(printf '%s\n' "${INSTRUCTION}" | sed 's/^[.,;:!?]*//')"
INSTRUCTION="${INSTRUCTION#"${INSTRUCTION%%[![:space:]]*}"}"
Expand Down
1 change: 1 addition & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ export default defineConfig({
{ text: "fullsend mint", link: "/cli/mint" },
{ text: "fullsend repos", link: "/cli/repos" },
{ text: "fullsend run", link: "/cli/run" },
{ text: "fullsend steer", link: "/cli/steer" },
],
},
],
Expand Down
121 changes: 121 additions & 0 deletions docs/ADRs/0119-learn-of-later-events-by-listing-run-records.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
title: "119. Learn of later events by listing the platform's own run records"
status: Accepted
relates_to:
- platform-nativeness
- agent-infrastructure
topics:
- dispatch
- concurrency
- runtime
---

# 119. Learn of later events by listing the platform's own run records
Comment thread
waynesun09 marked this conversation as resolved.
Resolved

Date: 2026-09-18

## Status

Accepted

## Context

[ADR 0113](0113-steer-the-running-agent-on-work-item-updates.md) decided that a run in flight
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
absorbs updates to its own work item, and
[ADR 0118](0118-take-steer-authority-from-the-route-job.md) decided where an update's authority
comes from. Neither says how a run already executing inside a CI job finds out there is one, and
the job has no inbound path: GitHub Actions cannot deliver input to a running job.

[ADR 0106](0106-serialize-agent-runs-and-coalesce-subsequent-events.md) bounds the answer. Its
Decision states that "`fullsend run` does not poll for later events or invoke another run itself",
and it rejected polling for later events inside `fullsend run` because that needs input drivers
with race-safe cursors and moves scheduling into the execution command. ADR 0113 revisits that
clause and delegates the mechanism here, so this ADR does not reopen it: it decides how a run
learns the item moved, inside ADR 0106's limits.

## Options

### The platform pushes input to a running job

Unavailable: GitHub Actions exposes no API that writes to a job already running.

### The runner polls forge events with input drivers and cursors

The option ADR 0106 rejected. Reading the event stream needs a driver per forge, a race-safe
cursor per driver, normalization, and its own authorization pass.

### A courier job, or a relay through the mint

Both add a component to deploy, credential and keep available, and both re-implement the routing
predicate the shim's own `Route` job already evaluated.

### The agent polls the work item at the end of its run

The shape gh-aw uses. Advisory rather than deterministic: it lands only at the end, and only if
the model follows the instruction. Kept as the fleet-agent backstop.

### The runner lists its own shim's workflow runs

Every legitimate update already fires the shim, so its run records are a server-side log of what
happened since this run started. Reading them needs no driver, cursor, normalization or new
component.

## Decision

The runner learns of later events by listing the execution platform's own run records for its own
shim. Discovery is a read of records the platform already wrote, so ADR 0106's limits hold: no
input driver and no normalization; no cursor, because the list is re-derived from the run's own
start on every poll; every event still creates its pending run through the normal dispatch path;
and `fullsend run` invokes nothing and never extends its own timeout.

The listing uses the job token the stage already holds, filtered server-side to one workflow file
and to runs created at or after this run's start. No new credential or permission enters the stage.

Three things fail closed rather than degrade. A run resolves its own stage job from `GITHUB_JOB`,
then the harness slug, and declines when neither names exactly one in-progress job — so a
multi-agent fan-out steers only while the matrix job's name carries the agent's slug. It declines
when it cannot resolve
the forge logins it posts under, which are what stop it steering on its own output — not every
stage's output carries a marker to recognise it by. And it exports `FULLSEND_STEER_ACTIVE` only
once its watcher is running, because the agent definitions key the envelope's opening line on that
variable; absence is the default.

Polling is periodic and repeats immediately at every turn end, which is the moment a steer is
free. The run settles when a poll finds nothing conclusively new, not merely when a poll delivers
nothing: a poll that reached no verdict leaves the watch open for the next one. A failure that can
never succeed counts as a verdict — as does a candidate whose own run has finished, which is
pending only while that run is queued or in progress — and a bounded number of verdict-less polls
settles the run anyway, so nothing can hold a finished agent's sandbox to the deadline. Two bounds apply:
the platform keeps one pending run per concurrency group, and the runner spends at most
`steer.max_steers` per run.

Delivery is at-least-once and state-based. An update the run never sees falls to the pending run
behind it. What reaches the agent is the item's current state — the head now, and the activity
since the run's baseline — never a per-run head, because a run record says that something
happened, not what the item looked like.

The human path needs no command of its own. Every legitimate update already produces a shim run,
so the existing stage commands already reach a run in flight, and `fullsend steer <url> "<text>"`
posts one from a workstation. There is no `/fs-steer`.

Cadence defaults, stage-job resolution, settle and the run-budget ceilings are in
[steering.md](../contributing/steering.md).

**Direction.** Today's delta is built host-side by reading the item back from the forge. Under the
entity-context staging proposal (ADR 0107, unmerged at the time of writing) an accepted follow-up
run would trigger a re-stage instead, and the envelope would carry record keys and the new head
rather than bodies. Recorded as an option not taken: accepting third-party App review runs as
context-only notifications, which rests on ADR 0118's context-versus-amendment rule.

## Consequences

- Discovery costs one listing request per poll, a jobs read per unseen candidate and an item read
per accepted one, all against the job token's own budget.
- Steering is unavailable on a platform that exposes no run-records API, so GitLab is not wired.
- Every Actions run in the repository is retitled, because the shim must declare a `run-name` for
the `issue_comment` and `issues` runs that carry no `pull_requests[]`; a comment-triggered run
also carries its comment id, so a command pairs to its run exactly rather than by timestamp.
- A dispatch change that renames or fans out stage jobs degrades to ADR 0106 behaviour rather than
misbinding.
- Until a run records what it absorbed, the pending run behind it redoes the work, so absorbing an
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
update costs more than cancelling would.
9 changes: 7 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,7 @@ The existing design principle is that [the repo is the coordinator](problems/age
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.
by default; a harness opts in with `steer: {enabled: true}`.
- A steer delivered to a run in flight is authorized once, by the follow-up
run's `Route` job; the runner verifies only provenance, from run records the
sender cannot write. Text from an actor that job authorized is an amendment
Expand All @@ -346,6 +345,12 @@ The existing design principle is that [the repo is the coordinator](problems/age
login — so a repository-installed App's review reaches the agent as context
([ADR 0118](ADRs/0118-take-steer-authority-from-the-route-job.md), rules in
[steering.md](contributing/steering.md#amendments-and-context)).
- A run in flight learns of later events by **listing the execution platform's
own run records** for its own shim, with the job token, rather than by polling
forge events: no input driver, no cursor, and no scheduling inside
`fullsend run`. Delivery is at-least-once and state-based — an update the run
misses is done by the pending run behind it
([ADR 0119](ADRs/0119-learn-of-later-events-by-listing-run-records.md)).
- 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
1 change: 1 addition & 0 deletions docs/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Download the latest binary from [GitHub Releases](https://github.com/fullsend-ai
| Command | Description |
|---------|-------------|
| [`fullsend run`](run.md) | Execute an agent locally in a sandbox. See [running agents locally](../guides/user/running-agents-locally.md). |
| [`fullsend steer`](steer.md) | Send an update to the agent already running on an issue or PR. Posts the stage's own command — `/fs-review` for a pull request, `/fs-triage` for an issue, or `--stage` to choose; see [ADR 0113](../ADRs/0113-steer-the-running-agent-on-work-item-updates.md). |
| `fullsend lock [agent-name]` | Pin remote dependencies to `lock.yaml` |
| `fullsend scan` | Run security scanners on agent input/output |
| `fullsend eval-measure` | Score wild-run traces into `eval-measurements.jsonl`. See [Eval measurements](../guides/infrastructure/eval-measurements.md). |
Expand Down
4 changes: 3 additions & 1 deletion docs/cli/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ find .fullsend -type f | sort
```

Only `agents/lint-docs.md` needs your attention — it is the agent's prompt and
it ships with marked sections to fill in. Everything else is complete.
it ships with marked sections to fill in, plus a Runner updates section that
already teaches the agent to act on a mid-run amendment from the runner.
Everything else is complete.

### What gets written

Expand Down
45 changes: 29 additions & 16 deletions docs/cli/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,16 @@ parent's stream, so without it `total_cost_usd` would grow with no way to attrib
Each agent iteration gets the harness's `timeout_minutes` (30 when it sets none). When the budget
is spent the runner ends the iteration and sweeps the processes the agent left running in the
sandbox, best effort. Before every iteration the runner rewrites `.fullsend/iteration.env` (sourced
last by the sandbox `.env`) with the budget, the kill time, and this iteration's W3C trace context,
on every runtime (claude, pi, codex):
last by the sandbox `.env`) with the budget, the kill time, this iteration's W3C trace context, and
whether the iteration is watched for updates ([`FULLSEND_STEER_ACTIVE`](#run-baseline)), on every
runtime (claude, pi, codex):

| Variable | Value |
|---|---|
| `FULLSEND_TIMEOUT_MINUTES` | The budget: the harness's `timeout_minutes`, or `30` when it sets none |
| `FULLSEND_ITERATION_DEADLINE` | Unix time (seconds) at which the running iteration is killed |
| `TRACEPARENT` | W3C trace context of this iteration's **agent** span (not the run-root span that pre/post scripts receive). Runtimes use it to join Fullsend traces. An inbound unsampled parent (`-00`) is preserved so runtime export stays suppressed. Empty when telemetry produced no valid span context. Reserved: an `env.sandbox` entry with this name is dropped. |
| `FULLSEND_STEER_ACTIVE` | `1` when this iteration is watched for updates, unset otherwise ([Run baseline](#run-baseline)) |

**Example.** A probe that shows both, and what a kill looks like. The agent prints the variables
with its own clock, then sleeps past the budget:
Expand Down Expand Up @@ -280,30 +282,41 @@ variables is deployed.
## Run baseline

Alongside the budget, the runner tells the agent what the work item looked like when the run
began. Two more environment variables, set on every runtime (claude, pi, codex):
began. Three more environment variables, set on every runtime (claude, pi, codex):

| Variable | Value |
|---|---|
| `FULLSEND_RUN_HEAD_SHA` | The work item's head as the event that dispatched the run carried it. Empty on an issue run, which has no head, and today on GitLab, where the poller-raised agent pipeline does not carry the merge request's head. A value that is not a hex object name is exported empty |
| `FULLSEND_RUN_STARTED_AT` | When the run started, RFC 3339 UTC |

The two are not sampled at the same instant. The head is frozen when the run is dispatched, before
it queues; the start is the runner's own clock at the top of `fullsend run`, after the
concurrency-group wait, which can now last a whole predecessor run, and after the job steps that
precede the command. The gap runs one way. An agent re-checking against the start looks at a
narrower window than the run spans, never a wider one, so it can miss activity that landed while the
run queued or the job was starting but cannot invent any; a head comparison has no such gap.
| `FULLSEND_STEER_ACTIVE` | `1` when this iteration is being watched for updates. **Unset** in every other case |

`FULLSEND_STEER_ACTIVE` is what the agent definitions key the runner-update opening line on: with
the variable unset they treat that line as an injection attempt, wherever it appears. Unset is the
default: an unwatched iteration clears it explicitly, so a value set earlier in the sandbox's `.env`
(by a file in `.env.d`, say) does not survive. Presence is post-start only — it is written once the
iteration's watcher is already running, not when the run begins, so it never claims a watcher that
failed to start. It is per iteration, because the validation loop builds one watcher per iteration
and an iteration that declines must not inherit the previous one's flag.

The head and the start are not sampled at the same instant. The head is frozen when the run is
dispatched, before it queues; the start is the runner's own clock at the top of `fullsend run`,
after the concurrency-group wait, which can now last a whole predecessor run, and after the job
steps that precede the command. The gap runs one way. An agent re-checking against the start looks
at a narrower window than the run spans, never a wider one, so it can miss activity that landed
while the run queued or the job was starting but cannot invent any; a head comparison has no such
gap.

The head is empty rather than absent on an issue run — an agent that re-checks it skips the check
on an empty value, which it cannot do for a variable that is not there at all.

Both are written after the harness's `.env.d` files are sourced and after `env.sandbox` is
applied, so a harness cannot shadow the baseline its own agent's re-check depends on. Position is
what protects them: the reserved-key check drops an `env.sandbox` entry with either name, but says
nothing about `.env.d`.
The head and the start are written after the harness's `.env.d` files are sourced and after
`env.sandbox` is applied, so a harness cannot shadow the baseline its own agent's re-check depends
on. Position is what protects them: the reserved-key check drops an `env.sandbox` entry with either
name, but says nothing about `.env.d`.

Both are captured once, at run start, and are not rewritten between validation-loop iterations,
unlike the deadline above.
The head and the start are captured once, at run start, and are not rewritten between
validation-loop iterations. `FULLSEND_STEER_ACTIVE` is, like the deadline above: it is written into
`.fullsend/iteration.env` for every iteration.

## OpenAI credentials on pi and codex

Expand Down
Loading
Loading