Repository navigation
Description
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.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn progress
Activity
ascerra commentedon Nov 20, 2026
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.
allartifact level, captured content is published with the run's artifact. Themetadatalevel drops it from the published telemetry file by matching a fixed set of attribute names, so journal-content attributes have to be added to that set. An org that turns on content capture is responsible for who can read its trace backend.ascerra commentedon Dec 3, 2026
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.
repos.yamlsetting, per repository and per agent, or per workflow if that fits the ADR better. The protected profile would still decide where the journal lives and who may write it (here).