pg: Gateway conversations on Postgres #105
Notifications
Due Date
No due date set.
Blocks
Depends on
Reference: sam/archie#105
Reference in new issue
Block a user
Move internal/gateway session store (sessions, messages, turns; conversationDBPath) to the Postgres server in a schema the Gateway owns, keeping the rule that the daemon and Gateway never own the State Store's tables.
Notes
2ic ruling (approved): Preserve current turn-recovery semantics and support a single serving Gateway only. Hold a PostgreSQL advisory serve-ownership lock for the full Gateway serving lifetime; fail startup if another Gateway holds it. Do not let RecoverTurns mark another live process owner failed. Multi-Gateway lease/adoption semantics are out of scope and need a separate design.
2ic clarification: retain nanosecond timestamp behavior in the existing cursor contract for this migration by refusing import on any source/target ordered-ID mismatch; no event-id renumbering or schema widening without collision evidence and a separate decision.
From 7r0x.9: when the Gateway opens its Postgres pool in production, claim serve ownership with postgres.AcquireOwnership(ctx, pool, 'gateway') held for the process life and released at orderly shutdown (2ic ruling on 7r0x.9). The State Store wiring in internal/app/archied/state_store_pool.go is the pattern.
Close reason
Closed
Imported from beads
archie-core-7r0x.5· GitHub #1016 · type task · priority P1 · created 2026-09-23 · closed 2026-09-28