mirror of
https://github.com/openai/codex.git
synced 2026-11-22 15:15:18 +00:00
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:
1 parent
a6f435ea94
commit
ab4ce40042
2 files changed
+32
-23
No files matched your search
@@ -22,6 +22,7 @@ use std::fmt;
|
|||||||
use std::io::Error as IoError;
|
use std::io::Error as IoError;
|
||||||
use std::io::ErrorKind;
|
use std::io::ErrorKind;
|
||||||
use std::io::Result as IoResult;
|
use std::io::Result as IoResult;
|
||||||
|
use std::path::Path;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
@@ -48,7 +49,11 @@ use codex_config::LoaderOverrides;
|
|||||||
use codex_config::NoopThreadConfigLoader;
|
use codex_config::NoopThreadConfigLoader;
|
||||||
use codex_config::RemoteThreadConfigLoader;
|
use codex_config::RemoteThreadConfigLoader;
|
||||||
use codex_config::ThreadConfigLoader;
|
use codex_config::ThreadConfigLoader;
|
||||||
|
use codex_config::config_toml::ConfigToml;
|
||||||
use codex_core::config::Config;
|
use codex_core::config::Config;
|
||||||
|
pub use codex_core::otel_init::build_provider as build_otel_provider;
|
||||||
|
use codex_core::personality_migration::PersonalityMigrationStatus;
|
||||||
|
use codex_core::personality_migration::maybe_migrate_personality;
|
||||||
pub use codex_exec_server::EnvironmentManager;
|
pub use codex_exec_server::EnvironmentManager;
|
||||||
pub use codex_exec_server::ExecServerRuntimePaths;
|
pub use codex_exec_server::ExecServerRuntimePaths;
|
||||||
use codex_feedback::CodexFeedback;
|
use codex_feedback::CodexFeedback;
|
||||||
@@ -82,14 +87,6 @@ pub mod legacy_core {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod otel_init {
|
|
||||||
pub use codex_core::otel_init::*;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod personality_migration {
|
|
||||||
pub use codex_core::personality_migration::*;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod windows_sandbox {
|
pub mod windows_sandbox {
|
||||||
pub use codex_core::windows_sandbox::*;
|
pub use codex_core::windows_sandbox::*;
|
||||||
}
|
}
|
||||||
@@ -97,6 +94,23 @@ pub mod legacy_core {
|
|||||||
|
|
||||||
const SHUTDOWN_TIMEOUT: Duration = Duration::from_secs(5);
|
const SHUTDOWN_TIMEOUT: Duration = Duration::from_secs(5);
|
||||||
|
|
||||||
|
/// Runs the embedded app-server personality migration.
|
||||||
|
///
|
||||||
|
/// Returns `true` when the migration changed config and the caller should reload it.
|
||||||
|
pub async fn migrate_personality_if_needed(
|
||||||
|
codex_home: &Path,
|
||||||
|
config_toml: &ConfigToml,
|
||||||
|
state_db: Option<StateDbHandle>,
|
||||||
|
) -> IoResult<bool> {
|
||||||
|
let status = maybe_migrate_personality(codex_home, config_toml, state_db).await?;
|
||||||
|
match status {
|
||||||
|
PersonalityMigrationStatus::Applied => Ok(true),
|
||||||
|
PersonalityMigrationStatus::SkippedMarker
|
||||||
|
| PersonalityMigrationStatus::SkippedExplicitPersonality
|
||||||
|
| PersonalityMigrationStatus::SkippedNoSessions => Ok(false),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Raw app-server request result for typed in-process requests.
|
/// Raw app-server request result for typed in-process requests.
|
||||||
///
|
///
|
||||||
/// Even on the in-process path, successful responses still travel back through
|
/// Even on the in-process path, successful responses still travel back through
|
||||||
|
|||||||
+10
-15
@@ -1125,7 +1125,7 @@ pub async fn run_main(
|
|||||||
|
|
||||||
let otel_originator = originator().value;
|
let otel_originator = originator().value;
|
||||||
let otel = match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
|
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,
|
&config,
|
||||||
env!("CARGO_PKG_VERSION"),
|
env!("CARGO_PKG_VERSION"),
|
||||||
/*service_name_override*/ None,
|
/*service_name_override*/ None,
|
||||||
@@ -1148,26 +1148,25 @@ pub async fn run_main(
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
crate::legacy_core::otel_init::record_process_start(otel.as_ref(), otel_originator.as_str());
|
if let Some(metrics) = otel.as_ref().and_then(codex_otel::OtelProvider::metrics) {
|
||||||
crate::legacy_core::otel_init::install_sqlite_telemetry(
|
let _ = codex_otel::record_process_start_once(metrics, otel_originator.as_str());
|
||||||
otel.as_ref(),
|
let telemetry =
|
||||||
otel_originator.as_str(),
|
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 state_db = init_state_db_for_app_server_target(&config, &app_server_target).await?;
|
||||||
|
|
||||||
let effective_toml = config.config_layer_stack.effective_config();
|
let effective_toml = config.config_layer_stack.effective_config();
|
||||||
match effective_toml.try_into() {
|
match effective_toml.try_into() {
|
||||||
Ok(config_toml) => {
|
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.codex_home,
|
||||||
&config_toml,
|
&config_toml,
|
||||||
state_db.clone(),
|
state_db.clone(),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(
|
Ok(true) => {
|
||||||
crate::legacy_core::personality_migration::PersonalityMigrationStatus::Applied,
|
|
||||||
) => {
|
|
||||||
config = load_config_or_exit(
|
config = load_config_or_exit(
|
||||||
cli_kv_overrides.clone(),
|
cli_kv_overrides.clone(),
|
||||||
overrides.clone(),
|
overrides.clone(),
|
||||||
@@ -1177,11 +1176,7 @@ pub async fn run_main(
|
|||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
Ok(
|
Ok(false) => {}
|
||||||
crate::legacy_core::personality_migration::PersonalityMigrationStatus::SkippedMarker
|
|
||||||
| crate::legacy_core::personality_migration::PersonalityMigrationStatus::SkippedExplicitPersonality
|
|
||||||
| crate::legacy_core::personality_migration::PersonalityMigrationStatus::SkippedNoSessions,
|
|
||||||
) => {}
|
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
tracing::warn!(error = %err, "failed to run personality migration");
|
tracing::warn!(error = %err, "failed to run personality migration");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user