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

@@ -50,7 +50,6 @@ use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use std::time::Duration;
use crate::analytics_utils::analytics_events_client_from_config;
use crate::config_manager::ConfigManager;
use crate::error_code::OVERLOADED_ERROR_CODE;
use crate::error_code::internal_error;
@@ -68,7 +67,6 @@ use crate::transport::CHANNEL_CAPACITY;
use crate::transport::OutboundConnectionState;
use crate::transport::route_outgoing_envelope;
pub use bootstrap::EmbeddedNetworkPolicy;
use codex_analytics::AppServerRpcTransport;
use codex_app_server_protocol::AgentMessageDelivery;
use codex_app_server_protocol::ClientNotification;
use codex_app_server_protocol::ClientRequest;
@@ -104,8 +102,8 @@ mod bootstrap;
const IN_PROCESS_CONNECTION_ID: ConnectionId = ConnectionId(0);
const SHUTDOWN_TIMEOUT: Duration = Duration::from_secs(5);
// Covers both bounded runtime drains plus the analytics client's 25-second best-effort flush.
const SHUTDOWN_ACK_TIMEOUT: Duration = Duration::from_secs(35);
// Covers both bounded runtime drains with some margin.
const SHUTDOWN_ACK_TIMEOUT: Duration = Duration::from_secs(15);
/// Default bounded channel capacity for in-process runtime queues.
pub const DEFAULT_IN_PROCESS_CHANNEL_CAPACITY: usize = CHANNEL_CAPACITY;
@@ -465,17 +463,10 @@ async fn start_uninitialized(mut args: InProcessStartArgs) -> IoResult<InProcess
.features
.enabled(codex_features::Feature::RuntimeAgentInstances)
.then(codex_runtime_agent_instance::RuntimeAuthSlot::default);
let analytics_events_client = analytics_events_client_from_config(
Arc::clone(&auth_manager),
args.config.as_ref(),
runtime_auth_slot.clone(),
);
let analytics_events_flush_client = analytics_events_client.clone();
// A client can be waiting for process/kill while nobody is polling next_event.
let (process_reply_tx, mut process_reply_rx) = mpsc::channel(channel_capacity);
let outgoing_message_sender = Arc::new(
OutgoingMessageSender::new(outgoing_tx, analytics_events_client.clone())
.with_process_reply_sender(process_reply_tx),
OutgoingMessageSender::new(outgoing_tx).with_process_reply_sender(process_reply_tx),
);
let log_write_warning = crate::log_write_warning::LogWriteWarningReporter::new(
@@ -520,7 +511,6 @@ async fn start_uninitialized(mut args: InProcessStartArgs) -> IoResult<InProcess
let processor = Arc::new(MessageProcessor::new(MessageProcessorArgs {
cloud_skill_provider: None,
outgoing: Arc::clone(&processor_outgoing),
analytics_events_client,
arg0_paths: args.arg0_paths,
config: args.config,
startup_cwd,
@@ -539,7 +529,6 @@ async fn start_uninitialized(mut args: InProcessStartArgs) -> IoResult<InProcess
runtime_auth_slot,
installation_id,
code_mode_session_provider: None,
rpc_transport: AppServerRpcTransport::InProcess,
remote_control_handle: None,
plugin_startup_tasks: Some(PluginStartupConfig::Current),
}));
@@ -850,8 +839,6 @@ async fn start_uninitialized(mut args: InProcessStartArgs) -> IoResult<InProcess
let _ = outbound_handle.await;
}
analytics_events_flush_client.flush().await;
if let Some(done_tx) = shutdown_ack {
let _ = done_tx.send(());
}
@@ -1102,35 +1089,6 @@ mod tests {
assert!(retained_outgoing_tx.is_closed());
}
#[tokio::test(start_paused = true)]
async fn in_process_shutdown_waits_for_analytics_flush_budget() {
let (client_tx, mut client_rx) = mpsc::channel(/*buffer*/ 1);
let (_event_tx, event_rx) = mpsc::channel(/*buffer*/ 1);
let completed = Arc::new(AtomicBool::new(false));
let runtime_completed = Arc::clone(&completed);
let runtime_handle = tokio::spawn(async move {
let done_tx = match client_rx.recv().await {
Some(InProcessClientMessage::Shutdown { done_tx }) => done_tx,
_ => panic!("expected in-process shutdown request"),
};
tokio::time::sleep(SHUTDOWN_TIMEOUT + SHUTDOWN_TIMEOUT + Duration::from_secs(24)).await;
runtime_completed.store(true, Ordering::Release);
let _ = done_tx.send(());
});
let client = InProcessClientHandle {
client: InProcessClientSender { client_tx },
event_rx,
runtime_handle,
_test_codex_home: None,
};
client
.shutdown()
.await
.expect("in-process runtime should shutdown cleanly");
assert!(completed.load(Ordering::Acquire));
}
#[test]
fn guaranteed_delivery_helpers_cover_required_server_notifications() {
assert!(server_notification_requires_delivery(