Skip to content
Merged
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
6 changes: 6 additions & 0 deletions docs/ADRs/0088-cel-guarded-overlays.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ Accepted
> and [#6686](https://github.com/fullsend-ai/fullsend/issues/6686) for
> the current behavior.

> **Note (2026-10-01):**
> [ADR 0112](0112-overlays-may-set-any-harness-field.md) lets overlays set
> any harness field except `base`, `trigger`, `overlays`, `slug`, `role` and
> `forge`. An overlay that sets a guarded field may read only trusted event
> and entity fields, `runtime.forge` and `config`.

## Context

[ADR 0045](0045-forge-portable-harness-schema.md) added a `forge:` block to
Expand Down
115 changes: 115 additions & 0 deletions docs/ADRs/0112-overlays-may-set-any-harness-field.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
title: "112. Harness overlays may set any harness field"
status: Accepted
relates_to:
- agent-architecture
- security-threat-model
- adaptive-agent-selection
topics:
- harness
- overlays
- cel
- security
- routing
---

# 112. Harness overlays may set any harness field

Date: 2026-10-01

## Status

Accepted

<!-- ADRs are point-in-time records, but not fully frozen after acceptance.
Minor annotations are welcome: cross-references to related ADRs, short
notes linking to newer decisions, or clarifying remarks. However, do not
substantially rewrite the Context, Decision, or Consequences sections. If
the decision itself needs to change, write a new ADR that supersedes this
one. For evolving design narrative, use docs/architecture.md. -->

## Context
Comment thread
tpouyer marked this conversation as resolved.
Resolved

Tasks differ: a typo fix can run cheaper, a security-sensitive change deserves
a deeper review (#5777, #2842, agents#497, agents#535) and a listed model is
sometimes not served (#6964), yet a repo picks one model and effort per agent
([ADR 0091](0091-per-agent-runtime-model-effort.md)).

Harness `overlays:` ([ADR 0088](0088-cel-guarded-overlays.md)) already vary
a harness per event, but only its forge-oriented fields
([field reference](../contributing/harness-fields.md)), not `model` or `effort`.
They can already set `policy`, `providers` and `env` from any event field,
and the [normalized event](../normative/normalized-event/v1/README.md) is
gaining change facts the author shapes.

## Options

- **A separate `routing:` policy in `.fullsend/config.yaml`** (#7808): it
also routes the runtime, but adds a second conditional mechanism.
- **Per-prompt routing in the sandbox** (#6361), rejected: it reads
author-controlled prompts and loses the prompt cache mid-loop.
- **Overlays set any field**, chosen: routing and every other conditional
setting reuse one mechanism.

## Decision

1. **Any field.** An overlay may set any harness field except `base`,
`trigger`, `overlays`, `slug`, `role` and the deprecated `forge`, which
decide how a harness is found, composed or dispatched and stay top level.
Field merge rules and ADR 0091's precedence are unchanged, so an overlay
can set a field only to a non-empty, non-zero value.
2. **Guarded fields.** Guarding stops a change's author from picking which of
the harness's branches sets a guarded field. If an overlay keys on something
the author controls, like which files changed, they can shape the change to
win a looser `policy`, a broader token or a skipped scan. So a guarded field
can only be set from **trusted facts**, which neither the author nor the
event's actor can choose beyond what their permission allows:
`runtime.forge`, `config` (from the same trusted ref as
[OWNERS](../guides/user/owners-file-authorization.md) and the harness) and
the event and entity fields
([ADR 0098](0098-entity-first-harness-evaluation.md)) the normalized event
spec lists as trusted. Every field, including any added later, is guarded
except `model`, `effort`, `description` and `doc`, which change how well or
how cheaply an agent works, not what it may do. Validation fails an overlay
that sets a guarded field when its `when:` reads anything else, such as a
parent object of an untrusted field or an unresolvable path (`event != null`
and `has()` on an object the schema always requires are allowed); on such an
overlay a missing event or key is no match, as today, and any other
evaluation error fails the run.
Comment thread
ifireball marked this conversation as resolved.
Resolved
3. **Resolution trace.** The plan output and a dedicated span (for example
`config.overlay_resolution`) record which overlays matched, the names of
the fields each set (values only for `model` and `effort`), and for each of
those fields whether it applied, which higher-precedence source overrode
it, or, for `model` and `effort`, that a fallback replaced it (Decision 4).
4. **Routed-model fallback.** When the runtime reports that a model an
overlay set isn't served, the runner retries the run once with the model
and effort it would use without overlays; `FULLSEND_FALLBACK_MODELS`
applies as each runtime allows.

Comment thread
tpouyer marked this conversation as resolved.
Resolved
## Consequences

- Per-task routing needs no mechanism of its own: a harness sets `model` and
`effort` in overlays keyed on change facts.
- A repo routes a built-in agent by composing a custom harness on it through
`base:`; overriding harness settings without a custom harness is separate
work.
- An overlay that sets a guarded field from anything but trusted facts fails
validation instead of relying on review, while today's built-in,
`config`-keyed and no-event fall-through overlays keep working.
- A change's author can still steer which routing branch applies, so `model`
and `effort` overlays can't enforce a floor: security-relevant harnesses
should keep their strongest model and effort and any restrictive values at
top level, and loosen them only in overlays whose `when:` positively proves
a trusted fact; a restriction whose loosened value is false, zero or empty
needs a separate harness composed through `base:`.
- The runtime and persona models are not harness fields (ADR 0091,
[ADR 0104](0104-per-persona-model-resolution.md),
[ADR 0126](0126-fullsend-owned-codex-subagents.md)), so overlays cannot
route them.

### Deferred

- **Persona-model routing**, with the configuration standardization work in
flight rather than a new harness field.
- **LLM-based routing** isn't decided here (see AISDLC-95) and would need its
own ADR.
1 change: 1 addition & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ flowchart TB
**Decided (implementation):**

- The `fullsend run` runner delegates in-sandbox agent execution to a `runtime.Runtime` interface; production orgs default to Claude Code, with [pi](https://github.com/earendil-works/pi) available as an opt-in second runtime (`runtime: pi`, Claude-on-Vertex through the same WIF credential path) and [codex](https://github.com/openai/codex) as a third (`runtime: codex`, OpenAI-only through a custom model provider whose bearer token comes from a runner-seeded file, with the sandbox tool hooks behind a translating adapter — [ADR 0099](ADRs/0099-codex-agent-runtime.md) and [ADR 0100](ADRs/0100-codex-sandbox-hooks.md)). Runtime selection is configured per repo with `runtime:` in `.fullsend/config.yaml` (per-agent `runtime`/`model`/`effort`/`subagents` on the agent's `agents:` entry sit above it and below the `--runtime`/`--model`/`--effort` flags and `FULLSEND_*` variables, [ADR 0091](ADRs/0091-per-agent-runtime-model-effort.md)) and resolved via `runtime.ResolveForAgent()`. Test-only runtimes — **dummy** (scripted operations) and **dummy-playback** (playlist-based replay of canned results) — execute in the real OpenShell sandbox for behaviour tests without inference. Bootstrap uses a portable `BootstrapInput` interface with optional extensions such as `SandboxHooksBootstrap` for the runtime-neutral sandbox tool hooks ([ADR 0090](ADRs/0090-runtime-neutral-sandbox-hooks-contract.md)); runtimes declare further capabilities through small optional interfaces (`DebugLogNamer`, `ContextBridger`) rather than `Name()` checks in the runner. Transcript and debug artifact handling use a separate `TranscriptHandler` interface. See [runtimes.md](runtimes.md) for the per-runtime security feature matrix required when adding a new backend.
- Harness `overlays:` ([ADR 0088](ADRs/0088-cel-guarded-overlays.md)) will be able to set any harness field except `base`, `trigger`, `overlays`, `slug`, `role` and `forge`; an overlay that sets a guarded field (any field except `model`, `effort`, `description` and `doc`) may read only trusted event and entity fields, `runtime.forge` and `config`, and every run will record an overlay resolution trace in the plan output and a dedicated span ([ADR 0112](ADRs/0112-overlays-may-set-any-harness-field.md)). Per-task model routing is overlays setting `model` and `effort`, and when a routed model isn't served the runner retries once with the model and effort the run would use without overlays, and `FULLSEND_FALLBACK_MODELS` applies as each runtime allows. Decided, not yet implemented.
- Plugins are runtime-scoped harness resources: a harness declares `plugins:` as one list of directories in its own repository (same trust and fetch path as skills), and each entry's format decides which runtime loads it — a `plugin.json` bundle is Claude Code's, a directory pi's `-e` loader resolves is uploaded and loaded after a tree-hash preflight computed from the host copy. Each runtime names and skips the entries in the other format, so the list survives a runtime switch. Because `--no-extensions` plus explicit `-e` closes the set of code that can register tools, no per-tool declaration is needed ([ADR 0094](ADRs/0094-pi-extensions-are-harness-resources.md)).
- Native Codex children run under a runner-owned policy: Bootstrap registers roles for an agent with the `Agent` tool, under harness security, whose parent model Codex resolves to collaboration V1 (a V2 or unlisted parent keeps the multi-agent tools off), and binds each child's model (a persona's own entry in its role file, the run-level default otherwise), and a mandatory dispatch hook admits only fresh-context V1 spawns of registered roles after checking `hooks.json` and the role files against runner-held digests ([ADR 0126](ADRs/0126-fullsend-owned-codex-subagents.md)); not yet implemented, so review and retro still run in one context on Codex ([#6970](https://github.com/fullsend-ai/fullsend/issues/6970)).

Expand Down
6 changes: 6 additions & 0 deletions docs/contributing/harness-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
> schema) and [ADR-0088](../ADRs/0088-cel-guarded-overlays.md) (CEL-guarded
> overlays). Those ADRs are point-in-time records; this document reflects the
> current state.
>
> **Decided, not yet implemented (2026-10-01):**
> [ADR 0112](../ADRs/0112-overlays-may-set-any-harness-field.md) will let
> overlays set any field except `base`, `trigger`, `overlays`, `slug`, `role`
> and `forge`, with guarded fields limited to trusted inputs. The tables below
> change when it is implemented.

## Field classification

Expand Down
44 changes: 44 additions & 0 deletions docs/normative/normalized-event/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,50 @@ follow-up PRs **must** gate on `!state.change_proposal.is_fork` in harness
`trigger` expressions or rely on dispatch-level authorization per ADR 0054.
Read-only agents (triage, review, retro) may run on fork PRs when policy allows.

### Change facts (`state.change_proposal.diff`, `state.change_proposal.linked_work_items`)

Optional and added for
[ADR 0112](../../../ADRs/0112-overlays-may-set-any-harness-field.md)'s routing; no v1
adapter populates them yet. When known, adapters set
`state.change_proposal.diff` (file count, additions, deletions and changed
paths at `head_sha`, with `paths_complete` false when the forge truncated the
list, in which case a check for a path's absence should treat it as unknown)
and `linked_work_items` (each linked work item's id, optional key, state and
labels).
Harness `trigger` and `overlays:` expressions may read them, for example to
route `model` and `effort` per task; they are untrusted (see below)
([ADR 0112](../../../ADRs/0112-overlays-may-set-any-harness-field.md)). A
`trigger` that reads them lets the change's author decide whether a harness
runs, so security-relevant harnesses shouldn't trigger on them.

### Trusted fields

A field is **trusted** when neither the change's or entity's author nor an
actor below the permission level [ADR 0054](../../../ADRs/0054-require-authorization-on-all-agent-dispatch-paths.md)
requires can choose its value beyond what their permission already allows
(for example, only an author with write access can make `is_fork` false). An
overlay that sets a guarded harness field may read only these fields, `runtime.forge` and `config`
([ADR 0112](../../../ADRs/0112-overlays-may-set-any-harness-field.md)):

- `repo`
- `source.system`, and `entity.source.system` in the entity context of
[ADR 0098](../../../ADRs/0098-entity-first-harness-evaluation.md)
- `actor.role`
- `state.change_proposal.base_repo` and `is_fork`

Every other field, including a field added to this schema later, is untrusted
until it is listed here. For example `transition.comment` (its `body`,
`command` and `instruction` all come from the comment text), the action fields
(`transition.kind`, `source.raw_type`, `source.raw_action`, `entity.kind`),
`actor.kind` (some adapters infer it from a display name),
`actor.is_entity_author` (the author makes it true by acting), `state.labels`,
`base_ref` (the author picks the target branch), `head_*` and the change facts
are untrusted. A guarded overlay may test `has()` only on objects the schema
always requires, such as `source`; reading `is_fork` when there is no change
proposal is simply no match. `actor.role` says who triggered the event, not
who wrote the change, so an overlay that loosens a guarded value on a change
proposal should also require `!state.change_proposal.is_fork`.

## CEL trigger examples

Harness `trigger` expressions are CEL booleans over `event`:
Expand Down
87 changes: 87 additions & 0 deletions docs/normative/normalized-event/v1/normalized-event.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,93 @@
},
"is_fork": {
"type": "boolean"
},
"diff": {
Comment thread
tpouyer marked this conversation as resolved.
Resolved
"type": "object",
"additionalProperties": false,
"required": [
"files",
"additions",
"deletions"
],
"dependentRequired": {
"paths_complete": [
"paths"
]
},
"properties": {
"files": {
"type": "integer",
"minimum": 0
},
"additions": {
"type": "integer",
"minimum": 0
},
"deletions": {
"type": "integer",
"minimum": 0
},
"paths": {
Comment thread
tpouyer marked this conversation as resolved.
Resolved
"type": "array",
"maxItems": 3000,
"items": {
"type": "string",
"minLength": 1,
"maxLength": 4096,
"pattern": "^(?:[^./\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^./\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+)(?:/(?:[^./\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^./\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+))*$"
},
"description": "Changed file paths relative to the repository root. May be truncated when the forge caps the list; see paths_complete."
},
"paths_complete": {
"type": "boolean",
"description": "True only when paths is present and lists every changed file."
}
},
"description": "Optional change facts at head_sha, added for ADR 0112's routing and not yet populated by any adapter. Untrusted (README, Trusted fields)."
},
"linked_work_items": {
"type": "array",
"maxItems": 50,
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"state",
"labels"
],
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"key": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"pattern": "^([A-Za-z][A-Za-z0-9_]+-\\d+|[A-Za-z0-9_.-]+(/[A-Za-z0-9_.-]+)+#\\d+)$",
"description": "Human-readable key when the id alone is ambiguous, for example a Jira key (PROJ-123) or a cross-repository reference (owner/repo#12)."
},
"state": {
"type": "string",
"enum": [
"open",
"closed"
]
},
"labels": {
"type": "array",
"maxItems": 100,
"items": {
"type": "string",
"minLength": 1,
"maxLength": 255
}
}
}
},
"description": "Optional work items the change proposal links to (for example through closing keywords), added for ADR 0112's routing and not yet populated by any adapter. Untrusted: the author chooses which items are linked (README, Trusted fields)."
}
},
"description": "Required when the matched harness needs change-proposal execution context (review, fix, retro on a PR). id MUST match entity.id or entity.linked_change_proposal.id when those are present. Adapters must populate branch and repo fields so dispatch can project event_payload without API round-trips."
Expand Down
2 changes: 1 addition & 1 deletion docs/problems/adaptive-agent-selection.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,6 @@ The experiment should actively pressure-test three assumptions:
- Should the fitness function include a cost term from the start, or should cost optimization be a separate experiment after quality optimization is validated?
- What is the right exploration budget, and how should it decay? Too high wastes runs on poor configurations; too low starves new options.
- Can fitness data transfer across repos with similar characteristics, and how do we measure "similar"?
- How should the adaptive layer interact with the deterministic safety model — is selection-only sufficient, or are there edge cases where the choice of configuration implicitly affects safety coverage?
- How should the adaptive layer interact with the deterministic safety model — is selection-only sufficient, or are there edge cases where the choice of configuration implicitly affects safety coverage? (Partially decided for model and effort: routing is harness overlays setting those fields ([ADR 0112](../ADRs/0112-overlays-may-set-any-harness-field.md)), falling back to the model and effort the run would use without overlays when a routed model isn't served; LLM-based and learned routing remain open.)
- What prevents a well-scoring configuration from being well-scoring only because it is assigned to a biased subset of tasks (selection bias in the evaluation)?
- Should there be a human-in-the-loop approval step before any configuration is retired, or is soft retirement with recovery probing sufficient?
Loading
Loading