From 8671194a7bcd37a67cffab0c32be3b148dc53093 Mon Sep 17 00:00:00 2001 From: eshulman2 Date: Tue, 10 Nov 2026 12:06:47 +0200 Subject: [PATCH 1/9] docs(adr): define repository-owned recovery journals Signed-off-by: eshulman2 --- ...ugh-repository-owned-operation-journals.md | 102 ++++++++++++++++++ docs/architecture.md | 9 +- docs/problems/agent-architecture.md | 6 ++ docs/problems/agent-infrastructure.md | 6 ++ docs/problems/cross-run-memory.md | 5 + docs/problems/durable-work-recovery.md | 88 +++++++++++++++ docs/problems/operational-observability.md | 5 + 7 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md create mode 100644 docs/problems/durable-work-recovery.md diff --git a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md new file mode 100644 index 0000000000..159599b9be --- /dev/null +++ b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md @@ -0,0 +1,102 @@ +--- +title: "165. Recover work through repository-owned operation journals" +status: Accepted +relates_to: + - durable-work-recovery + - agent-architecture + - agent-infrastructure +topics: + - coordination + - recovery +--- + +# 165. Recover work through 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. 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. + +## Decision + +Fullsend adopts repository-owned operation journals to recover work across +dispatch, execution and publication. + +The trusted host records work before dispatch in repository-scoped forge +storage with integrity checks and compare-and-swap updates. The journal +retains stable operation identities and persistent work bounds. Multi-target +dispatch and collection are tracked separately in +[#9260](https://github.com/fullsend-ai/fullsend/issues/9260). Attempts retain +their own identity, source/input revisions and +scheduler/run identifiers. Scheduling acceptance, worker completion and each +publication effect have separate receipts. Loss of an acknowledgement leaves +recoverable pending work rather than advancing a completion checkpoint. + +Short-lived reconcilers use leases and monotonically increasing ownership +generations. Every result acceptance, state transition and publication +admission checks the current generation and plan. A timed-out or superseded +worker cannot authorize a new effect. A publication admitted before ownership +loss remains an in-flight effect to reconcile; expiry cannot revoke a request +already accepted by an external service. Remote writes remain in trusted host +adapters, outside worker sandboxes. + +Publication adapters persist intent before writing, use a stable external +operation marker, and reconcile ambiguous outcomes before retrying. An +eventually consistent search returning no match is not proof a create failed. +If the adapter cannot establish the outcome, it holds publication for operator +resolution. It can retry publication from retained validated evidence without +rerunning inference, subject to current authorization, source and policy. +Missing, exhausted or unresolved required children remain visible and cannot +imply completion. A configured domain adapter may request investigation after +failure, but cannot turn that request into a successful worker assessment. + +This is a deterministic host capability. It adds neither a coordinator agent +nor authority from journal contents. Existing actor, entity, disclosure and +repository gates still apply. Domain mapping, assessment semantics and ticket +rendering remain adapters. Journal records contain bounded identities, digests +and receipts, not raw private prompts or credentials. Artifact publication +policy still applies. Journal integrity failure stops scheduling and +publication; it does not silently reset state and repeat work. + +## Forge scope + +The contract applies to GitHub, GitLab and Forgejo target repositories. +Each backend must demonstrate conditional updates and the same recovery +tests before enablement. Initial implementation may enable GitHub alone; +GitLab and Forgejo remain disabled until their adapters conform. Jira may be +a source or publication destination; its unconditional issue-property writes +do not satisfy the journal's compare-and-swap requirement. + +## Consequences + +- Recovery can resume scheduling or publication without keeping a host or + model session alive. +- Existing forge storage and CI schedules remain the coordination substrate. +- Backend integrity, ownership and ambiguous-write tests become enablement + gates; delivery is not claimed to be exactly once. +- Adopters must define target identity and completion rules while Fullsend + enforces the shared recovery boundary. +- Journal layout, credentials, retention and adapter implementation require + follow-up work before this capability is available. diff --git a/docs/architecture.md b/docs/architecture.md index b23239a26e..34378bb25a 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -618,6 +618,12 @@ 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: repository-owned operation journals retain + separate dispatch, execution and publication receipts. Conditional state + updates and ownership generations support cross-host recovery while domain + adapters retain operation and completion 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 @@ -632,7 +638,8 @@ 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 diff --git a/docs/problems/agent-architecture.md b/docs/problems/agent-architecture.md index 80d7f4d206..6ac93af766 100644 --- a/docs/problems/agent-architecture.md +++ b/docs/problems/agent-architecture.md @@ -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: diff --git a/docs/problems/agent-infrastructure.md b/docs/problems/agent-infrastructure.md index ef5cfc305d..a0f66d41da 100644 --- a/docs/problems/agent-infrastructure.md +++ b/docs/problems/agent-infrastructure.md @@ -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)? diff --git a/docs/problems/cross-run-memory.md b/docs/problems/cross-run-memory.md index b3bbb803ce..fca00bda6d 100644 --- a/docs/problems/cross-run-memory.md +++ b/docs/problems/cross-run-memory.md @@ -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. diff --git a/docs/problems/durable-work-recovery.md b/docs/problems/durable-work-recovery.md new file mode 100644 index 0000000000..724fea2f77 --- /dev/null +++ b/docs/problems/durable-work-recovery.md @@ -0,0 +1,88 @@ +--- +title: Durable work recovery +--- + +# Durable work recovery + +A job can disappear after discovery, finish after its caller stops, or publish +an external change before its acknowledgement is saved. A successful model +invocation does not answer whether the requested work was scheduled, which +attempt owns it, or whether publication must be retried. + +The [repository coordination model](agent-architecture.md#interaction-model-the-repo-as-coordinator) +keeps authority in repository-visible controls. Recovery must preserve that +boundary. It needs deterministic bookkeeping, rather than an agent deciding +which other agents should run. The +[infrastructure discussion](agent-infrastructure.md) also separates execution +capacity from waiting for people or external systems. + +## Failure boundaries + +- A dispatcher stops after a remote scheduler accepts a request but before it + records the scheduler's run identifier. +- Two hosts discover the same operation while neither has reserved it. +- A worker's lease expires; its replacement starts while the old worker is + still running. +- A worker saves valid evidence, but its publication request times out after + the external system creates the issue or comment. +- One required child never returns while other children succeed. +- Source, authorization or a target plan changes while work is queued. + +Serialization for a harness and subject reduces overlap. It does not make +dispatch, execution and external writes one transaction. A source checkpoint +or the absence of a running CI job cannot prove completion. Operators need to +distinguish these conditions from ordinary agent failures; see +[operational observability](operational-observability.md#what-just-happened). + +Persistent attempt bounds supply recovery mechanics, while +[cross-run escalation](cross-run-memory.md#error-recovery-and-retry-mechanics) +also needs failure interpretation and policy. A journal does not decide whether +a different model strategy is likely to succeed. + +## Options and trade-offs + +### Let each integration own its recovery + +An adapter can maintain a database and reconcile its own jobs and external +effects. This is flexible and avoids a new platform contract. Each adapter +must also implement authorization rechecks, duplicate prevention, restart +handling and publication recovery. Guarantees can differ across workflows. + +### Extend repository-owned state + +A repository-scoped journal can use conditional forge writes and short-lived +reconcilers. Existing schedulers still run individual workers. This fits the +repository coordination model and avoids a required central service. It needs +explicit trust, retention, conflict, lease and external-effect protocols; +eventual-consistency searches cannot establish that an ambiguous write failed. + +### Delegate to a durable workflow service + +A service can supply timers, retries and ownership. It introduces another +operated component and trust boundary. Its scheduler guarantees still do not +make a remote issue creation atomic or authorize a retry after scope changes. + +## Decision and acceptance + +[ADR 0165](../ADRs/0165-recover-work-through-repository-owned-operation-journals.md) +chooses a repository-owned journal. Its implementation remains separate from +the decision. A local database test is not distributed acceptance. + +Fault tests must stop both sides of each handoff, overlap reconcilers, expire +ownership while a worker is still alive, and supersede a plan before +publication. A remote write that succeeded before its acknowledgement was +lost must be reconciled without rerunning inference or blindly repeating the +write. Every required target remains accounted for, including exhausted or +missing attempts. A domain adapter may publish an investigation request when +analysis fails; that request is not an assessment or permission to remediate. + +## Open questions + +- Which journal layout, signing rules, retention and compaction bounds meet + the conditional-write and integrity requirements on each forge? +- Which existing scheduler APIs can reconcile accepted-but-unacknowledged + requests by stable operation identity? +- Which publication adapters can safely prove a write absent, and which must + retain an ambiguous operation for human reconciliation? +- How should an operator repair corrupted or inaccessible state without + discarding accepted work or permitting stale workers to publish? diff --git a/docs/problems/operational-observability.md b/docs/problems/operational-observability.md index 20f61bd7df..9afb906e1c 100644 --- a/docs/problems/operational-observability.md +++ b/docs/problems/operational-observability.md @@ -47,6 +47,11 @@ When something goes wrong — a bad merge, a missed vulnerability, an unexpected This is the debugging use case. It requires structured traces of individual agent runs that can be correlated into end-to-end workflows. The trace is the unit of debugging — when something goes wrong, you pull the trace and read it. +A trace alone cannot establish whether an external write succeeded after its +acknowledgement was lost. [Durable work recovery](durable-work-recovery.md) +separates scheduling, execution and publication receipts so an operator can +identify which effect still needs reconciliation. + ### Is the system getting better or worse? Beyond individual incidents, operators need trend-level visibility: From b77dc71b1fa85c8aa0f247f3ab22758a5941c508 Mon Sep 17 00:00:00 2001 From: eshulman2 Date: Wed, 11 Nov 2026 16:53:59 +0200 Subject: [PATCH 2/9] docs(adr): place saga journal in the control repository Signed-off-by: eshulman2 --- ...ugh-repository-owned-operation-journals.md | 133 +++++++++++++++--- docs/architecture.md | 11 +- docs/problems/durable-work-recovery.md | 31 +++- 3 files changed, 144 insertions(+), 31 deletions(-) diff --git a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md index 159599b9be..fa332e11cf 100644 --- a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md +++ b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md @@ -41,11 +41,19 @@ cost of conditional writes and explicit reconciliation. ## Decision -Fullsend adopts repository-owned operation journals to recover work across -dispatch, execution and publication. - -The trusted host records work before dispatch in repository-scoped forge -storage with integrity checks and compare-and-swap updates. The journal +Fullsend adopts a durable saga journal stored as versioned JSON files in the +control repository. A saga records progress across separate external actions +and recovers each step without claiming one atomic transaction across services. +It covers admission, target resolution, dispatch, execution, publication and +accounting for every required target. Multi-branch assessment remains in scope. + +The initial deployment stores the journal in the GitLab control repository +that hosts Fullsend execution. That repository may assess and fix code hosted +on GitHub, GitLab or Forgejo, and publish findings to Jira. Source repositories +need no journal branch or journal-write credential. + +The trusted host records work before dispatch in the control repository, +with integrity checks and compare-and-swap updates. The journal retains stable operation identities and persistent work bounds. Multi-target dispatch and collection are tracked separately in [#9260](https://github.com/fullsend-ai/fullsend/issues/9260). Attempts retain @@ -80,23 +88,108 @@ and receipts, not raw private prompts or credentials. Artifact publication policy still applies. Journal integrity failure stops scheduling and publication; it does not silently reset state and repeat work. +## Storage and writer boundary + +Use a dedicated protected journal branch in the control repository, separate +from workflow configuration and source branches. Bounded, schema-versioned +JSON records identify the saga, required targets, plan and input digests, +attempts, ownership generations, effect intents and receipts. Large validated +outputs remain retained artifacts referenced by immutable identity and digest. +Journal commits must not recursively trigger ordinary agent pipelines. + +Only an explicitly authorized trusted host identity writes the journal. +Read-only assessment workers receive admitted context without journal-write +credentials. Source-read, code-publication and journal-write permissions are +separate; a source checkout does not grant control-repository access. The +implementation must define credential routing and protected-branch permissions +before enablement. GitLab writer selection must use the trusted registered-role +contract; an administrator may register a dedicated responsibility identity. +This decision does not expand the built-in Analyst role's repository-write +permissions. Editable tracker properties are not ownership authority. + +A state change commits against the exact journal revision read by the writer. +The backend must reject a competing update. On conflict, reload state and +re-evaluate ownership, inputs and the proposed transition. Automatically +merging JSON, force-pushing, or recreating a missing journal branch cannot +resolve an ownership conflict. The GitLab implementation must demonstrate +conditional updates of the complete transition and integrity under concurrent +writers. A per-file check alone is insufficient for a transition that changes +several records. GitHub and Forgejo storage adapters follow the same contract. + +## Script consumption and recovery + +Expose shared trusted journal operations to pre-scripts, post-scripts and +short-lived scheduled reconcilers. These operations claim work, record intent, +accept input-bound evidence and confirm an effect through the same ownership +and transition checks. Consumers can condition actions on durable saga state +without implementing separate lease or receipt rules in each script. These +are capability requirements, not existing CLI commands or harness fields. + +Persist an intent before each external action and its receipt after verified +acceptance. Retain validated worker evidence before publication. A later +invocation can retry publication without inference, subject to current inputs, +authorization and unresolved-effect checks. Independent publish-only recovery +can be delivered without waiting for the complete saga implementation. + +A CI finalizer, such as GitLab's `after_script`, makes a best-effort final +checkpoint from verified local evidence. It cannot promise a write after runner +loss, hard termination, timeout or journal outage. It must not mark an operation +complete merely because the job exited. Scheduled reconciliation reads pending +intents and receipts even when the finalizer never ran. Missing acknowledgements +remain unresolved until external acceptance can be established. + +Each required branch has independent attempts and receipts. A missing result, +exhausted retry or unresolved publication keeps that target visible. Domain +adapters define cancellation or compensating actions where appropriate, and +forward recovery where an external action cannot safely be undone. Recording a +compensation does not erase its original effect or authorize automatic issue +closure, deletion or code rollback. + +## 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) keep business and +handled state on the entity. Trackers retain applicability, human workflow +status and validated assessment handoffs. Entity-first discovery remains +responsible for finding eligible work, including a lost trigger that never +admitted an operation. A journal cannot recover work it never recorded. + +The journal records mechanical progress of admitted work: ownership, attempts, +step intents, input bindings and scheduling or publication receipts. It adds +no independent revision-deduplication or business handled-state gate. A bound +receipt must still pass the current entity and policy checks before use. +Tracker-first branch investigations and their assessment semantics remain the +multi-target adapter's decision; journal storage does not require one Jira +issue per journal record. + ## Forge scope -The contract applies to GitHub, GitLab and Forgejo target repositories. -Each backend must demonstrate conditional updates and the same recovery -tests before enablement. Initial implementation may enable GitHub alone; -GitLab and Forgejo remain disabled until their adapters conform. Jira may be -a source or publication destination; its unconditional issue-property writes -do not satisfy the journal's compare-and-swap requirement. +Execution host, journal storage, source forge and tracker are independent +bindings. The initial journal backend is the GitLab control repository; a +GitHub source repository or Jira tracker does not need a matching journal +backend. GitLab storage must pass the recovery acceptance tests before use. +GitHub and Forgejo control-repository storage remain disabled until their +adapters pass the same tests. Source and publication adapters retain their own +authorization and enablement requirements. + +The capability contract covers GitHub, GitLab and Forgejo without requiring +every deployment to use the source forge for storage. Jira may be a source or +publication destination. Its unconditional issue-property updates do not +satisfy this journal's compare-and-swap requirement. ## Consequences -- Recovery can resume scheduling or publication without keeping a host or - model session alive. -- Existing forge storage and CI schedules remain the coordination substrate. -- Backend integrity, ownership and ambiguous-write tests become enablement - gates; delivery is not claimed to be exactly once. -- Adopters must define target identity and completion rules while Fullsend - enforces the shared recovery boundary. -- Journal layout, credentials, retention and adapter implementation require - follow-up work before this capability is available. +- The full saga can recover individual branches and external effects without + keeping a host or model session alive. +- JSON history in the control repository supplies inspectable durable state; + it adds commit volume, retention and compaction responsibilities. +- A GitLab control repository can coordinate GitHub source and Jira trackers + without a journal in each source repository. +- Shared script operations and periodic reconciliation are both required; + best-effort finalization alone cannot provide crash recovery. +- Conditional updates, integrity, ownership and ambiguous-write tests are + enablement gates; delivery is not claimed to be exactly once. +- Domain adapters retain target identity, completion and compensation rules. + Tracker-state reconciliation and publish-only retry can ship independently. +- JSON layout, credential provisioning, retention and adapter implementation + require follow-up work before this capability is available. diff --git a/docs/architecture.md b/docs/architecture.md index 34378bb25a..c498b0758f 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -618,10 +618,13 @@ 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: repository-owned operation journals retain - separate dispatch, execution and publication receipts. Conditional state - updates and ownership generations support cross-host recovery while domain - adapters retain operation and completion semantics +- Decided, not yet implemented: a saga journal stores versioned JSON in the + control repository, initially on GitLab, independently of the source forge + and tracker. Shared pre/post-script operations and scheduled reconciliation + 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:** diff --git a/docs/problems/durable-work-recovery.md b/docs/problems/durable-work-recovery.md index 724fea2f77..567d255217 100644 --- a/docs/problems/durable-work-recovery.md +++ b/docs/problems/durable-work-recovery.md @@ -50,8 +50,9 @@ handling and publication recovery. Guarantees can differ across workflows. ### Extend repository-owned state -A repository-scoped journal can use conditional forge writes and short-lived -reconcilers. Existing schedulers still run individual workers. This fits the +A journal in a control repository can use versioned JSON files, conditional +forge writes and short-lived reconcilers. Storage need not share the forge of +the source code or tracker. Existing schedulers still run individual workers. This fits the repository coordination model and avoids a required central service. It needs explicit trust, retention, conflict, lease and external-effect protocols; eventual-consistency searches cannot establish that an ambiguous write failed. @@ -65,12 +66,24 @@ make a remote issue creation atomic or authorize a retry after scope changes. ## Decision and acceptance [ADR 0165](../ADRs/0165-recover-work-through-repository-owned-operation-journals.md) -chooses a repository-owned journal. Its implementation remains separate from -the decision. A local database test is not distributed acceptance. +chooses JSON journal files in the control repository, initially hosted on +GitLab. The journal covers the full saga and each required branch, while +source repositories and trackers can use other providers. Shared trusted +operations let pre/post scripts and scheduled reconcilers consume the same +state. CI finalization is a best-effort checkpoint, not the recovery guarantee. +Its implementation remains separate from the decision. A local database test is not distributed acceptance. + +Entity-first discovery must also find eligible work whose trigger was lost +before admission. Trackers retain business and handled state; the journal +records mechanical progress after admission. Publish-only retry from retained +validated evidence can be implemented independently of the complete journal. Fault tests must stop both sides of each handoff, overlap reconcilers, expire ownership while a worker is still alive, and supersede a plan before -publication. A remote write that succeeded before its acknowledgement was +publication. Kill a runner before its finalizer, interrupt journal writes and +race multi-record updates; only a valid conditional transition may win. A +GitLab control repository must demonstrate recovery with GitHub source and +Jira publication. Journal writes must not trigger recursive agent runs. A remote write that succeeded before its acknowledgement was lost must be reconciled without rerunning inference or blindly repeating the write. Every required target remains accounted for, including exhausted or missing attempts. A domain adapter may publish an investigation request when @@ -78,8 +91,12 @@ analysis fails; that request is not an assessment or permission to remediate. ## Open questions -- Which journal layout, signing rules, retention and compaction bounds meet - the conditional-write and integrity requirements on each forge? +- Which bounded JSON layout, integrity checks, retention and compaction rules + preserve history and conditional transitions in the control repository? +- Which trusted host identity writes the protected GitLab journal branch, and + how are its credentials kept separate from read-only assessment workers? +- Which shared script interface and reconciliation schedule expose the saga + without making CI finalizers a prerequisite for recovery? - Which existing scheduler APIs can reconcile accepted-but-unacknowledged requests by stable operation identity? - Which publication adapters can safely prove a write absent, and which must From e71d3fee2561d81954d7461ec79bcf9d88d68a39 Mon Sep 17 00:00:00 2001 From: eshulman2 Date: Wed, 11 Nov 2026 18:10:27 +0200 Subject: [PATCH 3/9] docs(adr): separate recovery decision from implementation detail Signed-off-by: eshulman2 --- ...ugh-repository-owned-operation-journals.md | 199 ++++++------------ 1 file changed, 62 insertions(+), 137 deletions(-) diff --git a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md index fa332e11cf..5fdc6ddfbf 100644 --- a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md +++ b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md @@ -43,153 +43,78 @@ cost of conditional writes and explicit reconciliation. Fullsend adopts a durable saga journal stored as versioned JSON files in the control repository. A saga records progress across separate external actions -and recovers each step without claiming one atomic transaction across services. -It covers admission, target resolution, dispatch, execution, publication and -accounting for every required target. Multi-branch assessment remains in scope. - -The initial deployment stores the journal in the GitLab control repository -that hosts Fullsend execution. That repository may assess and fix code hosted -on GitHub, GitLab or Forgejo, and publish findings to Jira. Source repositories -need no journal branch or journal-write credential. - -The trusted host records work before dispatch in the control repository, -with integrity checks and compare-and-swap updates. The journal -retains stable operation identities and persistent work bounds. Multi-target -dispatch and collection are tracked separately in -[#9260](https://github.com/fullsend-ai/fullsend/issues/9260). Attempts retain -their own identity, source/input revisions and -scheduler/run identifiers. Scheduling acceptance, worker completion and each -publication effect have separate receipts. Loss of an acknowledgement leaves -recoverable pending work rather than advancing a completion checkpoint. - -Short-lived reconcilers use leases and monotonically increasing ownership -generations. Every result acceptance, state transition and publication -admission checks the current generation and plan. A timed-out or superseded -worker cannot authorize a new effect. A publication admitted before ownership -loss remains an in-flight effect to reconcile; expiry cannot revoke a request -already accepted by an external service. Remote writes remain in trusted host -adapters, outside worker sandboxes. - -Publication adapters persist intent before writing, use a stable external -operation marker, and reconcile ambiguous outcomes before retrying. An -eventually consistent search returning no match is not proof a create failed. -If the adapter cannot establish the outcome, it holds publication for operator -resolution. It can retry publication from retained validated evidence without -rerunning inference, subject to current authorization, source and policy. -Missing, exhausted or unresolved required children remain visible and cannot -imply completion. A configured domain adapter may request investigation after -failure, but cannot turn that request into a successful worker assessment. - -This is a deterministic host capability. It adds neither a coordinator agent -nor authority from journal contents. Existing actor, entity, disclosure and -repository gates still apply. Domain mapping, assessment semantics and ticket -rendering remain adapters. Journal records contain bounded identities, digests -and receipts, not raw private prompts or credentials. Artifact publication -policy still applies. Journal integrity failure stops scheduling and -publication; it does not silently reset state and repeat work. - -## Storage and writer boundary - -Use a dedicated protected journal branch in the control repository, separate -from workflow configuration and source branches. Bounded, schema-versioned -JSON records identify the saga, required targets, plan and input digests, -attempts, ownership generations, effect intents and receipts. Large validated -outputs remain retained artifacts referenced by immutable identity and digest. -Journal commits must not recursively trigger ordinary agent pipelines. - -Only an explicitly authorized trusted host identity writes the journal. -Read-only assessment workers receive admitted context without journal-write -credentials. Source-read, code-publication and journal-write permissions are -separate; a source checkout does not grant control-repository access. The -implementation must define credential routing and protected-branch permissions -before enablement. GitLab writer selection must use the trusted registered-role -contract; an administrator may register a dedicated responsibility identity. -This decision does not expand the built-in Analyst role's repository-write -permissions. Editable tracker properties are not ownership authority. - -A state change commits against the exact journal revision read by the writer. -The backend must reject a competing update. On conflict, reload state and -re-evaluate ownership, inputs and the proposed transition. Automatically -merging JSON, force-pushing, or recreating a missing journal branch cannot -resolve an ownership conflict. The GitLab implementation must demonstrate -conditional updates of the complete transition and integrity under concurrent -writers. A per-file check alone is insufficient for a transition that changes -several records. GitHub and Forgejo storage adapters follow the same contract. - -## Script consumption and recovery - -Expose shared trusted journal operations to pre-scripts, post-scripts and -short-lived scheduled reconcilers. These operations claim work, record intent, -accept input-bound evidence and confirm an effect through the same ownership -and transition checks. Consumers can condition actions on durable saga state -without implementing separate lease or receipt rules in each script. These -are capability requirements, not existing CLI commands or harness fields. - -Persist an intent before each external action and its receipt after verified -acceptance. Retain validated worker evidence before publication. A later -invocation can retry publication without inference, subject to current inputs, -authorization and unresolved-effect checks. Independent publish-only recovery -can be delivered without waiting for the complete saga implementation. - -A CI finalizer, such as GitLab's `after_script`, makes a best-effort final -checkpoint from verified local evidence. It cannot promise a write after runner -loss, hard termination, timeout or journal outage. It must not mark an operation -complete merely because the job exited. Scheduled reconciliation reads pending -intents and receipts even when the finalizer never ran. Missing acknowledgements -remain unresolved until external acceptance can be established. - -Each required branch has independent attempts and receipts. A missing result, -exhausted retry or unresolved publication keeps that target visible. Domain -adapters define cancellation or compensating actions where appropriate, and -forward recovery where an external action cannot safely be undone. Recording a -compensation does not erase its original effect or authorize automatic issue -closure, deletion or code rollback. +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. Domain dispatch and assessment semantics remain in adapters. + +The journal retains stable operation identities, input bindings, work bounds, +effect intents and separate scheduling, execution and publication receipts. +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. + +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. +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. + +Shared trusted journal operations are consumable from pre/post scripts and +reconcilers. 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 workers +receive admitted context without journal-write credentials. Journal state +contains bounded identities, digests and receipts; artifact publication policy +still applies. 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) keep business and -handled state on the entity. Trackers retain applicability, human workflow -status and validated assessment handoffs. Entity-first discovery remains -responsible for finding eligible work, including a lost trigger that never -admitted an operation. A journal cannot recover work it never recorded. - -The journal records mechanical progress of admitted work: ownership, attempts, -step intents, input bindings and scheduling or publication receipts. It adds -no independent revision-deduplication or business handled-state gate. A bound -receipt must still pass the current entity and policy checks before use. -Tracker-first branch investigations and their assessment semantics remain the -multi-target adapter's decision; journal storage does not require one Jira -issue per journal record. +[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). ## Forge scope Execution host, journal storage, source forge and tracker are independent -bindings. The initial journal backend is the GitLab control repository; a -GitHub source repository or Jira tracker does not need a matching journal -backend. GitLab storage must pass the recovery acceptance tests before use. -GitHub and Forgejo control-repository storage remain disabled until their -adapters pass the same tests. Source and publication adapters retain their own -authorization and enablement requirements. - -The capability contract covers GitHub, GitLab and Forgejo without requiring -every deployment to use the source forge for storage. Jira may be a source or -publication destination. Its unconditional issue-property updates do not -satisfy this journal's compare-and-swap requirement. +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. -- JSON history in the control repository supplies inspectable durable state; - it adds commit volume, retention and compaction responsibilities. -- A GitLab control repository can coordinate GitHub source and Jira trackers - without a journal in each source repository. -- Shared script operations and periodic reconciliation are both required; - best-effort finalization alone cannot provide crash recovery. -- Conditional updates, integrity, ownership and ambiguous-write tests are - enablement gates; delivery is not claimed to be exactly once. -- Domain adapters retain target identity, completion and compensation rules. - Tracker-state reconciliation and publish-only retry can ship independently. -- JSON layout, credential provisioning, retention and adapter implementation - require follow-up work before this capability is available. +- 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 workers 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. From 7b5732ffb41c0a3cf20b7cf3ff0829e6e5afbcab Mon Sep 17 00:00:00 2001 From: eshulman2 Date: Sun, 15 Nov 2026 19:07:30 +0200 Subject: [PATCH 4/9] docs(adr): clarify durable continuation and work reservations Explain the need for durable work state in evidence-driven workflows with bounded retries. Retain concurrency reservations until scheduler termination is reconciled, including after ownership expiry or result acceptance. Signed-off-by: eshulman2 --- ...work-through-repository-owned-operation-journals.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md index 5fdc6ddfbf..e2353b02b3 100644 --- a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md +++ b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md @@ -29,8 +29,10 @@ and external publication. Runtime workflow packaging in boundary: delivering a sequence to an agent runtime. [Durable work recovery](../problems/durable-work-recovery.md) describes the -failure cases. This ADR aims to keep admitted work recoverable across hosts -without making a model or a central daemon the coordination authority. +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 @@ -53,7 +55,9 @@ effect intents and separate scheduling, execution and publication receipts. 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. +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 From 1f0a3b5f659a1d95f1665e162592d24b29600b21 Mon Sep 17 00:00:00 2001 From: eshulman2 Date: Mon, 16 Nov 2026 19:27:11 +0200 Subject: [PATCH 5/9] docs(adr): clarify workflow opt-in for journal recovery Separate explicit workflow integration from existing webhook and poll dispatch. Preserve the full recovery contract for journal-admitted work. Signed-off-by: eshulman2 --- ...ver-work-through-repository-owned-operation-journals.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md index e2353b02b3..758dbc371c 100644 --- a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md +++ b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md @@ -67,6 +67,13 @@ 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. Participating workflows +integrate trusted journal operations through their pre/post scripts, agent or +harness contracts, 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 trusted journal operations are consumable from pre/post scripts and reconcilers. Incremental checkpoints and periodic reconciliation provide recovery when execution stops. CI cleanup supplies a best-effort checkpoint; From ecc1f0702a5a06d47cf6b7fe939c7324d70dcb89 Mon Sep 17 00:00:00 2001 From: eshulman2 Date: Wed, 18 Nov 2026 09:41:58 +0200 Subject: [PATCH 6/9] docs(adr): clarify journal primitives scope Signed-off-by: eshulman2 --- ...k-through-repository-owned-operation-journals.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md index 758dbc371c..55627aea24 100644 --- a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md +++ b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md @@ -1,5 +1,5 @@ --- -title: "165. Recover work through repository-owned operation journals" +title: "165. Primitives for repository-owned operation journals" status: Accepted relates_to: - durable-work-recovery @@ -10,7 +10,7 @@ topics: - recovery --- -# 165. Recover work through repository-owned operation journals +# 165. Primitives for repository-owned operation journals Date: 2026-11-10 @@ -67,10 +67,11 @@ 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. Participating workflows -integrate trusted journal operations through their pre/post scripts, agent or -harness contracts, and reconcilers. Existing webhook and poll dispatch paths do -not automatically journal every run; their selection and dispatch behavior +Journal-backed recovery is an explicit workflow opt-in. Workflows installed by +fullsend require explicit integration to use these primitives. Participating +workflows integrate trusted journal operations through their pre/post scripts, +agent or harness contracts, 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. From e643e1bc614665a228fc40908e6fcc0e0beb1b5b Mon Sep 17 00:00:00 2001 From: eshulman2 Date: Thu, 19 Nov 2026 10:07:15 +0200 Subject: [PATCH 7/9] docs(adr): clarify journal privacy and telemetry boundaries Signed-off-by: eshulman2 --- ...-through-repository-owned-operation-journals.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md index 55627aea24..0254b313fd 100644 --- a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md +++ b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md @@ -52,6 +52,10 @@ branches. Domain dispatch and assessment semantics remain in adapters. The journal retains stable operation identities, input bindings, work bounds, effect intents and separate scheduling, execution and publication receipts. +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 @@ -83,8 +87,14 @@ not a coordinator agent. Only authorized trusted host code writes the journal. Assessment workers receive admitted context without journal-write credentials. Journal state -contains bounded identities, digests and receipts; artifact publication policy -still applies. Journal contents grant no authority, and integrity failure +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. +Artifact publication filters do not protect 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 From 0088d25c7fe1d0e6e285bff5c85e1f2155bb54e8 Mon Sep 17 00:00:00 2001 From: eshulman2 Date: Sun, 22 Nov 2026 14:40:04 +0200 Subject: [PATCH 8/9] docs(adr): clarify recovery adapters and alternatives Signed-off-by: eshulman2 --- ...ugh-repository-owned-operation-journals.md | 36 +++++++++----- docs/architecture.md | 12 +++-- docs/problems/durable-work-recovery.md | 47 +++++++++++-------- 3 files changed, 61 insertions(+), 34 deletions(-) diff --git a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md index 0254b313fd..bb931c05db 100644 --- a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md +++ b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md @@ -41,14 +41,26 @@ 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. +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 the -control repository. A saga records progress across separate external actions +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. Domain dispatch and assessment semantics remain in adapters. +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. @@ -79,23 +91,25 @@ paths do not automatically journal every run; their selection and dispatch behav remains unchanged unless explicitly integrated. Once a workflow admits work to the journal, the recovery contract covers all its required targets and effects. -Shared trusted journal operations are consumable from pre/post scripts and -reconcilers. Incremental checkpoints and periodic reconciliation provide +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 workers -receive admitted context without journal-write credentials. Journal state +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. -Artifact publication filters do not protect journal commits. With artifact +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. +authority, and integrity failure stops scheduling and publication rather than resetting state and repeating work. ## Entity state and journal state @@ -132,7 +146,7 @@ Jira issue properties do not satisfy the journal's conditional-update contract. - 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 workers retain their existing source-access boundaries. + Assessment runs retain their existing source-access boundaries. - Tracker-state reconciliation and publish-only retry can ship independently without narrowing the saga's scope. diff --git a/docs/architecture.md b/docs/architecture.md index c498b0758f..4a24a0519c 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -620,8 +620,9 @@ The existing design principle is that [the repo is the coordinator](problems/age - Decided, not yet implemented: a saga journal stores versioned JSON in the control repository, initially on GitLab, independently of the source forge - and tracker. Shared pre/post-script operations and scheduled reconciliation - retain separate dispatch, execution and publication receipts for each target. + 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 @@ -647,7 +648,12 @@ The existing design principle is that [the repo is the coordinator](problems/age - 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), diff --git a/docs/problems/durable-work-recovery.md b/docs/problems/durable-work-recovery.md index 567d255217..7e4df44a5f 100644 --- a/docs/problems/durable-work-recovery.md +++ b/docs/problems/durable-work-recovery.md @@ -4,19 +4,12 @@ title: Durable work recovery # Durable work recovery -A job can disappear after discovery, finish after its caller stops, or publish -an external change before its acknowledgement is saved. A successful model -invocation does not answer whether the requested work was scheduled, which -attempt owns it, or whether publication must be retried. +In the current fullsend architecture, agents run as independent jobs, with +[the repository acting as coordinator](agent-architecture.md#interaction-model-the-repo-as-coordinator). +Work can span several jobs and external systems. Interruptions and overlapping +jobs create distributed failure scenarios that need to be addressed. -The [repository coordination model](agent-architecture.md#interaction-model-the-repo-as-coordinator) -keeps authority in repository-visible controls. Recovery must preserve that -boundary. It needs deterministic bookkeeping, rather than an agent deciding -which other agents should run. The -[infrastructure discussion](agent-infrastructure.md) also separates execution -capacity from waiting for people or external systems. - -## Failure boundaries +## Failure scenarios - A dispatcher stops after a remote scheduler accepts a request but before it records the scheduler's run identifier. @@ -34,10 +27,11 @@ or the absence of a running CI job cannot prove completion. Operators need to distinguish these conditions from ordinary agent failures; see [operational observability](operational-observability.md#what-just-happened). -Persistent attempt bounds supply recovery mechanics, while -[cross-run escalation](cross-run-memory.md#error-recovery-and-retry-mechanics) -also needs failure interpretation and policy. A journal does not decide whether -a different model strategy is likely to succeed. +Recovery needs to track attempts across jobs and enforce retry limits. Choosing +whether a retry should use a different model or strategy is a separate question +in [cross-run escalation](cross-run-memory.md#error-recovery-and-retry-mechanics). +The [infrastructure discussion](agent-infrastructure.md) considers the execution +capacity needed to resume work. ## Options and trade-offs @@ -57,6 +51,14 @@ repository coordination model and avoids a required central service. It needs explicit trust, retention, conflict, lease and external-effect protocols; eventual-consistency searches cannot establish that an ambiguous write failed. +### Use an opt-in local stage engine + +A local engine can store accepted outputs and enforce the order of stages in a +workflow. Integrations can opt in without requiring a shared service. Recovery +on another host also needs a way to transfer durable state and reject stale +owners. Stage ordering alone does not reconcile external writes whose outcome +is unknown. A workflow can combine stage gating with external-action recovery. + ### Delegate to a durable workflow service A service can supply timers, retries and ownership. It introduces another @@ -68,9 +70,9 @@ make a remote issue creation atomic or authorize a retry after scope changes. [ADR 0165](../ADRs/0165-recover-work-through-repository-owned-operation-journals.md) chooses JSON journal files in the control repository, initially hosted on GitLab. The journal covers the full saga and each required branch, while -source repositories and trackers can use other providers. Shared trusted -operations let pre/post scripts and scheduled reconcilers consume the same -state. CI finalization is a best-effort checkpoint, not the recovery guarantee. +source repositories and trackers can use other providers. Workflow-supplied trusted host adapters claim work and use shared journal +operations to record progress and reconcile unfinished actions. Assessment runs +and their scripts do not receive journal-write credentials. CI finalization is a best-effort checkpoint, not the recovery guarantee. Its implementation remains separate from the decision. A local database test is not distributed acceptance. Entity-first discovery must also find eligible work whose trigger was lost @@ -94,7 +96,12 @@ analysis fails; that request is not an assessment or permission to remediate. - Which bounded JSON layout, integrity checks, retention and compaction rules preserve history and conditional transitions in the control repository? - Which trusted host identity writes the protected GitLab journal branch, and - how are its credentials kept separate from read-only assessment workers? + how are its credentials kept separate from assessment runs? +- How should workflow adapters be implemented and packaged, and should fullsend + ship reusable adapters? Shared journal integration is tracked in + [#9253](https://github.com/fullsend-ai/fullsend/issues/9253); the tracker-first + consumer integration is tracked in + [#9260](https://github.com/fullsend-ai/fullsend/issues/9260). - Which shared script interface and reconciliation schedule expose the saga without making CI finalizers a prerequisite for recovery? - Which existing scheduler APIs can reconcile accepted-but-unacknowledged From c33f550c18bc2ffbfa06066e4245d16196ed9b42 Mon Sep 17 00:00:00 2001 From: eshulman2 Date: Sun, 22 Nov 2026 14:41:49 +0200 Subject: [PATCH 9/9] docs(adr): link artifact scope and refine recovery wording Signed-off-by: eshulman2 --- ...repo-config-limits-run-artifact-content.md | 4 ++ ...ugh-repository-owned-operation-journals.md | 55 ++++++++++--------- docs/problems/durable-work-recovery.md | 10 ++-- 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/docs/ADRs/0161-repo-config-limits-run-artifact-content.md b/docs/ADRs/0161-repo-config-limits-run-artifact-content.md index 485749a5fa..a40f08eb5c 100644 --- a/docs/ADRs/0161-repo-config-limits-run-artifact-content.md +++ b/docs/ADRs/0161-repo-config-limits-run-artifact-content.md @@ -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 diff --git a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md index bb931c05db..74c5f9f3e5 100644 --- a/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md +++ b/docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md @@ -51,16 +51,17 @@ those guarantees, so it does not replace the journal for this 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. +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. @@ -85,31 +86,33 @@ 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 integrate trusted journal operations through their pre/post scripts, -agent or harness contracts, and reconcilers. Existing webhook and poll dispatch +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. +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. +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 diff --git a/docs/problems/durable-work-recovery.md b/docs/problems/durable-work-recovery.md index 7e4df44a5f..74f996920e 100644 --- a/docs/problems/durable-work-recovery.md +++ b/docs/problems/durable-work-recovery.md @@ -70,10 +70,12 @@ make a remote issue creation atomic or authorize a retry after scope changes. [ADR 0165](../ADRs/0165-recover-work-through-repository-owned-operation-journals.md) chooses JSON journal files in the control repository, initially hosted on GitLab. The journal covers the full saga and each required branch, while -source repositories and trackers can use other providers. Workflow-supplied trusted host adapters claim work and use shared journal -operations to record progress and reconcile unfinished actions. Assessment runs -and their scripts do not receive journal-write credentials. CI finalization is a best-effort checkpoint, not the recovery guarantee. -Its implementation remains separate from the decision. A local database test is not distributed acceptance. +source repositories and trackers can use other providers. Workflow-supplied +trusted host adapters claim work and use shared journal operations to record +progress and reconcile unfinished actions. Assessment runs and their scripts +do not receive journal-write credentials. CI finalization is a best-effort +checkpoint, not the recovery guarantee. Its implementation remains separate +from the decision. A local database test is not distributed acceptance. Entity-first discovery must also find eligible work whose trigger was lost before admission. Trackers retain business and handled state; the journal