Trim TUI legacy telemetry and migration dependencies (#27487)

## Why

The TUI still reached through `codex-app-server-client::legacy_core` for
process telemetry setup and personality migration, exposing core-only
details after the TUI moved onto the app-server layer.

This is part of our ongoing efforts to whittle away at the legacy_core
shim that was left over after migrating the TUI to the app server.

This change is just a refactor/rename and should be behavior-neutral and
low risk.

## What changed

- expose OTEL provider construction through the app-server client and
keep the small process/SQLite telemetry adapters local to the TUI
- collapse personality migration results to the config-reload decision
the TUI needs
- remove the `legacy_core::otel_init` and
`legacy_core::personality_migration` subnamespaces
This commit is contained in:
Eric Traut authored and GitHub committed 2026-06-10 19:50:57 -07:00
1 parent a6f435ea94
commit ab4ce40042
2 files changed
+32 -23

No files matched your search

+10 -15
View File
@@ -1125,7 +1125,7 @@ pub async fn run_main(
let otel_originator = originator().value;
let otel = match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
crate::legacy_core::otel_init::build_provider(
codex_app_server_client::build_otel_provider(
&config,
env!("CARGO_PKG_VERSION"),
/*service_name_override*/ None,
@@ -1148,26 +1148,25 @@ pub async fn run_main(
None
}
};
crate::legacy_core::otel_init::record_process_start(otel.as_ref(), otel_originator.as_str());
crate::legacy_core::otel_init::install_sqlite_telemetry(
otel.as_ref(),
otel_originator.as_str(),
);
if let Some(metrics) = otel.as_ref().and_then(codex_otel::OtelProvider::metrics) {
let _ = codex_otel::record_process_start_once(metrics, otel_originator.as_str());
let telemetry =
codex_rollout::sqlite_telemetry_recorder(metrics.clone(), otel_originator.as_str());
let _ = codex_state::install_process_db_telemetry(telemetry);
}
let state_db = init_state_db_for_app_server_target(&config, &app_server_target).await?;
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(
match codex_app_server_client::migrate_personality_if_needed(
&config.codex_home,
&config_toml,
state_db.clone(),
)
.await
{
Ok(
crate::legacy_core::personality_migration::PersonalityMigrationStatus::Applied,
) => {
Ok(true) => {
config = load_config_or_exit(
cli_kv_overrides.clone(),
overrides.clone(),
@@ -1177,11 +1176,7 @@ pub async fn run_main(
)
.await;
}
Ok(
crate::legacy_core::personality_migration::PersonalityMigrationStatus::SkippedMarker
| crate::legacy_core::personality_migration::PersonalityMigrationStatus::SkippedExplicitPersonality
| crate::legacy_core::personality_migration::PersonalityMigrationStatus::SkippedNoSessions,
) => {}
Ok(false) => {}
Err(err) => {
tracing::warn!(error = %err, "failed to run personality migration");
}