Upgrade notes
What an operator upgrading an existing deployment needs to know. A new installation starts from an empty database and can skip this page. The deployment order and rollback are in rolling deployment order and deployment reliability.
Before starting this release
Before starting this release, run alembic upgrade head. The supported
deployment scripts migrate before replacing the API, so the control plane being
replaced serves on the new schema until then. A migration it cannot serve on is
listed below, and is applied with the writers stopped, as
applying migrations that are not backwards-compatible
describes. After migrating, start the main control-plane listener with its
complete existing environment, so it imports newly registered settings once
(Admin Settings).
The MCP revocation endpoints are dropped
0121_drop_mcp_revocation drops revocation_endpoint from
agent_mcp_connections and agent_mcp_oauth_flows. Nothing has read or written
them since #1198, but
a control plane from before it selects and writes both: if one is still serving
when the migration runs, its MCP connection reads and authorization flows fail
until it is replaced, and with them MCP tools. Apply it with the writers
stopped, or accept those failures for the length of the deployment. Each drop
changes only the catalog: it rewrites no row and holds its table’s lock only
for that change. The downgrade adds both columns back, empty.
Goal rounds no longer wait for goal_report_v1
0122_drop_goal_report_routing removes goal_report_v1 from every turn’s
metadata.requires, and removes requires where nothing else is left in it.
Goal rounds wrote the requirement, and every later turn of their conversation
copied it. Hosts of this release no longer advertise the capability, so a
queued turn that still named it would wait for a host that never comes; a host
of the previous release still advertises it, and runs the rewritten turns as
it would any other. Until its replacement serves, the control plane being
replaced still writes the requirement into each goal round it queues, so apply
the migration with the writers stopped, or apply it once more afterwards. Its
downgrade changes nothing, so alembic downgrade 0121_drop_mcp_revocation
followed by alembic upgrade head repeats it. It updates, and locks, only the
rows that name the capability.
Indexes for the MCP history and the tool counts
0123_mcp_history_tool_counts builds three indexes concurrently: (job_id, id)
and (thread_id, id) on agent_mcp_invocations, and
(job_id) WHERE event_type = 'tool_use' on agent_job_events. It changes no
rows and blocks no reads or writes; the event index’s build reads the whole
event table, so it takes longer on a long history. The control plane being
replaced keeps serving while they build. An interrupted build is dropped and
retried, and the downgrade drops the three indexes concurrently.
Lease renewals update their rows in place
0124_hot_lease_renewals lets lease renewals update their rows in place (HOT
updates). It builds partial indexes concurrently on agent_attempts (id) for
running attempts and on agent_thread_sandbox_memberships (thread_id) for hot
residencies, then drops idx_agent_attempts_expiry and
idx_agent_memberships_hot_residency, whose keys every renewal changed, and
sets fillfactor = 85 on both tables. It changes no rows and blocks no reads
or writes: the builds, the drops and the fillfactor change take only
SHARE UPDATE EXCLUSIVE. The fillfactor applies to pages written from now on
and nothing rewrites the tables, so a live row on a full page moves once, by an
ordinary update, before its renewals stay in place. The control plane being
replaced keeps serving; with many hot residencies, its residency reaper may
read every sandbox group on its 30-second pass until it is replaced (73 ms
instead of 10 ms, measured with 10,000 hot residencies among 300,000 groups).
An interrupted build is dropped and retried, and offline SQL builds the indexes
plainly. The downgrade restores the expiry indexes concurrently and resets the
fillfactor; pages already written keep their free space.
Sandbox groups are marked changed once per transaction
0125_admin_sandbox_marker_guard replaces 0097’s
agent_mark_admin_sandbox_change so a transaction that writes a sandbox group
several times marks it changed once: the marker’s upsert now skips a marker
that already names the writing transaction. A host heartbeat writes a running
group’s terminal count and resource reading in one transaction, and rewrote its
marker for each write. What the admin inventory reads is unchanged. Only the
function changes, and the control plane being replaced keeps serving under it.
The downgrade restores the 0097 function.
The audit trail’s rollout trigger is dropped
0126_drop_audit_rollout_trigger drops agent_admin_audit_attribute_legacy,
the trigger 0114_admin_audit_attribution added to fill in the target and
outcome of audit rows written by the release before it. Every release since
writes them itself. A row the trigger failed on and left without them gets the
target unknown (or the user it affected) and an outcome from its success,
and target_type, target_id and outcome become NOT NULL. That step holds
agent_admin_audit_log’s exclusive lock while it reads the table once. The
control plane being replaced fills all three on every row, so it keeps
recording actions while the migration runs. The downgrade makes the columns
nullable again and restores the trigger as 0114 made it.
Provided models lose their retired limits and budgets
0127_drop_operator_allowances drops what provided models kept for request
limits, budgets and per-account access, none of which anything reads:
user_daily_requests, global_concurrency and named_only from
agent_operator_model_limits, which keeps each model’s prices; default_model,
is_default with its unique index, end_user_header, user_concurrency and
user_daily_budget_microusd from agent_operator_model_connections; and the
tables agent_operator_model_user_limits, agent_operator_model_user_access
and agent_operator_user_budgets. Their contents are lost; no row of what
stays is rewritten. The control plane being replaced writes
user_daily_requests when it prices a model and deletes from two of the
tables when a connection stops listing one, so until its replacement serves,
adding a connection under Admin → Settings → Models, editing one or
reading its models again fails; apply the migration with the writers stopped,
or leave those connections alone during the deployment. The downgrade puts
every column, index and table back, empty or at its default.
Work notifications name their turn, or the pinned host
0129_work_wake_targets replaces 0092’s agent_notify_work_available. A
notification for work any host may take now names the turn (: and the job’s
id; for a turn that ended, the next queued turn of its conversation), so the
control plane can tell which claim took it. While the new-chat placement pin
names a host, a turn of a conversation with no group yet names that host
instead, so only it is woken. No row changes and no table is locked: only the
function changes. The control plane being replaced reads a payload that names
a turn as a host name and wakes no host for it, so until its replacement
serves, its idle hosts find such work when their waits time out, within five
seconds; work for one host still wakes that host. The downgrade restores the
0092 function.
Stored events wake their streams after the commit
0130_drop_event_notify_trigger drops agent_job_events_stored, the trigger
0030_job_event_notify added to notify agent_job_events of every stored
event, and its function. Postgres commits one notifying transaction at a time,
so every event upload of every running turn waited on that one lock. The
control plane now wakes a job’s event streams itself once an upload has
committed, and its listening connection tells its other processes at most once
every 25 ms; the usage push a model call sends left the upload’s transaction
the same way. A job’s change of state still notifies through its trigger.
Dropping the trigger takes agent_job_events’s exclusive lock for that step
alone: it waits for the reads and uploads already running on the table, and
those that arrive meanwhile wait behind it. It waits at most five seconds
(lock_timeout); if a long read holds the table that long, the migration fails
and changes nothing, and alembic upgrade head can run again once the read is
done. No row is rewritten. The control plane being replaced keeps serving and
still pushes usage, but it relied on the trigger to wake its open chats: until
its replacement serves, they show a new event at their 15-second backstop read
instead of at once. Nothing is lost. The downgrade puts the trigger and its
function back as 0030 made them.
To roll the control plane back past this change, run
alembic downgrade 0129_work_wake_targets first, then deploy the older code.
That code does not wake event streams itself, so on a schema without the
trigger its open chats would show each new event only at their 15-second
backstop read. This release serves on the downgraded schema too: the trigger
only wakes its streams a second time.
Thread statistics resume from a stored reduction
0131_thread_stats_resume_state adds a nullable state column to
agent_attempt_thread_stats, the cache of each attempt’s thread statistics.
It rewrites no row and holds the table’s lock only for the catalog change. The
cache now keeps, beside each rollup, the reduction it came from, so a
thread-statistics read and the usage push that follows each model call reduce
only the events after it, not the whole attempt. Rows cached before name the
previous reducer version, so each attempt is reduced once more from its first
event the next time it is read, which takes as long as every read did before.
The control plane being replaced neither reads nor writes the column and keeps
serving; while both serve, each treats the other’s rows as stale and reduces
them again, and every answer stays exact. The downgrade drops the column, and
an earlier release reduces the rows this one wrote once more.
Five tables nothing reads are dropped
0132_drop_orphan_tables drops agent_user_model_preferences (a pin of a
model from the Gateway’s catalog, which chooses nothing),
agent_pr_archive_checks (archiving on merge, removed in #736),
agent_sandbox_snapshots and agent_snapshot_jobs (the platform publisher’s,
removed in #1103) with their two trigger functions, and
agent_mcp_catalog_cache (the MCP catalogue’s cache before 0061;
agent_mcp_catalog_snapshots stays). Their contents are lost. The control
plane being replaced reads none of them and keeps serving. Dropping the two
publisher tables also locks agent_sandboxes and agent_jobs; each lock is
waited for at most five seconds, so a long read makes the migration fail and
roll back with nothing changed, and it can be applied again. The downgrade
puts every table, trigger and function back, empty.
The background workers’ wake-ups are dropped
0133_drop_background_wakeups drops the six triggers that notified
agent_background_work when a job or attempt finished, a member’s turn ended
or a sandbox group’s snapshot state moved, and their functions
agent_wake_background_from_trigger and agent_notify_background. Nothing has
listened on that channel since the snapshot, publish and ledger workers were
removed. It changes no rows, and the control plane being replaced keeps
serving. Each trigger’s table lock is waited for at most five seconds, so a
long read makes the migration fail and roll back with nothing changed, and it
can be applied again. The downgrade puts the triggers back.
The runner lease’s late import is finished
0134_finish_late_settings_import settles each host that was never offered
the runner lease (AGENT_LEASE_TTL), which became a host setting after hosts
had imported their own values once: one whose last report carries a lease (41
to 900 seconds, not the default 120) that no administrator has set or reset,
for that server or for every server, gets it as that server’s setting now; one
whose last report predates the lease setting has its first import opened again,
so its next complete heartbeat imports whatever it reports that no
administrator has set or reset. It changes only those hosts’ rows, and the
control plane being replaced keeps serving. settings_late_imported, which
recorded who had been offered the lease, stays until a later revision drops
it: this release no longer reads it, and the release being replaced reads it
on every heartbeat. Running the migration again changes nothing. Its
downgrade records every host whose first import is complete as having been
offered the lease, as the release before this one expects, so that release
imports no lease late after a rollback.
The attempt’s Gateway grant is dropped
0135_drop_attempt_grant drops grant_id and its index from
agent_attempts, and the two triggers that told an owner’s tabs when an
agent_attempt_ledger row changed, with their function
agent_notify_usage_changed. Nothing has written the column or the ledger
since the Gateway’s grants were removed, so neither trigger could fire; the
Usage pages read what agents report. The column’s contents are lost. The
ledger, and the grant columns of agent_thread_sandbox_memberships and
agent_session_forks, stay until a later revision drops them: this release
reads none of them and only clears the membership’s two when it mints a
residency, and the release being replaced writes them when it opens or renews a
residency, admits a turn or prepares a Fork. The control
plane being replaced keeps serving. Each table’s lock is waited for at most
five seconds, so a long read makes the migration fail and roll back with
nothing changed, and it can be applied again. The downgrade puts the column,
its index, the function and the triggers back.
Sandbox groups lose their snapshot state
0136_drop_sandbox_snapshot_state drops snapshot_state from
agent_sandboxes. Nothing has moved it since the platform publisher was
removed (#1103): a group created since stays quiescent, and one an earlier
release left pending, snapshotting or importing stays there. The
lifecycle trigger no longer records it in a new group’s created event or as
a snapshot_state_changed event; events already recorded stay. Admin’s
sandbox answers no longer carry snapshot_state, and the database browser no
longer lists it. The control plane being replaced reads the column in its Admin
sandbox views and in its database browser’s agent_sandboxes, so until its
replacement serves, those fail; apply the migration with the writers stopped,
or accept that for the length of the deployment. The table’s lock is waited
for at most five seconds, as above. The downgrade puts the column back, every
group quiescent, and records its changes again.
Rows only an earlier release wrote are settled
0138_settle_older_release_rows settles what only an earlier release left:
a queued follow-up of a successful turn whose conversation never had a sandbox fails, with the detail the periodic sweep gave it, and an active goal of that conversation pauses;
an environment snapshot that a test run saved is retired, and its host deletes the object;
a conversation from before environments gets an environment binding that carries its setup script and is not required, so its turns run as they did: the script runs when a workspace is made, and never again in one it already ran in;
a renewal policy saved without a move-out window gets the default, two hours.
It also drops what neither this release nor the one before reads or writes:
the user-run MCP connector tables (agent_mcp_connectors,
agent_mcp_connector_connections) with agent_mcp_connections.connector_id,
agent_mcp_legacy_bindings and agent_jobs.published_commit_sha. It waits at
most five seconds for each of its locks on agent_threads, agent_jobs and
agent_mcp_connections; on a timeout it changes nothing and can be applied
again. The control plane being replaced keeps serving on it. The downgrade
puts the dropped schema back, empty, and leaves the settled rows as they are.
MCP servers must speak Streamable HTTP
The MCP relay speaks Streamable HTTP only: the HTTP+SSE transport of MCP
2024-11-05 is gone. A connection saved on it (http-sse) fails with an error
that asks for the server’s Streamable HTTP address, and a new one is refused,
in an import too. An address that refuses POST with 404 or 405 is reported as
not accepting Streamable HTTP. Before upgrading, delete each such connection
and add it again with the server’s Streamable HTTP address (often /mcp
instead of /sse).
Compute profiles live only in Admin
AGENT_COMPUTE_CONFIG, AGENT_COMPUTE_DIRECTORY, docker-compose.compute.yml
and the deployment: secrets mounted with them are no longer read. Before
upgrading, register each file-backed profile in Admin → Servers (advanced
manual setup), and release any server set up from one: its stored setup names
deployment: references and bundle paths that this control plane refuses, so
it cannot be rolled forward. Then remove both variables and the private
compute directory. The poll and observation cadences come from Admin settings.
The settings root is read only as AGENT_SETTINGS_ENCRYPTION_KEY
AGENT_SESSION_SECRET is no longer read as the settings root key. If it was
this deployment’s root, because AGENT_SETTINGS_ENCRYPTION_KEY was never set,
set AGENT_SETTINGS_ENCRYPTION_KEY to the same value before upgrading: the
key is the value, not its name, so every saved setting stays readable. Then
remove AGENT_SESSION_SECRET from .env, and its file from the agent-keys
volume if it was stored there. Until then deploy.sh, the keys service and
the control plane refuse to start, and say so.
Retained chats need a current image
Hosts no longer migrate or repair a retained container that an earlier build laid out:
Codex, OpenCode and Kilo provider homes left in
/agent-state/<cli>-membersare no longer moved, so a container that still has them starts those members fresh.A container whose image lacks
/usr/local/bin/member-process-reaperis refused, andAGENT_MEMBER_PROCESS_REAPER_SOURCEis gone: remove it from any.env.A container without the MCP gateway or the browser launcher logs a failure.
Agent versions downloaded under the former shared repository name
<namespace>-agent-runtimeare no longer used or cleaned up. Remove them withdocker image rm; they carry this deployment’s namespace label.Admin → Servers and the capacity answer no longer count chat containers without a namespace label; such a container is skipped like another deployment’s.
A host also refuses a heartbeat answer without runtime_downloads,
runtime_registry_url or sandbox_archive_settings, and a registration answer
without status. The control plane of this release always sends them, so
deploy hosts with their control plane, as always.
A local stack needs an exact deployment SHA
deploy/local/dev.sh no longer turns an AGENT_DEPLOYMENT_SHA of the form
local-… in deploy/local/.env.local into unknown: it stops and asks for
unknown or an exact 40-character commit. Set it to unknown, or regenerate
the file.
The usage collector’s setting is gone
Usage idle check interval (ledger_idle_s) under Admin → Settings
paced the usage collector, which went with the Gateway’s grants. Nothing has
read it since; a value an administrator saved is ignored.
A sign-in from before browser sessions ends
A session cookie is now read only as a browser session, which holds the
browser’s signed-in accounts. A cookie from before browser sessions (#1135),
naming a single account’s session, no longer signs anyone in: its holder signs
in again, and nothing else of theirs changes. Such a cookie can still be live
for up to Session lifetime (accounts.session_ttl_days, 30 days by
default) after the sign-in that set it. The session rows stay until they
expire, as every session’s do.
Answers kept for older clients are gone
The web app of this release reads none of these; a script that calls the API may:
GET /v1/agent/jobs/{job_id}/threadno longer copies the waiting queue (pending_messages,pending_messages_complete,queue_paused_reason), nor sendshistory_version. Read the queue fromGET /v1/agent/threads/{thread_id}/messages.GET /v1/agent/usage/resourcesandGET /v1/agent/usage/tokenstake onlyrange(today,7d,30dorall).days=Nandall=trueare no longer read: a request with only them reads7d. The answer’speriodalways names itspresetand no longer hasdays.GET /v1/auth/optionsleavesterms_textempty, liketerms_url, when the deployment’s Terms files are in use; the files are interms_by_locale.
The bundled Postgres runs with production settings
The control plane’s postgres service no longer runs on PostgreSQL’s stock
settings. It sets these on its command line
(how to change them):
Setting |
Before |
Now |
Change with |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The container’s |
|
|
|
Durability is unchanged. The first deploy of this release recreates
postgres once, in the prepare-database phase while the previous API is
still serving, so Postgres is unavailable for the few seconds of the restart;
the running services reconnect by themselves. Compose now gives Postgres a
minute to stop instead of ten seconds, so that it can finish its shutdown
checkpoint. After a crash, Postgres replays the WAL written since the last
checkpoint before it accepts connections, and with checkpoints a third as
often that can take longer.
Before deploying:
Make sure the disk that holds the
agent-postgresvolume has room for 3 GB more WAL: under sustained writes the WAL directory can now grow to 4GB instead of 1GB. On a small disk, setAGENT_POSTGRES_MAX_WAL_SIZElower.Check whether these settings were tuned on this server. Command-line settings override
postgresql.confandALTER SYSTEM, so this release replaces any value set there:docker exec -i cloudagent-postgres-1 sh -c 'exec psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -At' <<'SQL' SELECT name, setting, unit, sourcefile FROM pg_settings WHERE name IN ('shared_buffers', 'work_mem', 'max_wal_size', 'checkpoint_timeout', 'wal_compression', 'random_page_cost') AND source = 'configuration file'; SQL
shared_buffersat 128MB andmax_wal_sizeat 1GB inpostgresql.confare what initdb wrote. Any other row is a value someone chose. Setshared_buffersandmax_wal_sizeagain with their variables, andwork_memandrandom_page_costwithALTER DATABASE;checkpoint_timeoutandwal_compressiontake the values above.
Control-plane logs rotate, and the edge reuses its connections
Every service in the control plane’s Compose file now logs to Docker’s
json-file driver with rotation, at most five files of 100 MB each
(the edge and request logs). Unless
the Docker daemon limited them, these logs grew for as long as their containers
lived. The first deploy of this release recreates every service once.
postgres is unavailable for the few seconds of its restart, and edge, where
its profile is enabled, starts with its new configuration: connections kept
open to the control plane and the web app, gzipped JSON, and buffered answers
except the event streams and the workspace archive.
A service’s logging takes precedence over the Docker daemon’s defaults in
/etc/docker/daemon.json. If the daemon sends container logs elsewhere
(log-driver) or rotates them at other sizes (log-opts), set that driver or
those sizes for each service in your Compose override
(AGENT_CONTROL_PLANE_COMPOSE_OVERRIDE_FILE) before you deploy. Otherwise these
services log to json-file at the sizes above. A different driver replaces the
rotation options.
The old web addresses are gone
/integrations, /admin/accounts and /admin/teams only redirected to pages
that had moved, and the web app no longer serves them. An MCP authorization
now returns straight to /settings/plugins, and GET /v1/agent/config
reports /settings/integrations as its github_install_url. A bookmark of an
old address, or a link to one in mail sent before the pages moved, now gets
the web app’s 404 page: use Settings and Admin → Users instead. If a
GitHub App’s optional Setup URL points at /integrations, point it at
/settings/integrations; its Callback URL, /connected?provider=github, does
not change.
The bundled database is the one AGENT_POSTGRES_DB names
The bundled postgres service’s healthcheck, pgAdmin’s bundled server and the
documented backup, drain and undrain commands open the database
AGENT_POSTGRES_DB names (cloudagent by default). A deployment that went
through the cutover on the bundled service by
pointing AGENT_DATABASE_URL at a new database there, and left
AGENT_POSTGRES_DB unset, still has all of them on the archived database:
pgAdmin and psql show its old state, and the documented backup dumps it. The
keys service warns at every start while the two differ. To fix it:
Set
AGENT_POSTGRES_DBin.envto the databaseAGENT_DATABASE_URLuses, and deploy. Postgres restarts with its healthcheck on that database. Both databases stay, sincePOSTGRES_DBcreates nothing in a data directory that already holds one.In pgAdmin, edit the server it imported at its first setup and set its maintenance database to the same name.
Take a new backup. Every dump taken before step 1 is of the archive.
Optionally, rename the archive so nothing opens it by default, for example
ALTER DATABASE cloudagent RENAME TO cloudagent_archive, run from another database with no session on the archive. Record the new name with its dump and keys.
Independent accounts cutover
Cloud Agent keeps its own accounts. HybridInference Gateway sign-in, admission and inference are gone (accounts guide), and two things from that era are refused:
A Gateway variable. The control plane stops at startup, and
deploy/control-plane/deploy.shbefore it pulls anything, when the environment sets one of the retired Gateway variables. Remove it.AGENT_SESSION_REDIRECT_URIwas also this API’s public address: setAGENT_PUBLIC_API_URLto it without/v1/session/callback.A Gateway-era database, whose owners are Gateway user IDs that no account holds. It is not upgraded, converted or mapped. Keep it untouched as an archive, with its dump, configuration and root keys, and point
AGENT_DATABASE_URLat a new, empty database, where people register, apply and add their model connections again.deploy.shchecks the database read-only before it migrates and stops on such a database; to check one yourself:AGENT_DATABASE_URL='<database>' python -m cloud_agent.deployment.identity_namespace --check
It exits non-zero on a Gateway-era database and changes nothing.
When a change needs a note here
Describe it here in the same pull request:
a migration: which existing rows it changes, how long it can lock, whether the control plane being replaced can serve on it until its replacement, and whether its downgrade refuses;
a
.envline an upgraded deployment can then delete;a new pinned Postgres or nginx image, which the next deploy restarts that service on.
A note stays until every deployment has upgraded past it.