mirror of
https://github.com/openai/codex.git
synced 2026-05-04 05:11:37 +03:00
Ensure list_threads drops stale rollout files (#11572)
Summary - trim `state_db::list_threads_db` results to entries whose rollout files still exist, logging and recording a discrepancy for dropped rows - delete stale metadata rows from the SQLite store so future calls don’t surface invalid paths - add regression coverage in `recorder.rs` to verify stale DB paths are dropped when the file is missing
This commit is contained in:
@@ -650,6 +650,15 @@ ON CONFLICT(thread_id, position) DO NOTHING
|
||||
self.upsert_thread(&metadata).await
|
||||
}
|
||||
|
||||
/// Delete a thread metadata row by id.
|
||||
pub async fn delete_thread(&self, thread_id: ThreadId) -> anyhow::Result<u64> {
|
||||
let result = sqlx::query("DELETE FROM threads WHERE id = ?")
|
||||
.bind(thread_id.to_string())
|
||||
.execute(self.pool.as_ref())
|
||||
.await?;
|
||||
Ok(result.rows_affected())
|
||||
}
|
||||
|
||||
async fn ensure_backfill_state_row(&self) -> anyhow::Result<()> {
|
||||
sqlx::query(
|
||||
r#"
|
||||
|
||||
Reference in New Issue
Block a user