← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / docs / upgrading.md

Upgrading from 0.2.x to 0.3.0

中文说明

Read this before the first 0.3.0 start. Two changes cannot be undone by reinstalling the old version. 0.3.0 upgrades the database in place. It also removes the switch that let a local daemon run without an access token.

1. Back up the database first

The first 0.3.0 command that opens the database migrates <data_dir>/openai4s.db from schema 27 to schema 32. Starting the daemon or running openai4s run both do this. openai4s doctor does not: it reads the schema version without opening the database for writing, reports the pending upgrade as a warning (so it does not exit 0) and leaves the database unchanged. openai4s diagnostics does not either: its bundle records the pending upgrade in report.json and leaves the database unchanged. The data directory is ~/.openai4s unless OPENAI4S_DATA_DIR names another one. A pip install, the Linux tarball and the v0.2.0 macOS app all use that default.

The migration copies the database to openai4s.db.v27.bak before it changes anything. It keeps that copy if the migration fails, and deletes it once the migration succeeds. After a normal upgrade, no copy of the 0.2.x database is left.

If the migration fails, the database is rolled back and stays at schema 27, the copy is kept, and the command stops with one error: line that names where the copy is. openai4s serve (with or without --detached) and openai4s run then exit with status 2. Until an upgrade succeeds, openai4s doctor fails its data check (exit 2) and names the kept copy.

If you might want to go back to 0.2.x, make your own copy first:

  1. Stop OpenAI4S: run openai4s stop or quit the app. Check with openai4s status that no daemon is still running.
  2. Copy the whole data directory. It also holds your artifacts, logs and the access token, not only the database:

bash cp -a ~/.openai4s ~/.openai4s-0.2-backup

If the directory is too large to copy, copy at least openai4s.db together with any openai4s.db-wal or openai4s.db-journal file next to it. Copy them while nothing is running. 3. Install 0.3.0 and start it.

The container image keeps its data directory at /data (OPENAI4S_DATA_DIR=/data). That is the openai4s-data named volume in compose.yaml or the openai4s-data PersistentVolumeClaim in deploy/kubernetes.yaml. The 0.3.0 image migrates that database the same way. For Docker or Kubernetes, stop the container (or scale the Deployment to zero) and back up the volume or the PVC before you start the 0.3.0 image.

Migrations 28 to 32 add tables, columns and indexes and remove nothing:

Version Adds
28 the generation id on execution records and a task status on delegated children
29 Auto Mode budget admission
30 delegation requests and attempts
31 model capability receipts
32 an index for browsing artifacts

2. Going back to 0.2.x is not supported

0.2.0 does not check the schema version of the database it opens: it skips migration whenever the stored version is at or above the one it knows. Pointed at a data directory that 0.3.0 has already upgraded, it starts without a warning and writes to that database, but it does not maintain anything migrations 28 to 32 added. Those migrations only add tables, columns and indexes. That does not make the combination supported: nothing checks that the two versions agree about the rows they both write.

To go back, stop 0.3.0 and restore the copy you made before upgrading:

mv ~/.openai4s ~/.openai4s-0.3
cp -a ~/.openai4s-0.2-backup ~/.openai4s

Anything you created under 0.3.0 is not in that copy.

From 0.3.0 on, the refusal exists. A 0.3.x release that opens a database from a newer schema stops before it writes anything and reports future_schema with both version numbers.

3. The access token is always required

0.2.x let a loopback daemon run without a credential when OPENAI4S_REQUIRE_TOKEN=0 was set, and printed a warning that the switch would be removed in the next minor release. 0.3.0 removes it. The variable is ignored, and every daemon requires its access token, including one bound to 127.0.0.1.

4. Other changes you may notice