OpenBot is live. People run released apps (the web app, OpenBot Desktop, OpenBot Mobile, the Recorder) against released servers, and they don't all upgrade on the same day. Every change has to keep working for them.
Read this before you change anything under api/, an app's requests, the server's database, or
release-policy.json. This applies to every contributor and every coding agent, every time. It is
not optional.
This page is the rules. The detail behind them is in api-versioning.md and api/README.md. Where they say more, they win.
- A server serves every app released in the last 12 months. An app works against any server released in the last 12 months. The window is time, not a count of releases.
- OpenBot Desktop upgrades its own server at the next Start, so the app is often newer than the server it runs.
- OpenBot Cloud runs one server for every app version people have. During a rolling upgrade, the old release's servers and the new one's share one database.
- A failed upgrade puts the previous server back on a database the new one may have partly migrated.
-
/api/v2only grows. Add things. Never remove, rename or change in place. -
Never remove or rename an operation, path, parameter, field, enum value, channel or message that a released app uses.
-
Never change what an existing thing means: a field's type or format, what
nullor a missing field means, a default, the status code, problemcodeor problem type of an existing outcome, paging, sorting, the shape of a cursor, or the scope an operation needs. -
New request inputs are optional, and leaving one out does what happens today. Never make an optional input required. Never tighten validation on a request (a shorter maximum, a new pattern, a narrower enum).
-
Response enums that will grow are open from the start:
x-extensible-enum, notenum. Only an open enum may gain a value. An enum a client sends, or sends back as it read it, staysenum; the answer gets its own open copy (PersonRoleAnswerforPersonRole). -
Replace beside the old, then deprecate the old. Mark it
deprecated: truewithx-deprecation-dateandx-sunset(bothYYYY-MM-DD), the sunset at least 365 days out. Say in its description what to use instead. Name it in the pull request's release note, under## Changelogin its description; the release writes it intoCHANGELOG.md. How: api/README.md, "Deprecating".cron: type: string deprecated: true x-deprecation-date: 2026-12-01 x-sunset: 2027-12-01 description: Deprecated. Send `schedule` instead.
-
Remove it only when both are true: its sunset has passed, and nothing has used it for the last 12 months. A response property can't be counted, so its sunset alone decides. A sunset only ever moves later.
-
A change that can't go beside the old needs a new major,
/api/v3, served beside v2. None exists today. -
Every app is a tolerant reader. It ignores a field it doesn't know. It reads an enum value it doesn't know as "other", and never sends one back. It shows a feature only when the server's
deploymentanswer offers it, never by comparing versions. -
Edit the area files under
api/openapi/, never the bundle. Runbun run api:generateand commit the sources,api/openapi.yamland the generated clients together.
| Change | Allowed? |
|---|---|
| A new operation, or a new field in an answer | Yes |
| A new optional request field whose absence keeps today's behaviour | Yes |
| A new value in a request enum, or a longer maximum length | Yes |
A new value in a response enum declared x-extensible-enum |
Yes |
A new value in a response enum declared enum |
No. Add a new field, or open the enum first. |
Rename cron to schedule |
No. Add schedule, accept both, deprecate cron. |
| Make an optional field required | No. Keep it optional; give the server a default. |
| Answer an existing "not found" with 410 instead of 404 | No |
Change a refusal's problem code |
No. A new situation may get a new code. |
| Remove a deprecated operation after its sunset, unused for 12 months | Yes |
More cases: api-versioning.md, "Worked examples".
bun run api:generate # then git status: nothing may change
bun run api:lint
git show origin/main:api/openapi.yaml > /tmp/base-openapi.yaml
oasdiff breaking /tmp/base-openapi.yaml api/openapi.yaml --flatten-allof \
--deprecation-days-stable 365 --deprecation-days-beta 365 --fail-on WARN \
--err-ignore api/accepted-breaking-changes.md --warn-ignore api/accepted-breaking-changes.md
git show origin/main:api/asyncapi.yaml > /tmp/base-asyncapi.yaml
bun run api:live:diff /tmp/base-asyncapi.yaml api/asyncapi.yamlCI's API spec job runs all of these, and also holds the spec to every release of the last 12
months and to the 12-month window (scripts/support-window.ts). What each failure means, and the
right fix: api-versioning.md, "What CI enforces".
api:live:diff judges every message in api/asyncapi.yaml as one the app reads, since it doesn't
know which way a message goes. So a new value in an enum the app sends (a Bot's screen's mouse and
keys) fails it, though the table above allows it in a request: list that change in
api/accepted-live-breaking-changes.md, saying the app sends it. A new value of an
x-extensible-enum may go anywhere in its list; taking one out fails.
Never make CI pass by listing a change in api/accepted-breaking-changes.md that takes something
from a client. A line there is only for a change no client can notice: the server already refused
what the spec now forbids, or no release serves the operation yet.
- The previous release keeps working. Every database change in a release leaves a database the previous release's server still works against.
- Expand in any release: a new table, a new nullable column or one with a constant default, an index built concurrently, a new enum value.
- Contract only in a later release: dropping or renaming a table or column, changing a type,
making a column
NOT NULL, dropping an enum value. Only for what a release that is already out stopped reading and writing, and the migration names that release. - Backfill so no write is lost. A backfill is safe to run twice. It runs in the release that expands, and again in the release that contracts, before the drop.
- The API comes first. If a database change removes something the API returns, the API change ships beside the old one and goes through deprecation. The database keeps both shapes until the old API is gone. The contract comes after that, never before.
- No long locks. Set a lock timeout and a statement timeout. Build an index on a table that has
rows
CONCURRENTLY. Add a constraintNOT VALID, then validate it. - Forward only, backup first. No down migrations. Every upgrade that changes the database takes
a backup first, and recovery is restoring it (
"recovery": "restore-backup"). - A merged migration is never edited, renumbered or deleted. A database that ran it refuses to migrate once it changes. Fix forward with a new migration.
- Downtime is the rare, declared exception. A release that truly can't keep rule 1 says
"requiresDowntime": trueinrelease-policy.json, and the chart it ships says the same. Publishing refuses the two disagreeing.
Each release's release-policy.json says which releases and databases it upgrades from.
compatibility.database.tois the last migration this release's server applies.compatibility.database.fromis the last migration of each starting release.upgrade.fromVersionslists the starting releases: every release an installation may be on when it takes this one, release candidates people installed included.
Publishing checks to and from against the migrations themselves, and a refusal names the value
to write. When a candidate is installed, its version joins fromVersions and its last migration
joins database.from (1.2.0 added v1.2.0-rc.1 and 0161_ai_connection_shared_sign_in).
The management agent upgrades only along the policy (planUpgrade in shared/release-manifest.ts).
It refuses:
- a starting release not in
upgrade.fromVersions; - a starting database not in
compatibility.database.from; - a
launcherApi,configSchemaorextensionApithat differs from the installation's; - a capability the release needs that the installation lacks.
Before an upgrade that changes the database, it confirms where the backup goes and takes the
backup. If it can't confirm that, it changes nothing. It never rolls a database back by itself: a
restore-backup recovery needs a person.
The Desktop upgrade workflow runs OpenBot Desktop's own upgrade from real published releases,
with the data they wrote, to your tree: on a pull request from the previous release, and nightly
from every release of the last 12 months. It fails when what the old release wrote doesn't read back
or a migration runs twice. Fix the change, never the list of releases.
- I read this page.
- Nothing a released app uses is removed, renamed, retyped or tightened in place.
- New request inputs are optional; a response enum that will grow is
x-extensible-enum. - Anything replaced is deprecated with an
x-sunsetat least 365 days out, and named in the release note under## Changelogin this pull request's description. - Nothing new in
api/accepted-breaking-changes.mdtakes anything from a client. -
bun run api:generaterun, and sources, bundle and clients committed together. - Every database change is an expand, or a contract of what a release already out stopped using. No merged migration is edited, renumbered or deleted.
-
release-policy.jsonnames the rightdatabase.to,database.fromandfromVersions. - CI's
API specjob is green on the exact head.