Centralize SQLite connection configuration (#33938)

## What changed

- Add `SqliteConfig` as the shared entry point for read-write and read-only SQLite pools.
- Apply consistent WAL, synchronization, auto-vacuum, busy-timeout, logging, and pool-size settings to writable Codex databases.
- Route state runtime, audit, CLI, and test database connections through the shared configuration.

## Testing

- Run migration tests against temporary on-disk databases opened through `SqliteConfig`, including the concurrent-writer repair case.

GitOrigin-RevId: e3946b98bde04c47574532ac8b1a7bb2b03edd97
This commit is contained in:
Adam Perry @ OpenAI authored and copyberry committed 2026-07-18 02:06:13 +00:00
1 parent 23899f7cb6
commit 6bd3f5e3db
14 files changed
+220 -166

No files matched your search

+4 -9
View File
@@ -159,9 +159,7 @@ mod tests {
use crate::migrations::STATE_MIGRATOR;
use crate::state_db_path;
use pretty_assertions::assert_eq;
use sqlx::SqlitePool;
use sqlx::migrate::Migrator;
use sqlx::sqlite::SqliteConnectOptions;
use std::borrow::Cow;
#[tokio::test]
@@ -338,13 +336,10 @@ mod tests {
table_name: STATE_MIGRATOR.table_name.clone(),
create_schemas: STATE_MIGRATOR.create_schemas.clone(),
};
let pool = SqlitePool::connect_with(
SqliteConnectOptions::new()
.filename(state_db_path(codex_home.as_path()))
.create_if_missing(true),
)
.await
.expect("open old state db");
let pool = crate::SqliteConfig::new_for_testing(codex_home.clone())
.open_read_write_pool(&state_db_path(codex_home.as_path()))
.await
.expect("open old state db");
old_state_migrator
.run(&pool)
.await