From 38001734594f0d035cf547cbfc129caa5038181e Mon Sep 17 00:00:00 2001 From: jif-oai Date: Fri, 6 Feb 2026 15:41:52 +0100 Subject: [PATCH] feat: backfill async again (#10894) --- codex-rs/core/src/state_db.rs | 10 ++++++++-- codex-rs/state/src/runtime.rs | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/codex-rs/core/src/state_db.rs b/codex-rs/core/src/state_db.rs index ed2e8c264..b1b53bcbc 100644 --- a/codex-rs/core/src/state_db.rs +++ b/codex-rs/core/src/state_db.rs @@ -65,9 +65,15 @@ pub(crate) async fn init_if_enabled( } }; if backfill_state.status != codex_state::BackfillStatus::Complete { - metadata::backfill_sessions(runtime.as_ref(), config, otel).await; + let runtime_for_backfill = runtime.clone(); + let config = config.clone(); + let otel = otel.cloned(); + tokio::spawn(async move { + metadata::backfill_sessions(runtime_for_backfill.as_ref(), &config, otel.as_ref()) + .await; + }); } - require_backfill_complete(runtime, config.codex_home.as_path()).await + Some(runtime) } /// Get the DB if the feature is enabled and the DB exists. diff --git a/codex-rs/state/src/runtime.rs b/codex-rs/state/src/runtime.rs index 33ee7c844..6e6fb9001 100644 --- a/codex-rs/state/src/runtime.rs +++ b/codex-rs/state/src/runtime.rs @@ -38,7 +38,7 @@ use std::time::Duration; use tracing::warn; pub const STATE_DB_FILENAME: &str = "state"; -pub const STATE_DB_VERSION: u32 = 3; +pub const STATE_DB_VERSION: u32 = 4; const METRIC_DB_INIT: &str = "codex.db.init";