Lightweight coding agent that runs in your terminal
Rust
fix: Block appserver startup if state db can't be opened (#22580)
David de Regt53a36fc1c20a
diff --git a/codex-rs/app-server/src/lib.rs b/codex-rs/app-server/src/lib.rsindex b4e5f9a04d..9178cc01cb 100644--- a/codex-rs/app-server/src/lib.rs+++ b/codex-rs/app-server/src/lib.rs@@ -514,9 +514,16 @@ pub async fn run_main_with_transport_options(})?;codex_core::otel_init::record_process_start(otel.as_ref(), OTEL_SERVICE_NAME);codex_core::otel_init::install_sqlite_telemetry(otel.as_ref(), OTEL_SERVICE_NAME);- let state_db_result = rollout_state_db::try_init(&config).await;- let state_db_init_error = state_db_result.as_ref().err().map(ToString::to_string);- let state_db = state_db_result.ok();+ let state_db = match rollout_state_db::try_init(&config).await {+ Ok(state_db) => Some(state_db),+ Err(err) => {+ let state_db_path = codex_state::state_db_path(config.sqlite_home.as_path());+ return Err(std::io::Error::other(format!(+ "failed to initialize sqlite state db at {}: {err}",+ state_db_path.display()+ )));+ }+ };if should_run_personality_migration {let effective_toml = config.config_layer_stack.effective_config();@@ -633,10 +640,6 @@ pub async fn run_main_with_transport_options(}}let installation_id = resolve_installation_id(&config.codex_home).await?;- if let Some(err) = &state_db_init_error {- error!("failed to initialize sqlite state db: {err}");- }-let transport_shutdown_token = CancellationToken::new();let mut transport_accept_handles = Vec::<JoinHandle<()>>::new();