Honor the configured SQLite home across state consumers (#34994)

## Why

Codex and SQLite data can use separate home directories, but state consumers
could reconstruct database paths from the Codex home instead of consistently
using the resolved SQLite configuration.

## What changed

- Pass `SqliteConfig` through the core, rollout, state runtime, and thread store
  instead of passing a directory and rebuilding the configuration downstream.
- Use that shared configuration for state, logs, memories, goals, and paginated
  thread-history database access, including integrity checks and cleanup.
- Reject state database handles whose SQLite configuration does not match the
  requesting store.

## Testing

Add coverage with separate Codex and SQLite homes that verifies startup
backfill, thread listing, and paginated history all use the configured SQLite
directory.

GitOrigin-RevId: 1de1cdd1d6ff1d70bbb6c360c8352e6543fb8ebf
This commit is contained in:
Adam Perry @ OpenAI authored and copyberry committed 2026-07-23 19:19:35 +00:00
1 parent 74e9d7efc4
commit c769a05340
76 files changed
+1383 -702

No files matched your search

@@ -1,6 +1,3 @@
use codex_rollout::find_archived_thread_path_by_id_str;
use codex_rollout::rollout_date_parts;
use super::LocalThreadStore;
use super::helpers::matching_rollout_file_name;
use super::helpers::scoped_rollout_path;
@@ -10,6 +7,8 @@ use crate::ReadThreadParams;
use crate::StoredThread;
use crate::ThreadStoreError;
use crate::ThreadStoreResult;
use codex_rollout::find_archived_thread_path_by_id_str;
use codex_rollout::rollout_date_parts;
pub(super) async fn unarchive_thread(
store: &LocalThreadStore,
@@ -94,6 +93,7 @@ mod tests {
use chrono::Utc;
use codex_protocol::ThreadId;
use codex_protocol::protocol::SessionSource;
use codex_utils_absolute_path::test_support::PathExt;
use pretty_assertions::assert_eq;
use tempfile::TempDir;
use uuid::Uuid;
@@ -143,7 +143,7 @@ mod tests {
let archived_path = write_archived_session_file(home.path(), "2025-01-03T13-00-00", uuid)
.expect("archived session file");
let runtime = codex_state::StateRuntime::init(
home.path().to_path_buf(),
codex_state::SqliteConfig::new_for_testing(home.path().abs()),
config.default_model_provider_id.clone(),
)
.await