Skip to content

docs(adr): define control-repository saga journals - #9264

Merged
ascerra merged 10 commits into
fullsend-ai:mainfrom
eshulman2:docs/adr-0165-recovery
Nov 23, 2026
Merged

ascerra merged 10 commits into
fullsend-ai:mainfrom
eshulman2:docs/adr-0165-recovery

Conversation

@eshulman2

@eshulman2 eshulman2 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Define a durable saga journal stored as versioned JSON in the Fullsend control repository. Initial storage and execution are in GitLab, independently of GitHub/GitLab/Forgejo source repositories and Jira trackers. Preserve the full recovery scope: admission, target resolution, dispatch, execution, publication and accounting for every required branch.

The journal provides durable state for tracking work, bounded retries and continuation across invocations. This is especially important for workflows such as CVE resolution, where each required target must reach an evidenced outcome or an explicit unresolved state within persistent work bounds. Entity reconciliation is independent work and is not a prerequisite for this proposal.

Related Issue

Split from #9261. Implementation remains tracked in #9253; this documentation PR does not implement or close that issue. Multi-target dispatch and collection remain tracked in #9260.

Decision

  • Retain full saga and multi-branch recovery using versioned JSON in the GitLab control repository, independently of source forge and tracker.
  • Require conditional updates, ownership fencing, durable intents and separate receipts, with trusted host writes and existing authorization gates.
  • Support shared pre/post-script operations and periodic reconciliation; CI cleanup is best effort.
  • Preserve entity business/handled state under ADRs 0098 and 0144.
  • Keep alternatives, tradeoffs and forge scope in the ADR. Move storage layout, interfaces, provisioning, schedules, detailed failure tests and delivery sequencing into Implement repository-owned operation journals for recoverable work #9253.

GitLab is the initial journal-storage backend. GitHub and Forgejo storage adapters must satisfy the same contract. Source adapters retain their own authorization and enablement requirements.

Reference implementation and integration

eshulman2/fullsend#1 implements the journal and its host integration at commit c4fa663df77c2be83b6570b8572d707afaf92745:

  • Journal engine: conditional whole-document transitions, ownership generations, persistent budgets, effect intents and immutable confirmed receipts.
  • Parent admission guards: child mutations bind to the current parent record in the same conditional write.
  • Hosted GitLab conformance check: competing claims, ownership replacement, stale-owner rejection and retained budgets/pending effects.
  • Tracker controller tests: multi-branch recovery, ambiguous dispatch/publication, superseded attempts and concurrency reservations through scheduler termination.

The CVE workflow control repository integrates this implementation for assessment, promotion and scheduling. Its bootstrap pins the same fork commit. Trusted adapters use the journal to continue work, retain bounded attempts and reconcile external effects across separate jobs.

Current-behavior evidence

Inspected baseline: 7455751ecb9446953527dbf73b4e379ea5442cb0.

The baseline evidence above describes upstream behavior. The reference implementation supplies the journal operations and integration in the fork. ADR 0165 records the shared architectural contract.

Review clarifications

Additional reference evidence at c4fa663df77c2be83b6570b8572d707afaf92745:

  • Controller: claims admitted work and reconciles historical attempts.
  • Worker wrapper: retains trusted host capabilities before ordinary agent role selection.
  • Role credential clearing: removes sibling role secrets from the environment inherited by assessment scripts.
  • Integration scheduling: separate adapter cycles, scheduled reconciliation and host-side evidence finalization.

Validation

  • Changes staged before make lint; applicable staged checks pass.
  • git diff --check passes.
  • Documentation changes checked independently of the reference implementation.

Checklist

  • Conventional Commit title.
  • Human-directed commits signed off for DCO.
  • I wrote this contribution myself and can explain all changes in it.

Prepared with coding-agent assistance; the contributor can assess the personal-authorship attestation.

Signed-off-by: eshulman2 <ellashulman1@gmail.com>
@eshulman2
eshulman2 requested a review from a team as a code owner November 10, 2026 10:08
@github-actions

Copy link
Copy Markdown

E2E tests did not run

E2E tests run automatically for pull requests authored by users with write access or higher.

For other contributors, someone with write access must add the ok-to-test label after the latest push.

Reason: unauthorized

See E2E testing guide for details.

@qodo-code-review

qodo-code-review Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider

Great, no issues found!

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

Grey Divider

Tip of the day
💡 Did you know, you can choose which labels appear on a finding, and whether they show icons or text

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 7b5732f ⏭️ Skipped

Results up to commit 8671194 ⏭️ Skipped


No changes from previous review

Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Document control-repository saga journals for durable recovery

📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Adopt versioned JSON journals in the control repository to recover admitted work across hosts.
• Define fenced ownership, bounded retries, and separate receipts for every required target.
• Document failure boundaries and distinguish the accepted decision from unimplemented backend work.
Merge Risk 🟢 Low

Blast radius 🟢 Low 💥 0 capabilities

  • No production behavior changes identified.
Behavioral complexity 🟢 Low 🧩 Assessed behavior

  • No production behavior changes identified.
Potential damage 🟢 Low 🩹 Assessed behavior

  • No production behavior changes identified.
Assessed commit c33f550
Diagram

graph TD
  D["Eligible work"] --> H["Trusted host"] --> J[("Control journal")]
  H --> S["Scheduler"] --> W["Assessment worker"] --> H --> P["Publication adapter"]
  P --> H
  R["Reconciler"] --> H
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Integration-owned recovery databases
  • ➕ Give each integration flexibility over its storage and workflow.
  • ➖ Duplicate fencing, authorization, and external-effect reconciliation across integrations.
2. Durable workflow service
  • ➕ Centralize timers, retries, and ownership management.
  • ➖ Add an operated dependency and trust boundary without making remote writes atomic.

Recommendation: The control-repository journal fits the existing repository-as-coordinator model and keeps recovery independent of source forges and trackers. Retain the ADR's explicit conformance and reconciliation requirements: repository history alone cannot guarantee safe retries or exactly-once effects.

Files changed (7) +262 / -1

Documentation (7) +262 / -1
0165-recover-work-through-repository-owned-operation-journals.mdAccept the control-repository saga journal decision +124/-0

Accept the control-repository saga journal decision

• Defines versioned JSON journals for full, multi-target recovery, with conditional transitions, ownership fencing, bounded work, intents, and separate receipts. Establishes trust boundaries and forge scope while deferring implementation details to #9253.

docs/ADRs/0165-recover-work-through-repository-owned-operation-journals.md

architecture.mdPlace the journal decision in the architecture overview +11/-1

Place the journal decision in the architecture overview

• Adds the accepted but unimplemented journal design and its relationship to reconciliation and domain adapters. Clarifies that adapter behavior and external-system guarantees remain open.

docs/architecture.md

agent-architecture.mdConnect cross-host recovery to the agent architecture +6/-0

Connect cross-host recovery to the agent architecture

• Links the recovery problem and ADR from the repository-coordination discussion, distinguishing deterministic recovery from a coordinator agent.

docs/problems/agent-architecture.md

agent-infrastructure.mdIdentify durable recovery needs for restarted workers +6/-0

Identify durable recovery needs for restarted workers

• Notes that restarting workers requires durable ownership and external-effect reconciliation, and points to the accepted journal decision without claiming implementation.

docs/problems/agent-infrastructure.md

cross-run-memory.mdSeparate mechanical recovery from model learning +5/-0

Separate mechanical recovery from model learning

• Explains that journaled attempts and work bounds address scheduling recovery but do not decide whether a different model strategy will succeed.

docs/problems/cross-run-memory.md

durable-work-recovery.mdDescribe recovery failures, alternatives, and acceptance criteria +105/-0

Describe recovery failures, alternatives, and acceptance criteria

• Documents interrupted dispatch and publication, competing hosts, expired ownership, and missing targets. Compares recovery approaches and sets distributed fault-test expectations and open implementation questions.

docs/problems/durable-work-recovery.md

operational-observability.mdDistinguish effect receipts from execution traces +5/-0

Distinguish effect receipts from execution traces

• Explains why traces cannot establish the outcome of an unacknowledged external write and links separate scheduling, execution, and publication receipts to operator reconciliation.

docs/problems/operational-observability.md

@ascerra ascerra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for writing this up. I finished the artifacts question I raised, and tested it on a GitLab project with Jira trackers (notes).

The problem is real. Twice a run produced a valid result and then failed to publish, and the only way to finish was to run the model again.

You were right about artifacts. They hold the validated result, but they don't say where you are in a process, and nothing reads them back in.

My read of the six failure boundaries:

