Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

feat: drop sqlite db feature flag (#13750)

jif-oaifa16c26908cd
diff --git a/codex-rs/app-server/src/lib.rs b/codex-rs/app-server/src/lib.rs
index e8dd1638ee..3505f432d5 100644
--- a/codex-rs/app-server/src/lib.rs
+++ b/codex-rs/app-server/src/lib.rs
@@ -38,7 +38,6 @@ use codex_core::ExecPolicyError;
use codex_core::check_execpolicy_for_warnings;
use codex_core::config_loader::ConfigLoadError;
use codex_core::config_loader::TextRange as CoreTextRange;
-use codex_core::features::Feature;
use codex_feedback::CodexFeedback;
use codex_state::log_db;
use tokio::sync::mpsc;
@@ -499,18 +498,14 @@ pub async fn run_main_with_transport(
let feedback_layer = feedback.logger_layer();
let feedback_metadata_layer = feedback.metadata_layer();
- let log_db = if config.features.enabled(Feature::Sqlite) {
- codex_state::StateRuntime::init(
- config.sqlite_home.clone(),
- config.model_provider_id.clone(),
- None,
- )
- .await
- .ok()
- .map(log_db::start)
- } else {
- None
- };
+ let log_db = codex_state::StateRuntime::init(
+ config.sqlite_home.clone(),
+ config.model_provider_id.clone(),
+ None,
+ )
+ .await
+ .ok()
+ .map(log_db::start);
let log_db_layer = log_db
.clone()
.map(|layer| layer.with_filter(Targets::new().with_default(Level::TRACE)));
diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs
index d1d0ae8d71..7445b9fe0b 100644
--- a/codex-rs/core/src/codex.rs
+++ b/codex-rs/core/src/codex.rs
@@ -438,9 +438,7 @@ impl Codex {
// Respect thread-start tools. When missing (resumed/forked threads), read from the db
// first, then fall back to rollout-file tools.
- let persisted_tools = if dynamic_tools.is_empty()
- && config.features.enabled(Feature::Sqlite)
- {
+ let persisted_tools = if dynamic_tools.is_empty() {
let thread_id = match &conversation_history {
InitialHistory::Resumed(resumed) => Some(resumed.conversation_id),
InitialHistory::Forked(_) => conversation_history.forked_from_id(),
@@ -1251,7 +1249,7 @@ impl Session {
if config.ephemeral {
Ok::<_, anyhow::Error>((None, None))
} else {
- let state_db_ctx = state_db::init_if_enabled(&config, None).await;
+ let state_db_ctx = state_db::init(&config, None).await;
let rollout_recorder = RolloutRecorder::new(
&config,
rollout_params,
diff --git a/codex-rs/core/src/features.rs b/codex-rs/core/src/features.rs
index a400c30536..7defc571ff 100644
--- a/codex-rs/core/src/features.rs
+++ b/codex-rs/core/src/features.rs
@@ -539,7 +539,7 @@ pub const FEATURES: &[FeatureSpec] = &[
FeatureSpec {
id: Feature::Sqlite,
key: "sqlite",
- stage: Stage::Stable,
+ stage: Stage::Removed,
default_enabled: true,
},
FeatureSpec {
diff --git a/codex-rs/core/src/state_db.rs b/codex-rs/core/src/state_db.rs
index 953c7a8e12..7f22bbd9e2 100644
--- a/codex-rs/core/src/state_db.rs
+++ b/codex-rs/core/src/state_db.rs
@@ -1,5 +1,4 @@
use crate::config::Config;
-use crate::features::Feature;
use crate::path_utils::normalize_for_path_comparison;
use crate::rollout::list::Cursor;
use crate::rollout::list::ThreadSortKey;
@@ -24,18 +23,12 @@ use std::sync::Arc;
use tracing::warn;
use uuid::Uuid;
-/// Core-facing handle to the optional SQLite-backed state runtime.
+/// Core-facing handle to the SQLite-backed state runtime.
pub type StateDbHandle = Arc<codex_state::StateRuntime>;
-/// Initialize the state runtime when the `sqlite` feature flag is enabled. To only be used
+/// Initialize the state runtime for thread state persistence and backfill checks. To only be used
/// inside `core`. The initialization should not be done anywhere else.
-pub(crate) async fn init_if_enabled(
- config: &Config,
- otel: Option<&OtelManager>,
-) -> Option<StateDbHandle> {
- if !config.features.enabled(Feature::Sqlite) {
- return None;
- }
+pub(crate) async fn init(config: &Config, otel: Option<&OtelManager>) -> Option<StateDbHandle> {
let runtime = match codex_state::StateRuntime::init(
config.sqlite_home.clone(),
config.model_provider_id.clone(),
@@ -80,9 +73,7 @@ pub(crate) async fn init_if_enabled(
/// Get the DB if the feature is enabled and the DB exists.
pub async fn get_state_db(config: &Config, otel: Option<&OtelManager>) -> Option<StateDbHandle> {
let state_path = codex_state::state_db_path(config.sqlite_home.as_path());
- if !config.features.enabled(Feature::Sqlite)
- || !tokio::fs::try_exists(&state_path).await.unwrap_or(false)
- {
+ if !tokio::fs::try_exists(&state_path).await.unwrap_or(false) {
return None;
}
let runtime = codex_state::StateRuntime::init(
diff --git a/codex-rs/core/src/tools/handlers/agent_jobs.rs b/codex-rs/core/src/tools/handlers/agent_jobs.rs
index c4891a6b3a..8b3d823c23 100644
--- a/codex-rs/core/src/tools/handlers/agent_jobs.rs
+++ b/codex-rs/core/src/tools/handlers/agent_jobs.rs
@@ -516,10 +516,7 @@ fn required_state_db(
session: &Arc<Session>,
) -> Result<Arc<codex_state::StateRuntime>, FunctionCallError> {
session.state_db().ok_or_else(|| {
- FunctionCallError::Fatal(
- "sqlite state db is unavailable for this session; enable the sqlite feature"
- .to_string(),
- )
+ FunctionCallError::Fatal("sqlite state db is unavailable for this session".to_string())
})
}
diff --git a/codex-rs/core/src/tools/spec.rs b/codex-rs/core/src/tools/spec.rs
index 3fd7a3db79..4e4510ddea 100644
--- a/codex-rs/core/src/tools/spec.rs
+++ b/codex-rs/core/src/tools/spec.rs
@@ -102,7 +102,7 @@ impl ToolsConfig {
features.enabled(Feature::Artifact) && codex_artifacts::can_manage_artifact_runtime();
let include_image_gen_tool =
features.enabled(Feature::ImageGeneration) && supports_image_generation(model_info);
- let include_agent_jobs = include_collab_tools && features.enabled(Feature::Sqlite);
+ let include_agent_jobs = include_collab_tools;
let request_permission_enabled = features.enabled(Feature::RequestPermissions);
let shell_command_backend =
if features.enabled(Feature::ShellTool) && features.enabled(Feature::ShellZshFork) {