Skip to content

docs(adr): let overlays set any harness field and route models - #7842

Merged
ralphbean merged 1 commit into
fullsend-ai:mainfrom
tpouyer:routing-overlays-adr
Oct 6, 2026
Merged

ralphbean merged 1 commit into
fullsend-ai:mainfrom
tpouyer:routing-overlays-adr

Conversation

@tpouyer

@tpouyer tpouyer commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

I reworked this after Hector's and Ralph's feedback. Overlays get opened up to (almost) any harness field, so per-task routing comes "for free" from overlays keyed on change facts. The security rule for doing that lives in ADR 0112, the change facts go into the normalized-event spec (no ADR), and there's no model catalog or list of supported models at all. If a model an overlay picked isn't served, the run just retries with the model and effort it would have used without overlays. Docs only, no code.

Related Issue

Refs #5777, #2842, fullsend-ai/agents#497 (cheaper runs on trivial changes), fullsend-ai/agents#535 (deeper review on security signals), #6527 (don't downgrade the deciding session), #6964 and fullsend-ai/agents#1225 (a listed model that isn't served).

This is still the alternative to #7808. It doesn't close any of these since each still needs the implementation.

Changes

  • ADR 0112, rewritten: harness overlays may set any harness field. Everything except base, trigger, overlays, slug, role and the deprecated forge. Merge rules and ADR 0091's precedence don't change. A guarded field is one an overlay can only set from facts the change's author can't choose, and every field is guarded except model, effort, description and doc. A guarded overlay may only read runtime.forge, config (from the same trusted ref as OWNERS and the harness) and the event and entity fields the spec lists as trusted, and can only use has() on objects the schema always requires. That way a PR author can't pick which branch of a harness applies to things like policy or env. A missing event or key still counts as no match like today, and any other evaluation error on a guarded overlay fails the run. Every run records an overlay resolution trace in the plan output and its own span, including when a fallback replaced a routed model or effort. 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, and FULLSEND_FALLBACK_MODELS applies as each runtime allows. This replaces the catalog, tiers and floor from the first version, and the supported: block (ADR 0130) from the last one, which we dropped after talking it through with Hector and Ralph.
  • Normalized event v1 (no ADR). Optional state.change_proposal.diff and linked_work_items, added for 0112's routing and not yet populated, with patterns for paths (relative and canonical) and keys. Plus a "Trusted fields" list: anything not on it, including fields added later, is untrusted.
  • Note on an accepted ADR. A dated Status note on ADR 0088 saying overlays may now set any field. No other edits to accepted ADRs.
  • Living docs. docs/architecture.md gets one Decided line (not yet implemented). Annotations in adaptive-agent-selection.md and security-threat-model.md. docs/contributing/harness-fields.md gets a dated forward note; its tables describe current behavior and change when this gets implemented.

Deferred: persona-model routing (with the configuration standardization work in flight) and LLM-based routing (not decided here, see AISDLC-95, would need its own ADR).

Example harness

The ADR fixes the concepts, not the schema, so treat the field names as placeholders.

# harness/retro-routed.yaml (not security-relevant, so routing on change facts is fine)
base: retro
model: sonnet
effort: medium
policy: policies/readonly.yaml   # restrictive by default
overlays:
  # model and effort can key on change facts, even though the author shapes them
  # (if opus isn't served, the run retries on sonnet/medium)
  - when: event.state.change_proposal.diff.additions > 500
    model: opus
    effort: high

  # A guarded field: loosened only when a trusted fact proves it's safe
  # (on an issue event the key is missing, so this doesn't match and the
  # restrictive default stays)
  - when: event.state.change_proposal.is_fork == false && event.actor.role == "maintain"
    policy: policies/standard.yaml

Validation would reject:

overlays:
  - when: event.state.change_proposal.diff.files < 3   # untrusted read...
    providers: [extra-registry]                        # ...setting a guarded field

Testing

  • make lint passes (stage changes first, then run). All pre-commit hooks pass, including the ADR status, number and frontmatter lints, the markdown link check and gitlint.
  • Tests added/updated for new or modified logic: N/A, docs only.

Notes for review

  • ADR number. 0112 is still shared with docs(adr): route runtime and model per task from a config policy #7808 on purpose since only one will merge. Whichever merges should get re-checked with renumber-adr.
  • Possible overlap with docs(adr): add ADR 0127, 0128, and 0129 for harness schema versioning and preflight checks #7682. Its ADR 0127 (harness schema versioning and field types) may end up classifying harness fields too. If that lands first I'll make sure the two line up.
  • Not-served signal. Runtimes don't hand the runner a typed "model not served" error yet (pi detects it internally, Claude Code and Codex don't), so that comes with the implementation.
  • Existing custom overlays. Overlays that set things like policy or env keyed on something now untrusted (labels, entity.kind, comment text) would start failing validation once this is implemented. The built-in harnesses only key on event.source.system, has(event.source) and runtime.forge, so they're fine.
  • Trusted ref. For PR events that's the base-branch SHA, which the author picks. That's the same trust model the workflows already use when they check out .fullsend and the harnesses, so guarded overlays don't add exposure. Tightening it to default or protected branches would be its own follow-up since it affects OWNERS too.

Checklist

  • PR title follows Conventional Commits (correct type, ! for breaking changes)
  • Commits are signed off (DCO) — human and human-directed agent sessions only
  • I wrote this contribution myself and can explain all changes in it

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

E2E tests are running

Authorization passed for this commit. See the E2E Tests workflow for results.

@tpouyer
tpouyer marked this pull request as ready for review September 30, 2026 11:56
@tpouyer
tpouyer requested a review from a team September 30, 2026 11:56
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can route each severity your way: inline, summary, both, or drop

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Document per-task model and effort routing through harness overlays

📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Record ADR 0112’s overlay-based alternative to a separate repository routing policy.
• Define task-aware routing, precedence, protected-harness floors, served-model fallback, and
 decision echoes.
• Link the decision from architecture, tier terminology, and open-problem documentation;
 implementation remains pending.
Diagram

graph TD
  A["Task facts"] --> B["Harness overlays"] --> C{"Routing guards"} --> D["Precedence resolution"] --> E{"Model served?"} --> F["Sandbox run"] --> G["Decision echo"]
  E -->|No| H["Eligible fallback"] --> F
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Separate repository routing policy
  • ➕ Lets repositories route built-in agents without composing a custom harness.
  • ➖ Introduces a second conditional-configuration mechanism with separate rules and trust controls.
2. Per-prompt sandbox routing
  • ➕ Can react to information observed during an agent run.
  • ➖ Exposes selection to author-controlled prompts and changes models mid-loop, losing prompt-cache continuity.

Recommendation: The overlay approach best reuses existing harness conditions and merge semantics while keeping routing alongside the harness it affects. Review whether requiring custom harness composition for repository-specific routing is an acceptable trade-off against the separate-policy option.

Files changed (5) +136 / -2

Documentation (5) +136 / -2
0112-route-model-and-effort-through-harness-overlays.mdDefine overlay-based per-task model and effort routing +132/-0

Define overlay-based per-task model and effort routing

• Introduces ADR 0112, specifying task facts, overlay resolution and precedence, routing guards, protected-harness floors, served-model fallback, and decision echoes. Contrasts this approach with a separate routing policy and defers repository-level overrides, persona routing, and learned routing.

docs/ADRs/0112-route-model-and-effort-through-harness-overlays.md

architecture.mdLink the routing decision from the architecture overview +1/-0

Link the routing decision from the architecture overview

• Adds the planned per-task overlay routing model to the runtime architecture section, noting its precedence and that implementation is pending.

docs/architecture.md

tier-conventions.mdDefine model tier terminology +1/-0

Define model tier terminology

• Distinguishes the proposed model-catalog tier used by protected-harness routing from other meanings of “tier” in the codebase.

docs/contributing/tier-conventions.md

adaptive-agent-selection.mdConnect routing safeguards to the adaptive-selection problem +1/-1

Connect routing safeguards to the adaptive-selection problem

• Marks model and effort selection as partially decided by ADR 0112 while retaining learned routing as an open question.

docs/problems/adaptive-agent-selection.md

operational-observability.mdDocument planned routing telemetry +1/-1

Document planned routing telemetry

• Notes the ADR’s proposed root-span record of matching overlays, routed values, and higher-precedence overrides.

docs/problems/operational-observability.md

@rh-hemartin

Copy link
Copy Markdown
Member

I'm not doing review because I think we need first to agree in the form and content before going into the finer details.

@tpouyer
tpouyer force-pushed the routing-overlays-adr branch from 44b7257 to eee2693 Compare October 1, 2026 16:19
tpouyer added a commit to tpouyer/fullsend that referenced this pull request Oct 1, 2026
Rework ADR 0112 after review on fullsend-ai#7842: instead of a routing-specific
mechanism, overlays become general enough that per-task routing needs
nothing of its own.

- ADR 0112: overlays may set any harness field except base, trigger,
  overlays, slug and the deprecated forge. Every field except the
  routing fields is guarded: an overlay that sets one may read only
  runtime.forge, config (from the trusted ref) and the event and
  ADR 0098 entity fields the spec lists as trusted.
  Their when: expressions gain runtime.attempt, and every run records
  an overlay resolution trace.
