Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export default defineConfig({
{ text: "fullsend prepare", link: "/cli/prepare" },
{ text: "fullsend repos", link: "/cli/repos" },
{ text: "fullsend run", link: "/cli/run" },
{ text: "fullsend journal", link: "/cli/journal" },
{ text: "fullsend self-update", link: "/cli/self-update" },
],
},
Expand Down
1 change: 1 addition & 0 deletions docs/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ To update an installed binary later, run [`fullsend self-update`](self-update.md
| [`fullsend prepare`](prepare.md) | Resolve an agent's sandbox image as `fullsend run` does, pre-pull a private image with the CI job's registry credential (`ghcr.io` on GitHub Actions, `CI_REGISTRY` on GitLab CI) as `run` does, and create and delete a restrictive preflight sandbox, which makes the gateway pull the image. Run it once before many parallel runs. `--json` prints the resolved image, architecture, and result. |
| `fullsend poll` | Discover forge events and dispatch agent pipelines. `--forge gitlab` runs the cron poller ([ADR 0067](../ADRs/0067-gitlab-cron-polling-event-dispatch.md)); events-mode polling also recovers issue opens whose webhook delivery was missed. `--input-driver jira-poll` polls Jira (see [Jira integration](../guides/user/jira-integration.md)). It reads the Jira site, API gateway, projects, and query only from the effective entity-source configuration: the source translated from `tracker.jira` (`base_url` and `project` required) or an explicit Jira `entity_sources` entry bound in an enabled agent's `entities.source` (the removed `--jira-url`, `--jira-project`, and `--jql` flags are rejected). It authenticates with `FULLSEND_JIRA_TOKEN` (plus `FULLSEND_JIRA_EMAIL` for a bot user) or with OAuth 2.0 client credentials via `FULLSEND_JIRA_CLIENT_ID` and `FULLSEND_JIRA_CLIENT_SECRET`. Those credentials are reused only for the connection translated from `tracker.jira`; a source on an explicit Jira connection is refused until a separately provisioned credential binding exists, and explicit sources are refused when enabled agents bind different `entities.source` lists. It skips the cycle unless a selected source permits discovery (`tracker.jira.poll.enabled` is `true` for the translated source); by default it writes dispatch records (`--output`) for a GitHub repository (`--target-repo`, an `owner/repo` slug; one that contains `..` is refused), and with `--target-forge gitlab` it starts the protected agent pipelines of the GitLab project named by `--project` (full path, nested groups allowed; default `CI_PROJECT_PATH`) on the https `--gitlab-url` instance, through the same signed, typed-input dispatch route and Poller credential as the GitLab poller, advancing a Jira issue's checkpoint only once its pipelines are created ([GitLab runtime](../guides/user/jira-integration.md#gitlab-runtime)). `--input-driver gitlab-webhook` is the GitLab dispatcher job's webhook fast-path ([ADR 0125](../ADRs/0125-gitlab-hybrid-webhook-poller-dispatch.md)). It reads the native webhook body from the file-type `TRIGGER_PAYLOAD` variable, re-validates it against the GitLab API, and creates each routed stage's pipeline (typed inputs, `FULLSEND_DISPATCH_SECRET` HMAC) with the poller-role credential (the `api` route, the default). Scheduled cron polling and the webhook fast path run as the trigger-only service account: once its dispatch activation is recorded, the managed webhook carries the account's pipeline trigger token ([#8509](https://github.com/fullsend-ai/fullsend/issues/8509)), the scaffold sets `FULLSEND_GITLAB_DISPATCH_ROUTE=child-pipeline`, and the command instead starts each pipeline with the job's own `CI_JOB_TOKEN` through the pipeline trigger API (`source=pipeline`); an unknown route, or `child-pipeline` without `CI_JOB_TOKEN`, fails closed. `fullsend poll --forge gitlab --print-dispatch-routes` prints the routes the CLI supports (`api` and `child-pipeline`) and exits; the scaffold runs it before selecting `child-pipeline`, and a CLI that predates the route rejects the flag, so the job stops before any dispatch. It requires `--project`, which has no `CI_PROJECT_PATH` fallback. It deduplicates against the poller's per-mode state on the `fullsend-poll-state-slash` and `fullsend-poll-state-events` branches, so an event the webhook dispatched is not dispatched again by the poller, and the reverse. Shared poller state is occurrence-aware (label additions are keyed on the resource label event ID, dispatched keys are retained for the webhook freshness window, and a failed label dispatch is handed back to the poller as a pending retry); legacy persisted keys keep working. Older pollers do not recognise the new label keys, so before a rollback or mixed-version run, follow the [ADR 0132](../ADRs/0132-occurrence-aware-shared-poller-state.md) guidance to drain in-flight poll jobs or pin every poller to one version. Both GitLab drivers dispatch the fix stage only for a changes-requested marker note authored by the registered Analyst, whose numeric user ID the scaffold exports as the job-local `FULLSEND_GITLAB_ANALYST_USER_ID`. |
| `fullsend dispatch` | Evaluate harness CEL triggers for one forge event and print the dispatch matrix (`--output-driver gha-matrix` or `json`); used by the dispatch workflow's `Harness dispatch` job. `--route <agent>` (`review`, `retro`, `triage` or `prioritize`) instead decides routing for that built-in agent and prints one JSON line, `{"agent":"<agent>","decision":"run\|skip\|bash","reason":"…","harness":"config:<source>\|agents@<sha>"}` (`harness` is optional: it is omitted when the harness cannot be resolved or the decision did not need it, as for `bash`): `run` or `skip` when the repository set `agents[].trigger` on the agent's entry ([Choosing when review runs](../guides/user/customizing-agents.md#choosing-when-review-runs), [Choosing when retro runs](../guides/user/customizing-agents.md#choosing-when-retro-runs), [Choosing when triage and prioritize run](../guides/user/customizing-agents.md#choosing-when-triage-and-prioritize-run)), `bash` to leave the decision to the workflow's built-in rules. Built-in agents resolve from a configured Forgejo instance when `FULLSEND_FORGEJO_URL` is set, as in [`fullsend run`](run.md#agent-definitions-from-a-forgejo-instance). The dispatch workflow's `Route` job runs it. With `--input-driver gha-event`, a GitHub bot actor's registered fullsend role is looked up first through the mint (a layered `mint_url`, else `FULLSEND_MINT_URL`) with the job's Actions OIDC token, so the job needs `id-token: write` ([ADR 0107](../ADRs/0107-bot-identity-resolution-for-dispatch-authorization.md)); label-added events skip the lookup, and an unregistered bot or a failed lookup is denied (an empty matrix, or a `skip` decision) rather than failing the command. An absent config falls back to `FULLSEND_MINT_URL`, but a config that fails to load or parse is a failed lookup, not a fallback. `--input-driver forgejo-event` maps a Forgejo Actions event payload (`FORGEJO_EVENT_PATH`, bound to `FORGEJO_SERVER_URL` and the repository); it is the default when `FORGEJO_ACTIONS` or `GITEA_ACTIONS` is `true`, even when `GITHUB_EVENT_PATH` is also set. This changes the default for pipelines on Forgejo or Gitea runners that relied on the implicit `gha-event` driver; pass `--input-driver gha-event` to restore the previous behavior. No Forgejo permission lookup is wired yet, so its events are denied by the authorization gate ([Forgejo adapter notes](../normative/normalized-event/v1/README.md#forgejo-adapter-notes)). |
| [`fullsend journal`](journal.md) | Explicit protected-host recovery journal operations; no automatic agent dispatch or external-effect replay. |
| `fullsend lock [agent-name]` | Pin remote dependencies to `lock.yaml`. If `lock.yaml` exists but cannot be parsed or declares an unsupported version, the command exits without writing and leaves the file unchanged. An entry is stale when the harness file or the `harness:` block of the agent's `agents:` entry has changed. When it composes a harness (a new or stale entry, or `--update`), it also prints the harness diagnostics, including [reserved `env.sandbox` keys](run.md#reserved-envsandbox-keys). A current entry is not composed, so its keys are not checked, and `lock` composes without event context, so keys from event-guarded overlays are reported only by `fullsend run`. A harness whose runtime fetch service can start (`allow_runtime_fetch: true`, URL-sourced skill or plugin directories, or a bare, deprecated `allowed_remote_resources` declaration) must have every harness-level `allowed_remote_resources` prefix covered by the config-level allowlist — `config.yaml`'s `allowed_remote_resources` plus the built-in default prefixes (the defaults are included when the list is omitted or non-empty; an explicit `allowed_remote_resources: []` stays deny-all and excludes them); `lock` fails naming an uncovered prefix, and fails closed when no repository config (`config.yaml` or `config.base.yaml`) exists. With a `harness:` block on the agent's entry, the prefixes checked are the ones the block sets. |
| `fullsend lint` | Lint `config.yaml` and agent harness definitions — deprecations, misconfigurations, and file checks, with diagnostics for each enabled agent, or for one agent with `fullsend lint <agent-name>`. See [`fullsend lint`](lint.md), and [Checking a trigger before you merge](../guides/user/cel-triggers-reference.md#checking-a-trigger-before-you-merge) for a walkthrough. |
| `fullsend scan` | Run security scanners on agent input/output |
Expand Down
171 changes: 171 additions & 0 deletions docs/cli/journal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
---

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.

LOW (content): the new fullsend journal capability reads like a strong blog subject once the hosted conformance work lands. could a short post walk through the problem it solves for protected hosts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I’m deferring the blog post until hosted conformance lands and leaving this thread open as a reminder.

title: fullsend journal
---

# fullsend journal

Experimentally read and conditionally update the saga journal in the GitLab control repository.
It provides the storage and host-operation primitives described in
[ADR 0165](../ADRs/0165-recover-work-through-repository-owned-operation-journals.md).
It performs no inference. The JSON output is durable state only after the remote
checkpoint is accepted; a failed or ambiguous call is not permission to repeat
an external action.

## Protected host profile

Set `FULLSEND_JOURNAL_PROFILE` in trusted host installation state. Its strict JSON
fields are `forge` (`gitlab`), `base_url` (HTTPS site origin), `owner` (namespace),
`repo`, `branch`, `path` (relative JSON file), `role`, and
`experimental_gitlab` (boolean, defaults to false). Source checkouts, tracker
properties and model output cannot supply this profile. The journal branch must
already exist and be protected. Every exact or wildcard rule matching the
branch must allow push and merge only to the journal writer's numeric user ID
(or nobody), with at least one push grant for the writer. Role-level, group
and deploy-key grants are refused, including
Maintainer grants. Every matching rule must explicitly grant unprotect access
only to that writer. GitLab treats an empty unprotect list as its default
policy, so the journal refuses missing or empty lists. It also refuses custom
member-role grants. An overlapping permissive rule blocks access. The
credential must be able to list protection rules and identify its user.
Named-user protection grants require
[GitLab Premium or Ultimate](https://docs.gitlab.com/user/project/repository/branches/protected/#in-a-project).
Instances without these grants cannot host this journal backend.
Set `experimental_gitlab` to `true` only for a controlled trial. Serialize all
journal mutations externally under one shared lock per journal, for example a
single GitLab CI resource group when all writers run in the same project. The
Files API checks `last_commit_id` separately from the branch update, so
concurrent writers can lose updates. Hosted conformance remains pending.

The profile selects its exact scope; there are no command flags to redirect
writes elsewhere.

Register `role` as a custom identity through the existing protected
`FULLSEND_GITLAB_ROLE_REGISTRY`, with `write_repository` capability and its own
secret reference. The built-in Analyst, Poller and Coder roles are refused for
this journal command. Journal credentials stay on trusted hosts. The client
rechecks scope, current profile, authenticating credential and branch protection
on access. Neither ambient `GITLAB_TOKEN` nor a local database is a fallback.

## Operations

```sh
fullsend journal initialize
printf '%s' '{"phase":"admitted"}' | fullsend journal admit \
--id case-001 --binding "reviewed-input-digest"
fullsend journal claim --id case-001 --owner controller-001 --ttl 5m
fullsend journal read --id case-001
```

`initialize` creates the journal on the pre-provisioned branch and refuses an
occupied path. Missing or corrupt existing state requires operator recovery;
ordinary commands never initialize or reset it.

After admission and claim, leased mutations require `--id`, `--owner` and the
`--generation` returned by `claim`. `admit` and `claim` use the flags in the table:

| Operation | Other flags / standard input |
| --- | --- |
| `admit` | `--binding`; bounded JSON data on stdin |
| `claim` | `--owner`, optional `--ttl` (default 5m, maximum 24h) |
| `renew` | Optional `--ttl` |
| `release` | Releases the current lease |
| `update` | Bounded replacement domain data on stdin; retains budgets/effects |
| `rebind` | `--binding` plus new reviewed domain data on stdin; preserves consumed bounds and effects |
| `intent` | `--effect-id`, `--kind`, `--binding` |
| `effect` | `--effect-id`, `--status`; confirmed receipt JSON on stdin |
| `spend` | `--counter`, `--limit`; consumption survives later attempts |
| `read` | No mutation flags or stdin |

The effect states are `intended`, `in_flight`, `ambiguous` and `confirmed`.
Transition checks and immutable receipts prevent a stale owner or repeated
in-flight admission from authorizing another external write. The CLI retries a
mutation at most twice (three attempts total), only when the conditional write
was definitively rejected. It reloads state and rechecks all predicates on each
attempt, with short cancellation-aware backoff. It reads stdin once. Initialization and reads are not
replayed. Exhausted conflicts still require caller recovery; do not force-push or
merge competing JSON claims. These retries do not invoke an agent or repeat an
external action.

The GitLab Files API adapter recognizes exact HTTP 400 rejection
messages. The recognized reference-update messages are
`9:reference update: reference does not point to expected object.` and
`Could not update refs/heads/<branch>. Please refresh and try again.` for the
requested branch. File-revision and file-exists recognition also depends on
exact English text. Generic HTTP 409, localized HTTP 400, and other unrecognized rejection
responses are treated as uncertain. Use an English response locale for trials that require these
automatic retries. Hosted verification across GitLab versions is pending.

A lost acknowledgement or failed checkpoint verification returns
`journal checkpoint outcome uncertain` and is never automatically retried. Mixed
conflict/unknown errors, invalid readback, and changes to the target record stay
uncertain. Ownership, binding, integrity and budget failures do not retry either.
Reads and write verification resolve the configured branch through GitLab’s
branch API and read the file at the reported commit. This avoids ambiguity
when a tag has the same name.

The backend keeps all authority in one bounded document, using GitLab's file
revision guard in deployments that serialize writers. After an acknowledged Engine
write, it validates the readback document and its exact intended record; unrelated
records may advance. Direct backend callers retain whole-document verification.

A checksum detects accidental corruption; it does not authenticate an actor.
Protected storage and current host authorization remain required. No delivery
or publication guarantee is described as exactly once.

### Bind child mutations to current parent admission

Promotion controllers can pass all three flags on journal commands:

```text
--require-record CASE_ID --require-binding MANIFEST_DIGEST --require-data-digest PARENT_DATA_SHA256
```

The data digest is SHA256 of the compact JSON bytes of the parent record's
`data` value as emitted by `fullsend journal read`, excluding surrounding
whitespace or a trailing newline. This uses Go's `encoding/json` HTML escaping
(for example, `<` becomes `\u003c`) and preserves object key order and number
spellings. Extract the raw value without parsing and reserializing it through a
serializer that changes those bytes. Go callers can use `json.Marshal(record.Data)`
to obtain the same representation. Storage indentation does not affect the digest.
Every mutation checks all parent requirements on its fresh loaded snapshot, including idempotent no-op paths, and again in the
whole-document conditional write. A changed parent rejects the mutation. A
concurrent revision conflict can trigger the bounded transaction retry above;
a newly stale parent then fails its fresh check. This does not retry a model call
or external publication.
Reads remain available for recovery even after a parent changes. Requirements
cannot refer to the mutated record itself. They supplement the child operation's
own ownership generation and do not replace source, Jira or human-approval gates.

## Integration and acceptance boundary

Installing fullsend does not activate a journal, add schedules, or journal ordinary
agent runs. A workflow must install a protected host profile, explicitly admit
work, supply authorized host adapters and reconcile its external effects. The
journal records intent and receipts; it never performs those external actions.
Assessment sandboxes and their pre/post scripts must not inherit the journal
writer credential merely because they participate in a workflow.

The storage backend is initially GitLab only. GitHub and Forgejo source targets
remain independent of the journal location; their control-journal backends stay
unsupported pending conformance. No journal access to source repositories is
needed. Local fake-backend and HTTP-adapter tests do not establish hosted
acceptance.

> **Planned:** Hosted cross-machine conformance and end-to-end workflow migration
> remain tracked in [#9253](https://github.com/fullsend-ai/fullsend/issues/9253).

Store only bounded identities, digests and receipts. Checksums detect corruption,
not a writer's identity. Protected storage and host authorization supply that
boundary. Run artifact-level filters do not remove data from journal commits.
Use a separately authorized immutable evidence store when recovery evidence
cannot be retained in run artifacts. Retention, reader access and compaction are
installation responsibilities; exhaustion holds work rather than discarding
unresolved operations.

This initial command does not create journal-operation trace spans or capture
journal payloads into telemetry. A journal receipt is not a replacement for the
run's detailed telemetry or proof of a domain outcome.

> **Planned:** Journal-operation trace spans, journal/run trace correlation and
> metadata-only instrumentation remain implementation work in
> [#9253](https://github.com/fullsend-ai/fullsend/issues/9253).
Loading