Skip to content
Merged
4 changes: 4 additions & 0 deletions docs/ADRs/0161-repo-config-limits-run-artifact-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ The rest of ADR 0021 stands: full transcripts by default, and credential
scanning as an invariant check. Per-agent levels and artifact retention are
out of scope.

Journal commits are outside this ADR's run-artifact filtering scope. Their
access and evidence-retention requirements are defined in
[ADR 0165](0165-recover-work-through-repository-owned-operation-journals.md).

## Forge scope

- **GitHub:** the existing upload step uploads the staged copy and skips the
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
---
title: "165. Primitives for repository-owned operation journals"
status: Accepted
relates_to:
- durable-work-recovery
- agent-architecture
- agent-infrastructure
topics:
- coordination
- recovery
---

# 165. Primitives for repository-owned operation journals

Date: 2026-11-10

## Status

Accepted

## Context

Per-subject serialization ([ADR 0106](0106-serialize-agent-runs-and-coalesce-subsequent-events.md))
and occurrence-aware poll state
([ADR 0132](0132-occurrence-aware-shared-poller-state.md)) reduce duplicate
dispatch. They do not reserve an operation across scheduling, worker failure
and external publication. Runtime workflow packaging in
[#8225](https://github.com/fullsend-ai/fullsend/pull/8225) addresses another
boundary: delivering a sequence to an agent runtime.

[Durable work recovery](../problems/durable-work-recovery.md) describes the
failure cases. Workflows such as CVE resolution need durable state to track
required work, continue after interruption and retain evidence within bounded
retries. This ADR aims to keep admitted work recoverable across hosts without
making a model or a central daemon the coordination authority.

## Options

Integration-owned databases offer flexibility but repeat the same recovery
controls. A mandatory workflow service adds an operated dependency. A
repository-owned journal reuses forge state and existing schedulers, at the
cost of conditional writes and explicit reconciliation.
Comment thread
ascerra marked this conversation as resolved.
Resolved

An opt-in local stage engine can retain accepted stage outputs and enforce
ordering without a mandatory service. It may complement the journal, but
cross-host recovery also requires state transfer, ownership fencing and
reconciliation of external actions. Stage progress alone does not provide
those guarantees, so it does not replace the journal for this decision.

## Decision

Fullsend adopts a durable saga journal stored as versioned JSON files in a
control repository. This repository holds recovery state and may be separate
from the repositories where agent runs execute and source code lives. A saga
records progress across separate external actions and recovers individual
steps without claiming an atomic transaction across services. It covers
admission, target resolution, dispatch, execution, publication and accounting
for every required target, including multiple branches. Each participating
workflow supplies a trusted host adapter: integration code that claims
admitted work, dispatches attempts and returns to reconcile unfinished
operations. The journal stores and checks transitions; it does not drive the
workflow itself. Domain dispatch and assessment semantics remain in these
adapters. This ADR defines their recovery contract, not their implementation
or packaging.

The journal retains stable operation identities, input bindings, work bounds,
effect intents and separate scheduling, execution and publication receipts.
Comment thread
ascerra marked this conversation as resolved.
Resolved
Execution receipts retain recovery state and references to runs and available
traces; detailed execution history remains in run telemetry. The journal
determines what work needs recovery, while telemetry records what happened
within a run. Correlation mechanisms remain an implementation choice.
Conditional updates, integrity checks and ownership fencing prevent competing
or superseded workers from accepting results or admitting new effects. An
external request admitted before ownership loss remains in-flight until its
outcome is reconciled. Ownership expiry, supersession or result acceptance
does not release a running attempt's concurrency reservation. Release requires
reconciled scheduler termination.

Trusted host adapters persist intent before external actions and confirm
receipts after verified acceptance. They reconcile ambiguous outcomes before
retrying; an empty eventually consistent search does not prove a write failed.
Comment thread
ascerra marked this conversation as resolved.
Resolved
Retained validated evidence permits publication recovery without repeating
inference, subject to current source, authorization and policy checks. Missing,
exhausted or unresolved targets remain visible and cannot imply completion.
Domain adapters define completion and any compensating actions.

Journal-backed recovery is an explicit workflow opt-in. Workflows installed by
fullsend require explicit integration to use these primitives. Participating
workflows connect their pre/post scripts and agent or harness contracts to
trusted host adapters and reconcilers. Existing webhook and poll dispatch
paths do not automatically journal every run; their selection and dispatch behavior
remains unchanged unless explicitly integrated. Once a workflow admits work to
the journal, the recovery contract covers all its required targets and effects.

Shared journal operations are callable by authorized host scripts and
reconcilers. Running as a pre/post script does not itself grant journal
access. Incremental checkpoints and periodic reconciliation provide recovery
when execution stops. CI cleanup supplies a best-effort checkpoint; it is not
the recovery guarantee. This is a deterministic host capability, not a
coordinator agent.

Only authorized trusted host code writes the journal. Assessment runs,
including their pre/post scripts and agent sandboxes, receive admitted context
without journal-write credentials. A trusted host adapter outside that run
claims work and records its results. Journal state contains bounded
identities, digests and receipts. Workflow integrators must ensure journal
contents and retained evidence are accessible only to readers authorized for
that data; journal storage may use a separate private repository. The run-artifact filters
in [ADR 0161](0161-repo-config-limits-run-artifact-content.md) limit uploaded
logs and transcripts; they do not filter journal commits. With artifact levels of
`metadata` or `none`, evidence needed for recovery requires a separate store
permitted by the source's disclosure and retention policies. Its location and
access controls are integration choices. Journal contents grant no authority,
and integrity failure stops scheduling and publication rather than resetting
state and repeating work.

## Entity state and journal state

[ADR 0098](0098-entity-first-harness-evaluation.md) and
[ADR 0144](0144-reuse-poll-and-entity-bound-run-processes.md) retain business and
handled state on the entity. Trackers hold applicability, human workflow status
and assessment handoffs. Entity-first discovery must still find eligible work
whose trigger was lost before admission; a journal cannot recover unrecorded work.

The journal records mechanical progress of admitted work. It adds no separate
business handled-state or revision-deduplication gate. Existing actor, entity,
disclosure and repository checks remain authoritative. Journal storage does
not require one tracker per branch; tracker-first dispatch is a domain decision
tracked separately in [#9260](https://github.com/fullsend-ai/fullsend/issues/9260).
Comment thread
ascerra marked this conversation as resolved.
Resolved

## Forge scope

Execution host, journal storage, source forge and tracker are independent
bindings. The initial journal backend is the GitLab control repository, which
can coordinate GitHub, GitLab or Forgejo source repositories and Jira trackers.
Source repositories need no journal or journal-write credential.

The same journal contract applies to GitHub and Forgejo control repositories;
their storage adapters require conformance before enablement. Source and
publication adapters retain their own authorization and enablement requirements.
Jira issue properties do not satisfy the journal's conditional-update contract.

## Consequences

- The full saga can recover individual branches and external effects without
keeping a host or model session alive.
- Control-repository history makes state inspectable and avoids a mandatory
central service, at the cost of commit volume, retention and compaction.
- Conditional updates, ownership fencing and ambiguous-effect reconciliation
require backend conformance; delivery is not claimed to be exactly once.
- Shared script operations and periodic reconciliation are both required.
Assessment runs retain their existing source-access boundaries.
- Tracker-state reconciliation and publish-only retry can ship independently
without narrowing the saga's scope.

Implementation layout, script interfaces, credentials, reconciliation schedules
and detailed acceptance tests belong to
[#9253](https://github.com/fullsend-ai/fullsend/issues/9253). This ADR records
the decision; the journal capability is not yet implemented.
20 changes: 18 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,16 @@ The existing design principle is that [the repo is the coordinator](problems/age
[#8418](https://github.com/fullsend-ai/fullsend/issues/8418) and
[#8421](https://github.com/fullsend-ai/fullsend/issues/8421).

- Decided, not yet implemented: a saga journal stores versioned JSON in the
control repository, initially on GitLab, independently of the source forge
and tracker. Workflow-supplied trusted host adapters claim work and reconcile
it on subsequent invocations. They retain separate dispatch, execution and
publication receipts for each target.
Conditional updates and ownership generations support cross-host recovery;
CI finalization provides only a best-effort checkpoint. Domain adapters
retain operation, completion and compensation semantics
([ADR 0165](ADRs/0165-recover-work-through-repository-owned-operation-journals.md)).

**Open questions:**

- What provider query plans can support entity-first evaluation over the
Expand All @@ -662,12 +672,18 @@ The existing design principle is that [the repo is the coordinator](problems/age
- Is GitHub's event system sufficient for forge-native duplicate protection, or
do we need additional coordination beyond label/state conventions and agent
idempotency? (Jira polling per ADR 0063 uses entity-property locks and runner
lock refresh; ADR 0098 does not resolve this question.)
lock refresh; ADR 0165 chooses an operation journal for recoverable effects,
while adapter implementation and external-system guarantees remain open.)
- How does work assignment interact with the backlog/priority agent described in [agent-architecture.md](problems/agent-architecture.md)?
- How should explicit cancellation, retry, and reassignment interact with the
automatic event-coalescing policy in
[ADR 0106](ADRs/0106-serialize-agent-runs-and-coalesce-subsequent-events.md)?
- Does the coordinator need state (a queue, a lock, a claim system), or can it be stateless and event-driven?
- Does the coordinator need state (a queue, a lock, a claim system), or can it
be stateless and event-driven? (ADR 0165 requires durable claims for workflows
that opt in. Adapter implementation and packaging remain open in
[#9253](https://github.com/fullsend-ai/fullsend/issues/9253) and the
tracker-first integration in
[#9260](https://github.com/fullsend-ai/fullsend/issues/9260).)
- When should a conversation or thread be linked to a work item (e.g. Discussion
→ issue) so a conversation-native agent can hand off to `/fs-code` without
violating entity-context separation ([ADR 0076](ADRs/0076-slash-command-entity-context-separation.md),
Expand Down
6 changes: 6 additions & 0 deletions docs/problems/agent-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ This principle aligns with what Yegge's Gas City project calls "Zero Framework C

[OpenAI Symphony](../landscape.md#openai-symphony) is the other useful contrast: a long-running central daemon that owns scheduling state, candidate selection, and retry. Where Gas City puts a controller on the path but forbids it from containing judgment, Symphony's orchestrator visibly contains it (priority sort, blocker rules, reconciliation). Fullsend can borrow Symphony's workspace safety invariants and continuation-turn semantics without adopting the daemon.

Cross-host scheduling and partial external writes need deterministic recovery
without adding a coordinator agent; see
[durable work recovery](durable-work-recovery.md).
[ADR 0165](../ADRs/0165-recover-work-through-repository-owned-operation-journals.md)
chooses repository-owned operation journals; implementation remains open.

### How agents communicate

Agents interact through GitHub's existing mechanisms:
Expand Down
6 changes: 6 additions & 0 deletions docs/problems/agent-infrastructure.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ Many fullsend scenarios skew toward **ephemeral, task-scoped** execution (triage
- **Governance** — Policy may be applied at runtime by agents reading from a policy repo; infrastructure determines where that runtime runs and how it accesses policy.
- **Repo readiness** — Repos need reliable CI and signals; agent infrastructure may consume or depend on the same CI (e.g. for “run tests” or “run linters”) and should not conflict with it. Headless runtimes amplify **feedback latency** and **workspace handoff** costs when CI is the only execution path.

Restarting workers also needs durable ownership and reconciliation of external
effects; see [durable work recovery](durable-work-recovery.md).
[ADR 0165](../ADRs/0165-recover-work-through-repository-owned-operation-journals.md)
chooses repository-owned journals and short-lived reconcilers; backend
implementation and operational acceptance remain open.

## Open questions

- What is the right level of isolation per agent (process, container, microVM, separate cluster)?
Expand Down
5 changes: 5 additions & 0 deletions docs/problems/cross-run-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ These splits suggest that "memory" may not be one feature. It may be several fee

Cross-run memory is one piece of a broader question: what happens when an agent fails? The memory problem asks how agents learn from prior failures. The recovery problem asks what the system does immediately after a failure, before any learning occurs.

Recovering scheduling ownership and ambiguous external writes is a separate
mechanical problem; see [durable work recovery](durable-work-recovery.md).
Its operation journal retains attempts and work bounds without deciding
whether another model approach is likely to succeed.

### Retry vs. escalate

When a run fails (CI failure, merge conflict, model refusal, timeout), the system must decide: retry the same approach, try a different approach, or escalate to a human. Execution limits bound how much work can occur, but reaching a limit does not establish whether another attempt is likely to produce a different outcome.
Expand Down
Loading
Loading