Revert state DB injection and agent graph store (#21481)

## Why

Reverts #20689 to restore the previous optional state DB plumbing. The
conflict resolution keeps the newer installation ID and session/thread
identity changes that landed after #20689, while removing the mandatory
state DB and agent graph store dependency from ThreadManager
construction.

## What changed

- Restored `Option<StateDbHandle>` through app-server, MCP server,
prompt debug, and test entry points.
- Removed the `codex-core` dependency on `codex-agent-graph-store` and
reverted descendant lookup back to the existing state DB path when
available.
- Kept newer `installation_id` forwarding by passing it beside the
optional DB handle.
- Kept local thread-name updates working when the optional state DB
handle is absent.

## Validation

- `git diff --check`
- `cargo test -p codex-thread-store`
- `cargo test -p codex-state -p codex-rollout -p
codex-app-server-protocol`
- Attempted `env CARGO_INCREMENTAL=0 cargo test -p codex-core -p
codex-app-server -p codex-app-server-client -p codex-mcp-server -p
codex-thread-manager-sample -p codex-tui`; blocked locally by a rustc
ICE while compiling `v8 v146.4.0` with `rustc 1.93.0 (254b59607
2026-01-19)` on `aarch64-apple-darwin`.
This commit is contained in:
pakrym-oai
2026-05-06 22:48:29 -07:00
committed by GitHub
parent 5bc33fe31f
commit a8488fec5e
54 changed files with 781 additions and 834 deletions
+30 -32
View File
@@ -881,40 +881,38 @@ pub async fn run_main(
AppServerTarget::Remote { .. } => state_db::get_state_db(&config).await,
};
if let Some(state_db) = state_db.clone() {
let effective_toml = config.config_layer_stack.effective_config();
match effective_toml.try_into() {
Ok(config_toml) => {
match crate::legacy_core::personality_migration::maybe_migrate_personality(
&config.codex_home,
&config_toml,
state_db,
)
.await
{
Ok(
crate::legacy_core::personality_migration::PersonalityMigrationStatus::Applied,
) => {
config = load_config_or_exit(
cli_kv_overrides.clone(),
overrides.clone(),
cloud_requirements.clone(),
)
.await;
}
Ok(
crate::legacy_core::personality_migration::PersonalityMigrationStatus::SkippedMarker
| crate::legacy_core::personality_migration::PersonalityMigrationStatus::SkippedExplicitPersonality
| crate::legacy_core::personality_migration::PersonalityMigrationStatus::SkippedNoSessions,
) => {}
Err(err) => {
tracing::warn!(error = %err, "failed to run personality migration");
}
let effective_toml = config.config_layer_stack.effective_config();
match effective_toml.try_into() {
Ok(config_toml) => {
match crate::legacy_core::personality_migration::maybe_migrate_personality(
&config.codex_home,
&config_toml,
state_db.clone(),
)
.await
{
Ok(
crate::legacy_core::personality_migration::PersonalityMigrationStatus::Applied,
) => {
config = load_config_or_exit(
cli_kv_overrides.clone(),
overrides.clone(),
cloud_requirements.clone(),
)
.await;
}
Ok(
crate::legacy_core::personality_migration::PersonalityMigrationStatus::SkippedMarker
| crate::legacy_core::personality_migration::PersonalityMigrationStatus::SkippedExplicitPersonality
| crate::legacy_core::personality_migration::PersonalityMigrationStatus::SkippedNoSessions,
) => {}
Err(err) => {
tracing::warn!(error = %err, "failed to run personality migration");
}
}
Err(err) => {
tracing::warn!(error = %err, "failed to deserialize config for personality migration");
}
}
Err(err) => {
tracing::warn!(error = %err, "failed to deserialize config for personality migration");
}
}
+3 -3
View File
@@ -5737,7 +5737,6 @@ session_picker_view = "dense"
name: None,
turns: vec![codex_app_server_protocol::Turn {
id: String::from("turn-1"),
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: vec![
ThreadItem::UserMessage {
id: String::from("user-1"),
@@ -5757,6 +5756,7 @@ session_picker_view = "dense"
text: String::from("1. Do the thing"),
},
],
items_view: codex_app_server_protocol::TurnItemsView::Full,
status: codex_app_server_protocol::TurnStatus::Completed,
error: None,
started_at: None,
@@ -5804,12 +5804,12 @@ session_picker_view = "dense"
name: None,
turns: vec![codex_app_server_protocol::Turn {
id: String::from("turn-1"),
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: vec![ThreadItem::Reasoning {
id: String::from("reasoning-1"),
summary: Vec::new(),
content: vec![String::from("private raw chain of thought")],
}],
items_view: codex_app_server_protocol::TurnItemsView::Full,
status: codex_app_server_protocol::TurnStatus::Completed,
error: None,
started_at: None,
@@ -5861,12 +5861,12 @@ session_picker_view = "dense"
name: None,
turns: vec![codex_app_server_protocol::Turn {
id: String::from("turn-1"),
items_view: codex_app_server_protocol::TurnItemsView::Full,
items: vec![ThreadItem::Reasoning {
id: String::from("reasoning-1"),
summary: vec![String::from("public summary")],
content: vec![String::from("raw reasoning content")],
}],
items_view: codex_app_server_protocol::TurnItemsView::Full,
status: codex_app_server_protocol::TurnStatus::Completed,
error: None,
started_at: None,