Failure boundary What could cover it
Run accepted, id not recorded Find unfinished work from tracker state (ADR 0098)
Two hosts discover the same work Journal
Lease expires, old worker still running Journal
Valid evidence, publish fails A publish-only retry from the run's output, plus markers on anything a run creates
A required child never returns The same state check, per tracker (#9266)
Inputs changed while queued Bind the result to its inputs and check before acting

So four of six look coverable without a new store. My suggestion is to land those small pieces first and keep the journal for when we have more than one host dispatching. Three inline comments on that.

Signed-off-by: eshulman2 <ellashulman1@gmail.com>
@eshulman2 eshulman2 changed the title docs(adr): define repository-owned recovery journals docs(adr): define control-repository saga journals Nov 11, 2026
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
@eshulman2

Copy link
Copy Markdown
Contributor Author

Added reference implementation and integration links to the PR description.

eshulman2/fullsend#1, at c4fa663df77c2be83b6570b8572d707afaf92745, implements the GitLab control-repository journal, conditional transitions, ownership fencing, persistent budgets, effect intents/receipts and parent-admission guards. The description links the engine, hosted GitLab conformance check and recovery tests.

The CVE workflow control repository pins that implementation and integrates it into assessment, promotion and scheduling. This is a concrete consumer of durable continuation and bounded recovery across jobs. Implementation references remain in the PR description rather than the proposal itself.

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 <ellashulman1@gmail.com>
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Site preview

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

Commit: c33f550c18bc2ffbfa06066e4245d16196ed9b42

@codecov

codecov Bot commented Nov 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@eshulman2
eshulman2 marked this pull request as ready for review November 16, 2026 07:47
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 7b5732f

@eshulman2
eshulman2 requested a review from ascerra November 16, 2026 07:47
@jwm4
jwm4 self-requested a review November 16, 2026 14:29
Separate explicit workflow integration from existing webhook and poll
dispatch. Preserve the full recovery contract for journal-admitted work.

Signed-off-by: eshulman2 <ellashulman1@gmail.com>
@eshulman2
eshulman2 requested a review from ifireball November 16, 2026 17:42
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
@wchwhite

Copy link
Copy Markdown

Shared at @ralphbean's suggestion: an existing option for the stage-progress part of the need this ADR states.

The Context says workflows "need durable state to track required work, continue after interruption and retain evidence within bounded retries." Perigee, the state engine in Apogee (which I maintain), already covers the stage-progress part of that. In this runnable example with a 58-second video, fullsend run code is refused before sandbox creation until a triage result has been accepted for that chain. The accepted document is stored, the completed step records its digest, and a restart on the same host kept that state (see "What was observed" in the README). It plugs into the harness's pre_script and post_script with no Fullsend change.

@ascerra's draft gate in this thread makes the same kind of check from a receipt on the tracker: one record for one handoff. The engine keeps one ordered record for the whole chain. The same two scripts serve every stage, and the stage order is declared once, in the chain definition.

It isn't a journal: it doesn't record or reconcile external operations, so a workflow could use both through the same scripts. Options says, "A mandatory workflow service adds an operated dependency." This one is opt-in and local. Only a harness that names the two scripts uses it, and the demo's wrapper starts and stops it on the host. What I haven't shown yet is carrying its state between jobs. That state is a database file restored on start, and a two-job run is the next thing I'll post.

I've read @eshulman2's reply in that thread on what stays on the entity, so my request is about Options only: could it list an opt-in local engine like this alongside the three it has, and give the reason it is or isn't used for stage progress?

Comment thread docs/problems/durable-work-recovery.md Resolved
Comment thread docs/problems/durable-work-recovery.md Resolved
Comment thread docs/problems/durable-work-recovery.md Resolved
Comment thread docs/problems/durable-work-recovery.md Resolved
Comment thread docs/problems/durable-work-recovery.md Resolved
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
@eshulman2

Copy link
Copy Markdown
Contributor Author

Charles, the Options section now includes an opt-in local stage engine, in both ADR 0165 and the recovery problem document (c33f550). It can retain accepted outputs and enforce stage ordering without a mandatory shared service. That can complement the journal; this decision still requires cross-host ownership fencing and reconciliation of external actions whose outcome is unknown. Stage progress alone does not replace those requirements, and the ADR leaves workflows free to combine both.

This compares the approach you described; I have not independently run the Perigee demo.

@ascerra ascerra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, this has both things I asked for... approving. The Decision now says each participating workflow supplies a trusted host adapter and leaves its implementation open (here), and the problem doc asks whether Fullsend should ship reusable adapters (here).

One note for later. The journal is now written outside the assessment run (here), and telemetry records what happened within a run (here). I don't want those two lines read later as keeping the journal's reads and writes out of our traces. I'd like them to show up there one day, so the work can be scored from start to finish. I think the ADR leaves that open, since correlation is an implementation choice.

@ascerra
ascerra added this pull request to the merge queue Nov 23, 2026
Merged via the queue into fullsend-ai:main with commit 64e0d8f Nov 23, 2026
146 checks passed

This branch was successfully deployed

1 active deployment
site-preview — c33f550c Deployed Nov 22, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants