Flag governance: value schemas, custom fields, segment approvals, release automation, AI Config agents

## Value schemas (P-M12)

Embed
Preview of the card
<a href="https://lucidace.com/help/flag-governance"><img src="https://lucidace.com/help/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/2f4b888b-c4e6-488b-81bd-6e838fb12d2e/pages/4e0ca6cb-eaaa-4887-a3bf-9c8aae99498b/social-card.svg?v=3e7ae33eec8b" alt="Flag governance: value schemas, custom fields, segment approvals, release automation, AI Config agents" width="600" height="315"></a>

Value schemas (P-M12)

Each non-boolean flag can have a value schema: a subset of JSON Schema covering type, enum, const, required, properties, additionalProperties, items, minimum/maximum, minLength/maxLength, minItems/maxItems and pattern. The schema can be at most 32 KB and nest at most 16 levels.

  • PUT /v1/projects/{project}/flags/{id}/value-schema with body {"schema": {...}}. The request is refused (400) when any payload the flag serves today breaks the schema.

  • Every later save is checked as well: flag updates, change requests, and the payloads of each variant or remote config. Encrypted payloads are checked in plaintext before they are sealed.

  • GET /flags/definitions carries the schema as value_schema. lucida flags codegen types each payload from it, and the generator fails when a payload breaks it.

  • The flag editor checks payloads against the schema inline as you type.

Custom fields (P-M13)

Org admins define typed fields under Organization settings, in the Custom fields section. The types are text, number, yes/no, single or multiple choice, date, link and person. Each field applies to experiments, flags, dashboards, or any mix of them. Each org can have at most 100 fields.

  • Admins manage fields at GET|POST /v1/orgs/{org}/custom-fields and PUT|DELETE /v1/orgs/{org}/custom-fields/{id}. A field's key and type cannot change after creation.

  • Values are read with GET /v1/projects/{project}/custom-fields/{type}/{id} and replaced with PUT on the same path. The body is {key: value}, and null clears a value.

  • GET /v1/projects/{project}/custom-fields/{type}?field=&value= returns the values of every object of a type, filtered by one field. Objects the caller cannot see are left out.

  • Required fields:

    • An experiment cannot start, and a flag cannot be turned on, until its required fields are filled. The server answers 400 and names the empty fields.

    • A dashboard cannot be shared (POST /dashboards/{id}/shares, the public link) until its required fields are filled. The answer is the same 400.

    • The launch checklist shows them as a failing item.

Segment approvals and scheduled edits (P-M14)

Add segment.update to the project approval policy to put every segment edit behind review. With the policy on, PUT /flag-segments/{id} answers 409 approval-required.

  • Submit the edit with POST /flag-segments/{id}/change-requests. A different admin approves it in Approvals, which applies it. If the segment changed after the request was made, the request fails as stale.

  • To schedule an edit, send POST /flag-segments/{id}/schedules with the segment body plus run_at, which must be in the future and at most a year ahead.

    • When approval is required, the schedule waits in awaiting_approval with a linked change request. Approving the request releases it.

    • The flag-changes job writes due edits. Each one, applied or failed, gets an audit entry (flag_segment.schedule.apply or flag_segment.schedule.fail, system actor) that names the schedule, its author and the change request.

    • Cancel with DELETE /flag-segments/{id}/schedules/{sid}.

Release automation and the rollout timeline

A release pipeline phase can advance on its own. Set these fields on a phase:

  • hold_minutes (5 to 43200): once the phase has been live this long, the guardrail job applies the next phase. If the next phase is gated, the job opens its change request and waits, the same as a manual advance. Leave it empty to advance by hand.

  • guardrail_experiments (at most 10 experiment ids): while the phase is live, these experiments' guardrails must stay healthy. Health is the experiment's last guardrail check.

  • on_breach: what a breach does.

    • pause (the default) stops the automation. The release shows paused with the reason, and a manual advance is refused until someone resumes it.

    • rollback puts every environment in the pipeline back to its state when the release started, then closes the release as rolled_back. Releases started before this feature have no baseline, so they pause instead.

Pause by hand with POST /flags/{id}/release/pause (optional {reason}), and resume with POST /flags/{id}/release/resume. Resuming restarts the current phase's hold.

Alerts in snooze take no automated flag action. Snooze holds the alert's messages and its disable, enable or kill action.

GET /flags/{id}/rollout-timeline?limit=&cursor= lists every move of the flag, newest first, from guarded rollouts, release pipelines and rollout plans. Each entry has its source, the event (started, advanced, auto_advanced, awaiting_approval, paused, resumed, held, acknowledged, rolled_back, aborted, completed), a detail object, and the acting user. The acting user is null when the automation made the move. The flag's Release and Guarded rollout tabs show this timeline.

For guarded rollouts, a guardrail with action notify already pauses the automation until someone acknowledges it, and rollback restores the flag. advance_every_hours is that rollout's hold.

Flag health

Alerting tools can mark a flag, or a whole environment, unhealthy. Admins create a hook with POST /flag-health-hooks ({name, format, signed?, trigger_id?}), or under Flags > Settings > Flag health hooks. The response shows the hook URL, and the signing secret if the hook is signed, only once.

Formats:

  • generic: {flag?, environment?, status: healthy|unhealthy|ok|firing|resolved, reason?, links?}, or an array of these.

  • alertmanager: the Prometheus Alertmanager webhook body. Each alert's labels flag or lucida_flag and environment or env say what it covers. Alerts with neither are skipped. firing means unhealthy and resolved means healthy. The summary or description annotation becomes the reason, and generatorURL and runbook_url become links.

  • watchtower: Watchtower's alert notification, {kind: "alert", firing: [...], resolved: [...]}, using the same labels. Watchtower hooks are always signed.

Signed hooks need Lucida-Signature or X-Watchtower-Signature (t=<unix>,v1=<hmac-sha256 of "<t>.<body>">, 5-minute tolerance). Unknown or revoked tokens return 404.

A report without a flag covers every flag in that environment. An undismissed unhealthy state puts an "Unhealthy" badge on the flags list and a Health panel on the flag page, with the reason, the links and the history (GET /flags/{id}/health, GET /flags/{id}/health/history?limit=&cursor=). POST /flags/{id}/health/dismiss ({environment?}) dismisses the flag's own states until the status changes. Each status change emits a flag.health_changed notification event. If the hook has trigger_id, a report that turns unhealthy also fires that flag trigger's action (kill, disable or enable). It fires only for the trigger's flag, or for an environment-wide report.

AI Config agent mode (P-M49)

An AI Config variation can use "mode": "agent". In agent mode the payload carries instructions (at most 100k characters) and tools: at most 50 entries, each {name, description?, parameters?}, with unique names matching [A-Za-z0-9_-]{1,64}. Agent mode payloads have no messages. The default completion mode keeps messages and forbids instructions and tools.

The SDK helpers fill {{variable}} placeholders and fall back to a default config when the flag is off:

  • JS aiConfig()

  • Python get_ai_config()

  • Java getAiConfig()

  • .NET GetAiConfigAsync()

Lucida does not record LLM calls. That is LLM observability, which Watchtower owns.

Updated