Restart and upgrade
What a restart does to the Runs, and how to upgrade a server to a new release.
A restart is the whole server's
Boot recovery reads the Run journal of each unfinished Run. A queued Run stays in its queue. A running Run with a checkpoint resumes, and its Progress says "Resumed after a restart". A Run that waits for approval keeps its Request, and the Person's decision continues it.
The journal keeps the transcript and the state of each completed Turn.
A tool call with an outside effect does not run again. The model reads its
recorded result, or an unknown outcome if the call started but did not
record a result. A free call runs again, except a call to a Computer or a
Host.
A Run with no checkpoint fails. A second restart in the same resumed Turn also fails the Run. If that Run waits for a Request, recovery expires the Request and posts a note in its conversation. The Person asks again when the action is still needed.
The restart in the Administration Interface covers every Person. One daemon owns one State Directory and one database.
Upgrade
An upgrade is the compose.yaml of the new release, a new image tag, and a
restart of every service:
cd deploy
# Replace compose.yaml, egress.sh, Caddyfile and tailscale-serve.json with
# the files in deploy/ at the tag of the new release.
sed -i 's/^PAGIS_VERSION=.*/PAGIS_VERSION=<the new release>/' .env
docker compose pull
docker compose up -d
docker compose restart egress proxy tailscaledocker compose up -d starts a service again only when its settings in
compose.yaml and .env or its image change. The egress service runs
egress.sh, Caddy reads the Caddyfile, and the tailscale service reads
tailscale-serve.json only when they start. So
docker compose restart egress proxy tailscale applies the new files.
Compose restarts the services that run and ignores the service of the
profile that is off. egress.sh replaces its rules in one step, so the
Computers keep the policy while the service starts again.
Take a backup first, and restart at a quiet hour.
postgres, klipper-lb, caddy and tailscale get upstream patches
only with a release of Pagis. The compose.yaml of each release pins
their digests, and Dependabot moves the digests between releases. So take
the compose.yaml, the egress.sh, the Caddyfile and the
tailscale-serve.json of the new release, and pull and restart every
service, not only pagis. Keep your settings in
.env, because compose.yaml holds none of them.
The release marker is one-way. The state directory holds a
runtime-release file with the newest release that opened it. A server
reads it before it opens or migrates the database, and refuses to run
when its own release is older:
Pagis 0.1.0 cannot open data already opened by newer Pagis 0.2.0The newer server may have changed the data, and Pagis supplies no database
rollback. To go back to an older server, restore a backup taken before the
upgrade into a new state directory and a new database. Pin
PAGIS_VERSION in .env rather than a moving tag, so a restart never
becomes an upgrade.
The Computer Image is upgraded with the daemon: the release pins it, and a daemon whose pin and image disagree boots no container. When the new daemon starts, it pulls the new image, and an Agent that wakes during the pull waits for it. Then the daemon removes each old Computer Image that no container uses, so the old images do not fill the disk.