Skip to content

Compatibility promise

Two-way compatibility with upstream's langgraph-checkpoint-postgres saver is given up on purpose (ADR-0037). The promise is:

  • Adopt in place. The saver reads every row upstream's saver wrote. Pointing it at an existing database needs no data migration. tests/integration/test_read_upstream_written.py checks it against rows upstream's own saver wrote (tests/corpus/).
  • Upstream cannot read what we write. Once this saver has written to a thread, upstream's saver must not be used on that thread. A rolling deploy avoids that window with full-copies mode (ADR-0009).
  • That failure must be loud. A patch must never look to upstream like a missing channel. Our rows carry type tags that upstream's serde does not know, so upstream raises instead of returning partial state (see patch placement and ADR-0008).
  • Roll back with a command. rehydrate rewrites every patch, every saver-compressed full copy and every saver-compressed pending write as a plain upstream row, and removes the side rows naming them. It runs in batches bounded by bytes and can be resumed. It sets the row in opc_patching_off that tells any saver of ours still running to stop writing patches, so a stale saver cannot undo the rollback. It leaves the thread head rows, which upstream never reads (ADR-0021). After it finishes, upstream's saver reads the database again.

Dropping our tables, and the listing index on checkpoints (opc_checkpoints_root_latest), is a separate manual step, once no saver of ours runs: a saver in full-copies-only mode still writes head rows (ADR-0022). A rewrite may need several times the disk the patched rows used; rehydrate --dry-run reports it first (ADR-0010). The procedure is in Rolling back.

Constructors

The promise covers the tables and from_conn_string, not upstream's constructors (ADR-0042):

Upstream accepts This saver
AsyncPostgresSaver(pool) AsyncOpenPostgresCheckpointer(pool); the pool's connections must be in autocommit mode
AsyncPostgresSaver(conn), one AsyncConnection TypeError. Use from_conn_string(conn_string, max_size=1)
pipe= Not accepted; a put is already one statement
PostgresSaver(conn) or PostgresSaver(pool) OpenPostgresCheckpointer.from_conn_string(conn_string) only; it opens its own pool

Versions

The saver targets langgraph-checkpoint-postgres 3.2.0. It runs upstream's own migration list verbatim under upstream's version numbers and refuses a database whose recorded migration head it does not know (architecture.md ยง3). The supported Python, PostgreSQL and dependency versions are listed once, in Adopting the saver (ADR-0006, ADR-0007).