aKode fase 2c: eliminato il codice di invio dati (crate analytics, otel-trace-websocket, sentry, esportatori OTLP); /feedback salva solo in locale; chiavi legacy [analytics]/[otel] accettate e ignorate; test di analytics/OTLP/upload rimossi
Some checks failed
blocking-ci / rust-ci (push) Has been cancelled
blocking-ci / sdk (push) Has been cancelled
blocking-ci / CI required (push) Has been cancelled
blocking-ci / Bazel (push) Has been cancelled
blocking-ci / Blob size policy (push) Has been cancelled
blocking-ci / cargo-deny (push) Has been cancelled
blocking-ci / Codespell (push) Has been cancelled
blocking-ci / repo-checks (push) Has been cancelled
postmerge-ci / rust-ci-full (push) Has been cancelled
postmerge-ci / v8-canary (push) Has been cancelled
postmerge-ci / Postmerge CI results (push) Has been cancelled

This commit is contained in:
Andrea
2026-11-09 18:45:41 +01:00
parent 981745ccc8
commit 60532b6337
509 changed files with 2043 additions and 46606 deletions

View File

@@ -1,60 +0,0 @@
//! Foreground daemon observations use the CLI's existing consent and identity handling.
//! Detached updater entry points never call this module.
use codex_utils_cli::CliConfigOverrides;
use std::time::Duration;
use tokio::time::timeout;
pub(crate) async fn record_command(
overrides: &CliConfigOverrides,
analytics_default_enabled: bool,
target: &'static str,
result: &anyhow::Result<Option<codex_app_server_daemon::UpdateOutput>>,
) {
if std::env::var_os(codex_app_server_daemon::telemetry::HANDOFF_ENV).is_some() {
return;
}
// Skip telemetry if consent-aware configuration cannot be loaded promptly.
let Ok(Ok(config)) = timeout(
Duration::from_secs(/*secs*/ 2),
crate::cloud_config::load_config(overrides, codex_config::LoaderOverrides::default()),
)
.await
else {
return;
};
use codex_app_server_daemon::UpdateStatus;
let outcome = match result {
Ok(Some(output)) => match output.status {
UpdateStatus::Updated => "updated",
UpdateStatus::NoUpdate => "no_update",
UpdateStatus::Unsupported => "unsupported",
},
Ok(None) => "cancelled",
Err(_) => "unconfirmed",
};
let Ok(Ok(Some(otel))) = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
codex_core::otel_init::build_provider(
&config,
env!("CARGO_PKG_VERSION"),
/*service_name_override*/ None,
analytics_default_enabled,
)
})) else {
return;
};
if let Some(metrics) = otel.metrics() {
let mut tags = codex_app_server_daemon::telemetry::settings_tags(&config.codex_home)
.await
.to_vec();
tags.extend([
("initiation_source", "cli"),
("update_target", target),
("outcome", outcome),
]);
let _ = metrics.counter("codex.daemon.update", /*inc*/ 1, &tags);
}
let _ = otel
.shutdown_with_timeout(std::time::Duration::from_secs(/*secs*/ 2))
.await;
}

View File

@@ -48,7 +48,6 @@ static ALLOCATOR: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
mod config_override_args;
mod daemon_install;
mod daemon_telemetry;
mod doctor;
#[cfg(test)]
#[path = "exec_args_tests.rs"]
@@ -579,23 +578,10 @@ struct AppServerCommand {
#[arg(long, hide = true)]
managed_daemon: bool,
/// Controls whether analytics are enabled by default.
///
/// Analytics are disabled by default for app-server. Users have to explicitly opt in
/// via the `analytics` section in the config.toml file.
///
/// However, for first-party use cases like the VSCode IDE extension, we default analytics
/// to be enabled by default by setting this flag. Users can still opt out by setting this
/// in their config.toml:
///
/// ```toml
/// [analytics]
/// enabled = false
/// ```
///
/// See https://developers.openai.com/codex/config-advanced/#metrics for more details.
#[arg(long = "analytics-default-enabled")]
analytics_default_enabled: bool,
/// Deprecated and ignored: aKode never collects usage data. Accepted only so
/// existing launchers that still pass this legacy flag keep working.
#[arg(long = "analytics-default-enabled", hide = true)]
_legacy_usage_data_flag: bool,
#[command(flatten)]
auth: codex_websocket_auth::WebsocketAuthArgs,
@@ -762,7 +748,6 @@ fn run_update_action(
println!("Updating the local background server...");
let status = std::process::Command::new(executable)
.args(source.command_args())
.env(codex_app_server_daemon::telemetry::HANDOFF_ENV, "1")
.status()?;
anyhow::ensure!(
status.success(),
@@ -1207,8 +1192,8 @@ async fn dispatch_cli(
listen,
stdio,
managed_daemon,
analytics_default_enabled,
auth,
..
} = app_server_cli;
let strict_config = app_server_strict_config || root_strict_config;
reject_strict_config_for_app_server_subcommand(strict_config, subcommand.as_ref())?;
@@ -1262,7 +1247,6 @@ async fn dispatch_cli(
root_config_overrides,
LoaderOverrides::default(),
strict_config,
analytics_default_enabled,
transport,
codex_protocol::protocol::SessionSource::VSCode,
auth,
@@ -1336,13 +1320,6 @@ async fn dispatch_cli(
daemon_install::confirm_install(request, yes)
})
.await;
daemon_telemetry::record_command(
&root_config_overrides,
analytics_default_enabled,
"this_cli",
&result,
)
.await;
if let Some(output) = result? {
println!("{}", serde_json::to_string(&output)?);
}
@@ -1380,13 +1357,6 @@ async fn dispatch_cli(
let result = codex_app_server_daemon::update(http_client_factory)
.await
.map(Some);
daemon_telemetry::record_command(
&root_config_overrides,
analytics_default_enabled,
"public_stable",
&result,
)
.await;
if let Some(output) = result? {
println!("{}", serde_json::to_string(&output)?);
}
@@ -4111,9 +4081,8 @@ enabled = true
}
#[test]
fn app_server_analytics_default_disabled_without_flag() {
fn app_server_defaults_to_stdio_transport() {
let app_server = app_server_from_args(["codex", "app-server"].as_ref());
assert!(!app_server.analytics_default_enabled);
assert_eq!(
app_server.listen,
codex_app_server::AppServerTransport::Stdio
@@ -4131,10 +4100,13 @@ enabled = true
}
#[test]
fn app_server_analytics_default_enabled_with_flag() {
fn app_server_accepts_and_ignores_legacy_usage_data_flag() {
let app_server =
app_server_from_args(["codex", "app-server", "--analytics-default-enabled"].as_ref());
assert!(app_server.analytics_default_enabled);
assert_eq!(
app_server.listen,
codex_app_server::AppServerTransport::Stdio
);
}
#[test]

View File

@@ -56,17 +56,6 @@ pub(crate) async fn run(
.cli_overrides(overrides)
.build()
.await?;
let otel = codex_core::otel_init::build_provider(
&config,
env!("CARGO_PKG_VERSION"),
/*service_name_override*/ None,
/*default_analytics_enabled*/ true,
)
.unwrap_or_else(|error| {
eprintln!("Could not create otel exporter: {error}");
None
});
codex_core::otel_init::record_process_start(otel.as_ref(), "codex_migrate_rollouts");
let mode = if command.apply {
RolloutMigrationMode::Apply
} else {