mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
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:
1 parent
74e9d7efc4
commit
c769a05340
76 files changed
+1383
-702
No files matched your search
+16
-11
@@ -1089,7 +1089,10 @@ fn config_check(config: &Config) -> DoctorCheck {
|
||||
));
|
||||
details.push(format!("model provider: {}", config.model_provider_id));
|
||||
details.push(format!("log dir: {}", config.log_dir.display()));
|
||||
details.push(format!("sqlite home: {}", config.sqlite_home.display()));
|
||||
details.push(format!(
|
||||
"sqlite home: {}",
|
||||
config.sqlite_config().home().display()
|
||||
));
|
||||
details.push(format!("mcp servers: {}", config.mcp_servers.get().len()));
|
||||
feature_flag_details(config, &mut details);
|
||||
config_toml_details(config, &mut details);
|
||||
@@ -2163,17 +2166,18 @@ async fn state_check(config: &Config) -> DoctorCheck {
|
||||
let mut details = Vec::new();
|
||||
path_readiness(&mut details, "CODEX_HOME", &config.codex_home);
|
||||
path_readiness(&mut details, "log dir", &config.log_dir);
|
||||
path_readiness(&mut details, "sqlite home", &config.sqlite_home);
|
||||
path_readiness(&mut details, "sqlite home", config.sqlite_config().home());
|
||||
let mut integrity_failures = Vec::new();
|
||||
let sqlite = codex_state::SqliteConfig::from_sqlite_home(
|
||||
codex_utils_absolute_path::AbsolutePathBuf::resolve_path_against_base(
|
||||
&config.sqlite_home,
|
||||
&config.codex_home,
|
||||
),
|
||||
);
|
||||
for db in sqlite.runtime_db_paths() {
|
||||
for db in config.sqlite_config().runtime_db_paths() {
|
||||
path_readiness(&mut details, db.label, &db.path);
|
||||
sqlite_integrity_detail(&mut details, &mut integrity_failures, db.label, &db.path).await;
|
||||
sqlite_integrity_detail(
|
||||
config.sqlite_config(),
|
||||
&mut details,
|
||||
&mut integrity_failures,
|
||||
db.label,
|
||||
&db.path,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
rollout_stats_details(&mut details, &config.codex_home);
|
||||
standalone_release_cache_details(&mut details);
|
||||
@@ -2198,6 +2202,7 @@ async fn state_check(config: &Config) -> DoctorCheck {
|
||||
}
|
||||
|
||||
async fn sqlite_integrity_detail(
|
||||
sqlite: &codex_state::SqliteConfig,
|
||||
details: &mut Vec<String>,
|
||||
integrity_failures: &mut Vec<String>,
|
||||
label: &str,
|
||||
@@ -2208,7 +2213,7 @@ async fn sqlite_integrity_detail(
|
||||
return;
|
||||
}
|
||||
|
||||
match codex_state::sqlite_integrity_check(path).await {
|
||||
match codex_state::sqlite_integrity_check(sqlite, path).await {
|
||||
Ok(rows) if rows.iter().all(|row| row == "ok") => {
|
||||
details.push(format!("{label} integrity: ok"));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user