Skip to content

Implement repository-owned operation journals for recoverable work #9253

Open

Description

@eshulman2

Design PR: #9264

Problem

A worker may disappear after scheduling, complete after ownership expires, or publish an issue before its acknowledgement is retained. Poll deduplication and per-subject CI serialization do not establish one operation owner across those boundaries.

Implement ADR 0165 after its design PR is accepted. Keep domain mapping and ticket semantics in adapters.

Required implementation

  • Define and version a repository-owned operation journal with conditional updates and integrity checks; use forge.Client for forge operations.
  • Persist an admitted target plan, stable operation identity and bounds before dispatch. Retain attempt IDs and scheduler/run identities separately from accepted results and publication effects.
  • Support short-lived reconcilers, leases and monotonically increasing ownership generations. Reject stale result acceptance and new effect admission. A previously admitted remote request remains in-flight until reconciled.
  • Recover accepted-but-unacknowledged dispatches. Retry publication from retained validated evidence without repeating inference when authorization and source remain current.
  • Persist external-effect intent and markers before writes. Retain ambiguous writes when an adapter cannot prove their outcome; never use absence in an eventually consistent search as permission to blindly create again.
  • Recheck actor/entity, disclosure, source, policy and plan before new actions. Integrity failure stops work instead of clearing the ledger.
  • Report all required target outcomes and exhausted/missing work. Support a domain adapter requesting an investigation ticket after failure while preserving applicability as unknown.

Acceptance

Demonstrate overlapping hosts, killed dispatchers before/after scheduling acceptance, lease expiry with a still-running old worker, result retention followed by publisher failure, remote create success followed by lost acknowledgement, mapping supersession and bounded retries. Reconcile without duplicated external work or a false completion claim.

The initial storage backend is the GitLab control repository, independent of the source forge and tracker. GitHub and Forgejo control-repository storage adapters remain disabled until they pass the same conformance tests. A SQLite simulation or Jira property lock is not distributed acceptance.

Storage and integration details

These details implement the decision in ADR 0165; settle their exact form in implementation review.

  • Use a dedicated protected journal branch in the GitLab control repository, separate from workflow configuration and source branches. Prevent journal commits from recursively triggering agent pipelines.
  • Define bounded, versioned JSON schemas and paths for sagas, target plans, input digests, attempts, ownership generations, intents and receipts. Retain large validated outputs as immutable artifact references with digests.
  • Make the complete state transition conditional on the journal revision read. Reject competing updates; reload and re-evaluate ownership and inputs. Do not automatically merge competing JSON ownership claims, force-push, or silently recreate missing state. Demonstrate multi-record atomicity where transitions span records.
  • Define the shared pre/post-script and reconciler interfaces for claims, intent recording, evidence acceptance, confirmation and compensation. These are not existing CLI commands or harness fields.
  • Define protected-branch provisioning and credential routing through the trusted GitLab registered-role contract. A dedicated administrator-registered responsibility identity may write the journal. Do not expand the built-in Analyst role or expose journal credentials to read-only workers.
  • Configure reconciliation schedules, lease renewal and expiry rules, retry budgets, artifact retention, history retention and compaction limits.
  • Integrate a best-effort CI finalizer, such as GitLab after_script, using verified local evidence. A job exit alone must not imply saga completion. Reconciliation must work when the finalizer never runs.
  • Retain independent per-branch attempts and receipts. Domain adapters define cancellation, compensation and forward recovery; recording journal state does not itself authorize issue closure, deletion or code rollback.

Additional acceptance cases

  • Recover GitHub source work and Jira publication using a GitLab control-repository journal, without journal-write access to source repositories.
  • Race conditional updates and multi-record transitions from two hosts; only the current authorized owner may admit a new effect.
  • Kill the runner before finalization, interrupt a journal write, and make the journal temporarily unavailable. Resume from durable intents and receipts without guessing that an external action failed.
  • Verify journal commits do not recursively launch agent pipelines and worker credentials cannot modify the journal.
  • Verify retained artifacts match their input bindings and digests before publish-only retry. Hold ambiguous remote outcomes even when eventual search is empty.
  • Exercise every required branch independently, including missing, failed and exhausted attempts, without reporting a successful subset as complete.

Delivery boundaries

Entity-first tracker reconciliation and publish-only recovery may ship independently. They do not replace the full saga or its multi-branch recovery requirements. Entity business/handled state remains on the tracker under ADRs 0098 and 0144; the journal tracks mechanical progress only after admission. Keep implementation sequencing in this issue rather than ADR 0165.

Activity

  1. moved this from Todo to In progress in fullsend-ai Workstreamon Nov 12, 2026
  2. ascerra commented on Nov 20, 2026

    @ascerra
    Contributor

    Scoring reads a run's trace, so for the work a journal tracks to be scored from start to finish, each journal read and write needs to leave a record in a trace.

  3. ascerra commented on Dec 3, 2026

    @ascerra
    Contributor

    I couldn't find two things in the list above. Both came up while I was reviewing #9936, and I don't think either belongs in that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions