Multiplayer agent harness for work.
Let notebooks without a records column migrate into fact rows (#2400)
Anurag Goel7305ac28c689
diff --git a/src/memory/postgres-memory-service.ts b/src/memory/postgres-memory-service.tsindex 95d680faa..700b95b57 100644--- a/src/memory/postgres-memory-service.ts+++ b/src/memory/postgres-memory-service.ts@@ -82,7 +82,13 @@ const LIVE = `SELECT id, text, sensitivity, sources, source_unknown, author, creFROM memory_facts WHERE scope_id = $1 AND deleted_at IS NULL ORDER BY id`;export function createPostgresMemoryService(connectionString: string): MemoryService {- const { q, pool } = createPgPool(connectionString, [{ id: "memory/facts/0001", statements: SCHEMA }]);+ const { q, pool } = createPgPool(connectionString, [+ {+ id: "memory/facts/0000-records-column",+ statements: ["ALTER TABLE IF EXISTS memory_revisions ADD COLUMN IF NOT EXISTS records JSONB"],+ },+ { id: "memory/facts/0001", statements: SCHEMA },+ ]);function tx(client: PoolClient, scopeId: ScopeId): FactStoreTx {return {diff --git a/test/postgres-memory-service.test.ts b/test/postgres-memory-service.test.tsindex 67c08e26c..773b7e14d 100644--- a/test/postgres-memory-service.test.ts+++ b/test/postgres-memory-service.test.ts@@ -71,6 +71,21 @@ test("pg memory: notebook snapshots migrate into one row per fact, in order", {assert.equal(legacy[4]!.createdAt, at);});+test("pg memory: notebooks written before the records column migrate into fact rows", { skip }, async () => {+ await sql(`CREATE TABLE memory_revisions(id BIGSERIAL PRIMARY KEY, scope_id TEXT NOT NULL, seq BIGINT NOT NULL,+ op TEXT NOT NULL, body TEXT NOT NULL, author TEXT, at BIGINT NOT NULL, UNIQUE (scope_id, seq))`);+ await sql("INSERT INTO memory_revisions(scope_id, seq, op, body, at) VALUES ($1, 1, 'replace', $2, $3)", [+ "personal:U3",+ "# Memory\n- (2026-04-01) Owns billing\n",+ at,+ ]);+ const memory = createPostgresMemoryService(URL!);+ assert.deepEqual(+ (await memory.facts!("personal:U3")).map((fact) => fact.text),+ ["Owns billing"],+ );+});+test("pg memory: add, edit and delete by id; a bad id rolls back the whole call", { skip }, async () => {const memory = createPostgresMemoryService(URL!);const sid = scopeId("personal", "U1");