mirror of
https://github.com/openai/codex.git
synced 2026-11-16 22:00:36 +00:00
Keep thread storage available when diagnostic logs fail (#60466)
## Why Failure to open the diagnostic logs database should not disable thread storage or database-only history listing. Thread deletion must still preserve saved conversations when diagnostic log cleanup cannot complete. ## What changed - Allow state initialization to continue after non-corruption errors opening the logs database, while preserving corruption recovery. - Report the original diagnostic database error after tracing is installed in the TUI and app server, and return it from log operations. - Reject thread deletion before destructive cleanup when diagnostic storage failed to initialize. - Continue periodic cleanup of legacy logs when the current logs database is unavailable. ## Testing Extend coverage for unavailable log directories, database-only history listing, startup diagnostics, deletion preserving saved conversations, corrupt log headers, and periodic legacy log cleanup during a diagnostic storage outage. GitOrigin-RevId: a5184580ae6c39ed0c4eefa8cb48ee7731a991c3
This commit is contained in:
committed by
copyberry
parent
e1cc96712f
commit
caae161dd0
@@ -1265,7 +1265,7 @@ ON CONFLICT(id) DO UPDATE SET
|
||||
for (thread_id, thread_id_string) in thread_ids.iter().zip(&thread_id_strings) {
|
||||
sqlx::query("DELETE FROM logs WHERE thread_id = ?")
|
||||
.bind(thread_id_string)
|
||||
.execute_with_busy_retry(self.logs_pool.as_ref())
|
||||
.execute_with_busy_retry(self.diagnostic_logs_pool()?)
|
||||
.await?;
|
||||
self.thread_queue.delete_thread_queue(*thread_id).await?;
|
||||
self.delete_versioned_thread_memory(*thread_id).await?;
|
||||
@@ -2254,7 +2254,7 @@ mod tests {
|
||||
.await?;
|
||||
seed_thread_cleanup_state(&runtime, thread_id, child_thread_id).await?;
|
||||
|
||||
runtime.logs_pool.close().await;
|
||||
runtime.diagnostic_logs_pool().unwrap().close().await;
|
||||
runtime
|
||||
.delete_thread(thread_id)
|
||||
.await
|
||||
@@ -2291,7 +2291,7 @@ mod tests {
|
||||
.await?;
|
||||
sqlx::query("INSERT INTO logs (ts, ts_nanos, level, target, feedback_log_body, thread_id) VALUES (1, 0, 'INFO', 'test', 'feedback log', ?)")
|
||||
.bind(thread_id.to_string())
|
||||
.execute(runtime.logs_pool.as_ref())
|
||||
.execute(runtime.diagnostic_logs_pool().unwrap())
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user