- ADR 0130: a harness may declare the models and efforts it supports.
  The resolved model and effort, and persona models on runtimes that
  resolve them, must be on the list; overlays may only narrow it, and a
  child inherits it unless it declares its own. The list order is the
  fallback chain for the agent and its personas. This replaces the
  model catalog, tiers and floor.
- ADR 0131: a harness may set persona models in a subagents: map,
  ranked below the repo's subagents entry and above persona frontmatter.
  Unmatched harness keys are ignored and traced, not fatal.
- Normalized event v1: add optional state.change_proposal.diff and
  linked_work_items, and list the trusted fields; every other field is
  untrusted by default.

Add dated notes to ADR 0088, ADR 0091 and ADR 0104, annotate the
security-threat-model.md cost-routing question, and update
architecture.md and the adaptive-agent-selection.md and
operational-observability.md open questions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
@tpouyer tpouyer changed the title docs(adr): route model and effort per task through harness overlays docs(adr): let overlays set any harness field and route models Oct 1, 2026
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Site preview

Preview: https://af2074ba-site.fullsend-ai.workers.dev

Commit: dd1b4f6048683636e77454a1cafc78d5cb750b29

@codecov

codecov Bot commented Oct 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jflowers jflowers added the ok-to-test Allow e2e CI to run after maintainer review (must be re-applied after each push) label Oct 5, 2026
@github-actions github-actions Bot removed the ok-to-test Allow e2e CI to run after maintainer review (must be re-applied after each push) label Oct 5, 2026
tpouyer added a commit to tpouyer/fullsend that referenced this pull request Oct 5, 2026
Rework ADR 0112 after review on fullsend-ai#7842: instead of a routing-specific
mechanism, overlays become general enough that per-task routing needs
nothing of its own.

- ADR 0112: overlays may set any harness field except base, trigger,
  overlays, slug, role and the deprecated forge. Every field except
  model, effort, description and doc is guarded: an overlay that sets
  one may read only runtime.forge, config (from the trusted ref) and
  the event and ADR 0098 entity fields the spec lists as trusted.
  Every run records an overlay resolution trace in the plan output and
  a dedicated span. 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.
  Persona-model routing and LLM-based routing are deferred.
- Normalized event v1: add optional state.change_proposal.diff and
  linked_work_items (for routing, not yet populated, with path and key
  patterns), and list the trusted fields; every other field is
  untrusted by default.

Add a dated note to ADR 0088 and a forward note to harness-fields.md,
annotate the security-threat-model.md cost-routing question, and
update architecture.md and the adaptive-agent-selection.md open
question.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
@tpouyer
tpouyer force-pushed the routing-overlays-adr branch from 14ba2da to 5c15140 Compare October 5, 2026 19:36
@jflowers jflowers added the ok-to-test Allow e2e CI to run after maintainer review (must be re-applied after each push) label Oct 5, 2026
@github-actions github-actions Bot removed the ok-to-test Allow e2e CI to run after maintainer review (must be re-applied after each push) label Oct 5, 2026
@waynesun09 waynesun09 added the ok-to-test Allow e2e CI to run after maintainer review (must be re-applied after each push) label Oct 5, 2026
tpouyer added a commit to tpouyer/fullsend that referenced this pull request Oct 5, 2026
Rework ADR 0112 after review on fullsend-ai#7842: instead of a routing-specific
mechanism, overlays become general enough that per-task routing needs
nothing of its own.

- ADR 0112: overlays may set any harness field except base, trigger,
  overlays, slug, role and the deprecated forge. Every field except
  model, effort, description and doc is guarded: an overlay that sets
  one may read only runtime.forge, config (from the trusted ref) and
  the event and ADR 0098 entity fields the spec lists as trusted.
  Every run records an overlay resolution trace in the plan output and
  a dedicated span. 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.
  Persona-model routing and LLM-based routing are deferred.
- Normalized event v1: add optional state.change_proposal.diff and
  linked_work_items (for routing, not yet populated, with path and key
  patterns), and list the trusted fields; every other field is
  untrusted by default.

Add a dated note to ADR 0088 and a forward note to harness-fields.md,
annotate the security-threat-model.md cost-routing question, and
update architecture.md and the adaptive-agent-selection.md open
question.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
@tpouyer
tpouyer force-pushed the routing-overlays-adr branch from 5c15140 to b1aac83 Compare October 5, 2026 20:30

@ralphbean ralphbean left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We talked this over some in slack. I think the guarded fields topic as it is currently written is difficult to understand. Cleaning that and trimming that can make the meaning, limitations, and consequences of the guarded fields more clear.

Rework ADR 0112 after review on fullsend-ai#7842: instead of a routing-specific
mechanism, overlays become general enough that per-task routing needs
nothing of its own.

- ADR 0112: overlays may set any harness field except base, trigger,
  overlays, slug, role and the deprecated forge. Every field except
  model, effort, description and doc is guarded: an overlay that sets
  one may read only runtime.forge, config (from the trusted ref) and
  the event and ADR 0098 entity fields the spec lists as trusted.
  Every run records an overlay resolution trace in the plan output and
  a dedicated span. 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.
  Persona-model routing and LLM-based routing are deferred.
- Normalized event v1: add optional state.change_proposal.diff and
  linked_work_items (for routing, not yet populated, with path and key
  patterns), and list the trusted fields; every other field is
  untrusted by default.

Add a dated note to ADR 0088 and a forward note to harness-fields.md,
annotate the security-threat-model.md cost-routing question, and
update architecture.md and the adaptive-agent-selection.md open
question.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
@tpouyer
tpouyer force-pushed the routing-overlays-adr branch from b1aac83 to dd1b4f6 Compare October 5, 2026 22:11
@github-actions github-actions Bot removed the ok-to-test Allow e2e CI to run after maintainer review (must be re-applied after each push) label Oct 5, 2026
@rh-hemartin

Copy link
Copy Markdown
Member

Now that the security aspect is more explicit and descriptive, why do we care about that?

For example, we didn't talk about the key skills, why an overlay for a review agent that matches only docs can't load a skill for docs reviews on that overlay?

overlays:
- when: change_propoposal.diffs.any(starswith("docs"))
  skills:
  - review-subagent-documentation

As per the ADR if you inspect the diffs in the overlay with a CEL expression, you can't set env variables or the image. Why the limitation? Is there really a security benefit? Wouldn't the case of the skill overlay force someone to start a new harness?

# Given that we can't set skills when inspecting diffs, start a new agent
# just for the documentation review.
trigger: change_proposal.diffs.any(startswith("docs"))
skill:
- review-subagent-documentation

Or to modify their skills, increasing their context?

# skills/review/SKILL.md
Trigger the `review-subagent-documentation` SKILL within a subagent if the set of changes you are inspecting
contain any changes on the files at docs (`docs/*`).

@rh-hemartin rh-hemartin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't see very clearly the cases for the security part, looks like a cumbersome restriction to me as user, but I trust you folks.

@rh-hemartin rh-hemartin added the ok-to-test Allow e2e CI to run after maintainer review (must be re-applied after each push) label Oct 6, 2026

@ifireball ifireball left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Well those trusted fields and guarded fields concepts are a wrinkle I wasn't expecting... But seems to make sense...

@tpouyer

tpouyer commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks @rh-hemartin , that's a fair push. The guard is really aimed at the fields that change what the agent is allowed to do: policy, the token it gets (privilege_levels), env and providers (secrets), the security scans, network access and the image. For those, letting the PR author pick the branch by shaping their change is a real problem, like keeping a change in docs/ to get a looser policy or a skipped scan.

I think you're right that skills sits more on the "how well" side, like model and effort. Every skill in the harness is reviewed, so routing to a docs skill just picks between reviewed behaviours, and like you said the workarounds (a separate harness on trigger, or putting it in the skill prompt) give the author the same steering anyway. The one thing I'd want to be sure of first is that a skill can't widen what the agent can do, since skills can ship scripts.

So I'd rather not change the list after everyone's approved, and keep everything guarded by default for now. When we implement this we can look at moving skills to the unguarded list once we've confirmed skills can't widen tools or permissions. Does that work for you, or would you rather I add it here?

@ralphbean

Copy link
Copy Markdown
Member

3

@ralphbean

Copy link
Copy Markdown
Member

2

@ralphbean

Copy link
Copy Markdown
Member

1

@ralphbean
ralphbean added this pull request to the merge queue Oct 6, 2026
Merged via the queue into fullsend-ai:main with commit ea66a0a Oct 6, 2026
77 checks passed
@tpouyer
tpouyer deleted the routing-overlays-adr branch October 6, 2026 14:08

This branch was successfully deployed

1 active and 1 inactive deployments
dev — dd1b4f60 Deployed Oct 6, 2026 by rh-hemartin via run / playback #4098
site-preview — dd1b4f60 Deployed Oct 6, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Allow e2e CI to run after maintainer review (must be re-applied after each push) type/adr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants