diff --git a/docs/ADRs/0167-use-tracker-first-dispatch.md b/docs/ADRs/0167-use-tracker-first-dispatch.md new file mode 100644 index 0000000000..95628a187b --- /dev/null +++ b/docs/ADRs/0167-use-tracker-first-dispatch.md @@ -0,0 +1,109 @@ +--- +title: "167. Use tracker-first dispatch for multiple targets" +status: Accepted +relates_to: + - multi-target-execution + - agent-architecture + - agent-infrastructure +topics: + - dispatch + - coordination + - authorization +--- + +# 167. Use tracker-first dispatch for multiple targets + +Date: 2026-11-10 + +## Status + +Accepted + +## Context + +[ADR 0061](0061-harness-cel-dispatch.md) dispatches eligible harnesses, while +[ADR 0063](0063-polling-based-work-discovery.md) integrates Jira work items. +[ADR 0106](0106-serialize-agent-runs-and-coalesce-subsequent-events.md) +serializes work for a harness and subject. A request spanning several source +branches needs independent target identities and complete accounting, but +that does not require a new multi-target execution interface in the runner. + +[Multi-target execution](../problems/multi-target-execution.md) compares the +integration choices. Durable scheduling and publication recovery are tracked +separately in [#9253](https://github.com/fullsend-ai/fullsend/issues/9253). +This ADR aims to assess multiple authorized branches by reusing ordinary +single-target triage with visible work tracking for every branch. + +## Options + +A native Fullsend target-plan interface could enforce a reusable multi-target +contract, but requires broader platform implementation. A CI matrix launches +jobs without supplying target discovery, durable accounting or tracker +reconciliation. An adapter can instead create target-specific trackers first +and reuse existing single-target dispatch and triage, accepting additional +investigation tickets before applicability is known. + +## Decision + +Use tracker-first dispatch to assess each authorized source target through an +ordinary single-target Fullsend triage run. + +A trusted workflow adapter resolves a bounded manifest of maintained targets +from reviewed domain mappings. It records the manifest revision, source and +policy identities, required targets and persistent dispatch/retry bounds in +the recovery journal. After current disclosure and target/action authorization +checks, it creates or reuses one investigation tracker per target. The initial +adapter uses Jira. Tracker identity combines the domain case and stable target +identity, such as repository, branch, component and product release; a new +source SHA identifies an attempt rather than a new ticket. Each ticket starts +with applicability unknown, not an affected verdict. A discovery assessment +is not a prerequisite for creating it. + +The adapter populates the supported single-target intake from trusted mapping +and advisory data, then schedules triage through an authorized dispatch path. +A bot comment cannot impersonate a human command or bypass the harness actor +minimum. If no supported path can authorize triage, the tracker remains +visibly pending authorization. Each run verifies its actual origin, branch +and source revision against the selected intake; a release target must not +silently fall back to the default branch. The run owns its checkout, context, +case artifacts and fresh assessment receipt. Distinct target trackers provide +separate subjects for existing concurrency controls; the adapter also enforces +case-wide bounds over scheduled and running attempts until their termination +is reconciled. + +The adapter retains separate receipts for tracker publication, scheduling and +triage outcome, using the recovery work in #9253 for duplicate prevention, +ownership and ambiguous writes. Worker errors and uncertain or failed +assessments remain attached to the same investigation ticket for retry or +human action. They never become an affected finding or coding permission. +Ticket creation is a publication milestone, not successful assessment or case +completion. Every required target remains accounted for, including blocked, +unmapped, unscheduled or exhausted work; domain policy determines completion. + +Changed mappings, source or policy invalidate dependent attempts and require +fresh source binding and triage. New required branches extend the manifest +and reopen accounting; existing target trackers are reused and consumed work +bounds do not silently reset. Domain mapping, Jira rendering and aggregate +accounting remain in the workflow adapter. This initial route introduces no +native Fullsend multi-target scheduler or plan/result API. Later platform +support remains an option if independently justified by other consumers. + +## Forge scope + +The initial tracker adapter uses Jira for GitHub, GitLab and Forgejo source +targets. Each enabled single-target execution path must verify source binding +and authorization for its forge; unsupported combinations stay blocked. +Distinct Jira tickets do not grant source-repository access. Other tracker +systems require an adapter with equivalent identity and recovery behavior. + +## Consequences + +- Existing single-target dispatch and triage remain the worker interface. +- Investigation tickets become visible before applicability is known, + including targets later found not affected. +- The workflow adapter owns branch discovery, case-wide bounds, accounting + and tracker reconciliation, with durable recovery still required. +- Branch tickets isolate existing per-subject concurrency, but their creation + cannot establish complete target coverage or successful triage. +- Coding, merge and issue closure retain their existing authorization gates; + tracker-first dispatch grants none of those actions. diff --git a/docs/architecture.md b/docs/architecture.md index b23239a26e..db5683ad76 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -609,6 +609,13 @@ The existing design principle is that [the repo is the coordinator](problems/age [ADR 0151](ADRs/0151-harness-human-role-minimums.md), [Authorization Contract v2](normative/authorization/v2/)). +- Decided, not yet implemented: tracker-first dispatch creates or reuses one + investigation tracker per authorized source target before running ordinary + single-target triage. A workflow adapter owns discovery, durable recovery, + case-wide bounds and complete target accounting; the initial route adds no + native multi-target runner interface + ([ADR 0167](ADRs/0167-use-tracker-first-dispatch.md)). + - Entity-source discovery (target state): `fullsend poll` combines admissible harness queries into one logical candidate search per source scope and routes possible matches locally. A bound `run` rechecks source-query membership diff --git a/docs/problems/agent-architecture.md b/docs/problems/agent-architecture.md index 80d7f4d206..859ea8d333 100644 --- a/docs/problems/agent-architecture.md +++ b/docs/problems/agent-architecture.md @@ -172,6 +172,12 @@ No agent orchestrates other agents. Each agent independently observes the state The "coordination logic" is the repository's branch protection configuration — not an LLM making judgment calls about when to proceed. +A request that spans several source targets needs an explicit coverage and +isolation boundary; see [multi-target execution](multi-target-execution.md). +[ADR 0167](../ADRs/0167-use-tracker-first-dispatch.md) chooses one target +tracker before ordinary triage, preserving independent worker roles while an +adapter retains case-wide coordination. + This principle aligns with what Yegge's Gas City project calls "Zero Framework Cognition" (ZFC): the orchestration layer should handle mechanics only, while all judgment is deferred to the LLM via prompts. Gas City enforces this with a testable invariant — "does any line of Go contain a judgment call? If yes, it's a violation" — and extends it with the Bitter Lesson test: anything a smarter model would handle better from the prompt doesn't belong in the framework. (See [landscape.md](../landscape.md#gas-town--gas-city).) Fullsend's repo-as-coordinator model naturally satisfies ZFC: branch protection rules, CODEOWNERS, and status checks are deterministic infrastructure. The judgment happens in the review and implementation agents, mediated through GitHub's existing mechanisms. Note the architectural distinction: Gas City *does* have a controller process (reconciliation, health patrol), but enforces that it contain zero cognition. Fullsend's model goes further by eliminating the controller entirely and using the forge's native mechanisms instead. [Forge-sdlc/forge](../landscape.md#forge-sdlcforge) is the useful contrast case. It uses an event-driven FastAPI/Redis/LangGraph worker and durable checkpoints to move work forward, which is operationally sensible, but it also centralizes workflow truth and treats Jira labels/comments as approval signals. Fullsend can borrow the event-driven resume mechanics without moving merge authority or intent authorization out of repository-visible controls. diff --git a/docs/problems/agent-infrastructure.md b/docs/problems/agent-infrastructure.md index ef5cfc305d..c3d96ad11f 100644 --- a/docs/problems/agent-infrastructure.md +++ b/docs/problems/agent-infrastructure.md @@ -93,6 +93,13 @@ Agents are often discussed as if they run on a developer workstation: fast local ACP may still be useful for **narrow experiments** where those constraints are acceptable; it does not, by itself, deliver the isolation depth, supply-chain posture, or “agent as first-class workload with the right capabilities” that we are trying to reach here. +Independent source targets also need isolated contexts and target-aware +scheduling keys. [Multi-target execution](multi-target-execution.md) explores +that boundary; +[ADR 0167](../ADRs/0167-use-tracker-first-dispatch.md) chooses target-specific +trackers and existing single-target triage; an adapter retains case-wide bounds +and recovery rather than requiring a native multi-target scheduler. + ## Hybrid and incremental options - **Thin orchestration layer** — We build a small layer that triggers agents, gathers results, and posts status checks; the actual compute is 3rd party or internal. This keeps coordination logic in our control while deferring platform choice. diff --git a/docs/problems/multi-target-execution.md b/docs/problems/multi-target-execution.md new file mode 100644 index 0000000000..7c27a1789f --- /dev/null +++ b/docs/problems/multi-target-execution.md @@ -0,0 +1,86 @@ +--- +title: Multi-target execution +--- + +# Multi-target execution + +One request may require checking several repositories or maintained branches. +Launching several CI jobs does not define which targets are required, what +authorizes each action or whether every result has been collected. + +The [repository coordination model](agent-architecture.md#interaction-model-the-repo-as-coordinator) +keeps authority in repository-visible controls. The +[infrastructure discussion](agent-infrastructure.md) considers where workers +execute. Multiple targets need independent source and evidence identities, +without making branch discovery an authorization decision. + +## Failure cases + +- Two branches share one subject identity and collide under its concurrency + key, causing one branch's work to cancel or coalesce another's. +- A result from one branch is accepted for another because both name the same + package or advisory. +- Several targets succeed while one never starts, yet the request is reported + complete. +- Discovery finds a branch that the originating actor cannot authorize. +- A mapping change adds a required target while old workers still run. +- A ticket is created before its acknowledgement is retained, and retrying + creates another ticket for the same branch. +- Creating all tickets is mistaken for successful assessment, or a failed + worker is described as an affected finding. + +## Options and trade-offs + +### Tracker-first dispatch + +A trusted adapter creates or reuses one investigation ticket per authorized +source target, then invokes normal single-target triage. Existing workers and +per-subject concurrency remain reusable. Tickets become visible before an +applicability verdict, including targets later found not affected. The adapter +still owns complete discovery, case-wide bounds, recovery and aggregation. + +### Adapter-led workers before tracker creation + +An adapter can dispatch independent assessment workers and create tickets only +after collecting results. This reduces unnecessary investigation tickets, but +needs a pre-tracker source/result contract and still owns durable coordination. +An uncertain or failed worker needs an explicit investigation handoff. + +### Fullsend-native multi-target execution + +A host-admitted plan could give all consumers a reusable target, isolation and +collection contract. That requires a platform interface and conformance tests. +The value must justify its implementation rather than merely duplicating a +single consumer's adapter. + +### Handwritten CI matrices + +Matrices launch isolated jobs with familiar infrastructure. They do not supply +maintained-target mapping, cross-run recovery or complete coverage accounting. +They can implement execution underneath an adapter, rather than replace one. + +## Decision and acceptance + +[ADR 0167](../ADRs/0167-use-tracker-first-dispatch.md) chooses tracker-first +dispatch for the initial route. Durable recovery is a separate requirement +tracked in [#9253](https://github.com/fullsend-ai/fullsend/issues/9253). + +Acceptance must demonstrate create/reuse before assessment, one branch per +tracker, authorized single-target triage with exact source binding, and +independent subjects for branches sharing one originating case. Inject lost +Jira acknowledgements, dispatch failure, uncertain results and worker loss. +Recovery must reuse the existing ticket and keep applicability unknown until +triage establishes a supported finding. Add a required branch during an old +attempt and verify accounting reopens without duplicating existing tickets or +resetting consumed work bounds. A ticket's existence cannot imply triage ran, +all targets were discovered or remediation completed. + +## Open questions + +- Which supported dispatch path can authorize adapter-scheduled triage while + preserving the configured actor minimum and target permissions? +- Which existing single-target intake fields and checkout controls need an + adapter for each source forge? +- How should adapters expose incomplete or conflicting discovery coverage? +- How should target trackers record superseded attempts and operator retries + without losing earlier evidence or repeating ambiguous publications?