Skip to content

GitOps source of truth

Last updated: 2026-11-23T09:00:15-03:00 (UTC-3)

By default the console wins: a change saved in the console is stored as a versioned override in PostgreSQL and replaces the YAML object until someone reverts it (configuration parity). With gitops.source_of_truth: file the YAML wins instead, for every object it declares: those objects are read-only in the console and the API, and their console overrides are ignored on every reload. Objects that exist only in the database keep working; deleting them (“pruning”) is a separate opt-in that you apply after a dry run.

features:
gitops_source_of_truth: true # boot flag, off by default
gitops:
source_of_truth: file # db (default) or file
prune: false # file only; lets the apply action delete database-only rows
  • gitops_source_of_truth is a boot flag: the console cannot switch it, so nobody can turn off file authority from the console. Change it in YAML and restart.
  • source_of_truth: file without the flag, an unknown value, or prune: true without file fail validation at startup.
  • With the flag off, or source_of_truth: db, nothing changes from today.
  • It needs PostgreSQL for the dry run and the apply; the read-only rule itself is enforced by every replica from its own YAML.

An object is owned by the file when the YAML declares its ID. Covered kinds:

Kind YAML Write routes refused
models models[] PUT/DELETE /api/v1/admin/models/{id}, POST .../models/{id}/unpublish
providers providers[] PUT/DELETE /api/v1/admin/providers/{id}
mcp_servers mcp_servers[] PUT/DELETE /api/v1/admin/mcp/servers/{id}
rate_policies rate_policies[] PUT/DELETE /api/v1/admin/rate-policies/{id}
access_groups access_groups[] PUT/DELETE /api/v1/admin/access-groups/{id}
guardrails guardrails[] PUT/DELETE /api/v1/admin/guardrails/{id}
guardrail_policies guardrail_policies[] PUT/DELETE /api/v1/admin/guardrail-policies/{id}
agents agents[] PUT/DELETE /api/v1/admin/agents/{agent_id}
alert_channels alerting.channels[] PUT/DELETE /api/v1/admin/alert-channels/{id}
features every key the YAML writes under features: (not edition defaults) PUT/DELETE /api/v1/admin/features/{id}
price_book a non-empty price_book PUT/DELETE /api/v1/admin/price-book

A write to an owned object answers:

HTTP/1.1 409 Conflict
{"error": {"code": "source_of_truth_file",
"message": "The YAML is the source of truth for models \"chat-default\" (gitops.source_of_truth: file); change the file and reload"}}

Not covered (they keep their own rules): teams, users, keys, organizations, quota policies, custom roles, and the singleton settings with their own revert (cache backend, branding, logging, resilience and the like). Teams and users are imported once with the command below.

In the console, a banner says the file is the source of truth, owned aliases in Model catalog show YAML-owned instead of Edit routing, and any other write to an owned object shows the 409 reason.

Settings & sources → Source of truth → Dry run lists every console row against the file:

  • console override ignored (shadowed): the YAML declares the object, so the row has no effect. Apply deletes it.
  • database only: the YAML does not declare it, so the row stays in effect. Apply deletes it only with gitops.prune: true; otherwise it is kept.

The same through the API or the command line:

Terminal window
curl -sS -b "$COOKIE_FILE" "$BASE_URL/api/v1/admin/source-of-truth"
# {"source_of_truth":"file","prune":false,"version":42,"shadowed":[{"kind":"models","id":"chat-default","reason":"shadowed"}],
# "database_only":[{"kind":"models","id":"console-only","reason":"database_only"}],"digest":"9f2c...","declared":{...},"kinds":[...]}
curl -sS -b "$COOKIE_FILE" -H "X-CSRF-Token: $CSRF" -H 'Content-Type: application/json' \
-d '{"digest":"9f2c..."}' "$BASE_URL/api/v1/admin/source-of-truth/apply"
gateway source-of-truth --plan
gateway source-of-truth --apply 9f2c...

The apply is safe to review:

  • It names the digest of the dry run you reviewed. If anything changed since (another write, a new row, a different configuration version), it answers 409 plan_changed and deletes nothing.
  • Everything is deleted in one transaction; the configuration version moves once and every replica reloads.
  • With prune, the remaining configuration must still validate (for example, no database-only alias left pointing at a pruned provider), or it answers 422 prune_invalid. A database-only alias or access group still named by an active key or a team policy, or a provider a quota still names, answers 409 prune_blocked.
  • A removed price book override is recorded as a revert to the YAML, so the book’s history stays.
  • Each deleted row is audited as source_of_truth.shadowed or source_of_truth.database_only with the actor and the request ID.
  • Who: GET needs config:read; the apply needs features:manage (global admin).

Teams and users are not reconciled continuously. Import them once from a file:

identities.yaml
teams:
- name: Platform
- name: Research
organization_id: org_research # optional; default organization otherwise
users:
- name: Ana Lima
role: team_admin # admin, viewer, operator, user, team_admin or team_viewer
teams: [Platform]
Terminal window
gateway import-identities --file identities.yaml --dry-run # what would be created
gateway import-identities --file identities.yaml --apply
  • A team whose name already exists is reported as existing and left untouched; a new one is created.
  • A user becomes an invitation (72 h, single use), so the person sets their own credential; with console SSO it only pre-provisions them. user_invitations must be on. The output prints each invitation token once: pass it to the person out of band.
  • Running the same file again creates nothing and invites nobody twice (already_invited). Editing or removing an existing team, user or membership is never done by the import.
  • At most 1,000 rows and 4 MiB; unknown fields are refused. Actions are audited with the actor identity-import.
  • The rule applies to declared IDs. Renaming an object in the YAML makes the old console row database-only.
  • Agent kill switches and guardrail policy templates are writes too: on a YAML-owned agent or policy ID they answer 409.
  • An older binary does not know the setting and lets console overrides win again: remove gitops and the flag from YAML before rolling back. No migration.

Every route below needs a console session or an admin Bearer token, the role’s permission and, for writes, the X-CSRF-Token header; the full contract is in the API reference.

Route What it does
GET /api/v1/admin/source-of-truth The dry run: the objects the YAML declares, the console overrides it shadows, the database-only rows and the digest an apply must name. With organization admins on, a team-scoped session gets it without rate policies (organization admins write those for their own teams) and without the digest
POST /api/v1/admin/source-of-truth/apply Deletes, in one transaction, the rows the reviewed dry run lists (database-only rows only with gitops.prune), when its digest still matches

m7gtw[email protected]