From 23aaee92ac12825717b30ed5bbeb3334031233d1 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 13 May 2026 21:04:15 +0100 Subject: [PATCH] Remove Codex app analytics events --- notes/fresh-workspace-handoff.md | 6 + state/ledgers.msgpack | Bin 105643 -> 105887 bytes state/map.yaml | 8 +- .../analytics/src/analytics_client_tests.rs | 158 ------------------ vendor/codex/codex-rs/analytics/src/client.rs | 49 +----- vendor/codex/codex-rs/analytics/src/events.rs | 42 ----- vendor/codex/codex-rs/analytics/src/facts.rs | 18 -- vendor/codex/codex-rs/analytics/src/lib.rs | 1 - .../codex/codex-rs/analytics/src/reducer.rs | 31 ---- 9 files changed, 12 insertions(+), 301 deletions(-) diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index e8f26f81..7d940749 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -857,6 +857,12 @@ TypeScript schemas, and no longer appear in app-server/MCP docs. The app-list from the workspace; do not recreate connector listing unless it returns as an Epiphany-owned typed MCP adapter receipt. +Codex app telemetry is also gone. `codex-analytics` no longer tracks +`codex_app_mentioned` or `codex_app_used`, keeps app-use dedupe state, exposes +app telemetry client APIs, or tests those event shapes. Do not reintroduce app +analytics unless an Epiphany-owned typed adapter has a real runtime event to +report. + That husk has now been cut from `codex-core`. The root core crate no longer exports `plugins`, no longer depends on `codex-core-plugins` or `codex-plugin`, and the core plugin manager / marketplace add-remove-sync modules and tests diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 7451e5949c443d2a202c4fc095fd07c52b0f79f3..011a6296fc0d98cd346f61cb3cb2b36b0a7344f7 100644 GIT binary patch delta 258 zcmZXPv1$TA5Qfgg{y= zK@f>A;@f1-*7Ey5X8xJYq4V?C`MAFNrfu(2sqWiR?T<>GzPj(f><>{G#X&d;hNF2D zCgCUd3~=0ZA4TRnZe7cin6foFVR8c3f3CeI#l!7{;1I^U5Nwbj^m T%35B+3O(qGZ(eto-^5S Codex Apps no longer have privileged MCP/runtime treatment in the keeper path. MCP exposure is now uniform: small tool sets are direct, large or @@ -360,6 +360,8 @@ current_status: the shared protocol, generated schemas, `codex_message_processor.rs`, test helpers, and docs. The app-list `AppInfo`/metadata schema structs and the orphaned `codex-connectors` crate / `core::connectors` shim are gone from - the workspace. MCP remains JSON-RPC at the edge; user-declared MCP servers - are the only runtime MCP authority. + the workspace. Codex app analytics is gone too: no `codex_app_mentioned` / + `codex_app_used` facts, event payloads, reducer arms, client APIs, dedupe + cache, or tests remain. MCP remains JSON-RPC at the edge; user-declared MCP + servers are the only runtime MCP authority. next_action: Continue starving coordinator/runtime execution and operator surfaces off app-server JSON-RPC and out of `codex_message_processor.rs`; keep the vestigial Codex organ narrowed to subscription auth/model transport. diff --git a/vendor/codex/codex-rs/analytics/src/analytics_client_tests.rs b/vendor/codex/codex-rs/analytics/src/analytics_client_tests.rs index 2992d53b..80c00e1f 100644 --- a/vendor/codex/codex-rs/analytics/src/analytics_client_tests.rs +++ b/vendor/codex/codex-rs/analytics/src/analytics_client_tests.rs @@ -1,8 +1,5 @@ -use crate::client::AnalyticsEventsQueue; use crate::events::AppServerRpcTransport; -use crate::events::CodexAppMentionedEventRequest; use crate::events::CodexAppServerClientMetadata; -use crate::events::CodexAppUsedEventRequest; use crate::events::CodexCompactionEventRequest; use crate::events::CodexHookRunEventRequest; use crate::events::CodexRuntimeMetadata; @@ -16,14 +13,10 @@ use crate::events::GuardianReviewedAction; use crate::events::ThreadInitializedEvent; use crate::events::ThreadInitializedEventParams; use crate::events::TrackEventRequest; -use crate::events::codex_app_metadata; use crate::events::codex_hook_run_metadata; use crate::events::subagent_thread_started_event_request; use crate::facts::AnalyticsFact; use crate::facts::AnalyticsJsonRpcError; -use crate::facts::AppInvocation; -use crate::facts::AppMentionedInput; -use crate::facts::AppUsedInput; use crate::facts::CodexCompactionEvent; use crate::facts::CompactionImplementation; use crate::facts::CompactionPhase; @@ -94,11 +87,7 @@ use codex_utils_absolute_path::test_support::PathBufExt; use codex_utils_absolute_path::test_support::test_path_buf; use pretty_assertions::assert_eq; use serde_json::json; -use std::collections::HashSet; use std::path::PathBuf; -use std::sync::Arc; -use std::sync::Mutex; -use tokio::sync::mpsc; fn sample_thread(thread_id: &str, ephemeral: bool) -> Thread { sample_thread_with_source(thread_id, ephemeral, AppServerSessionSource::Exec) @@ -607,82 +596,6 @@ fn normalize_path_for_skill_id_repo_root_not_in_skill_path_uses_absolute_path() assert_eq!(path, expected); } -#[test] -fn app_mentioned_event_serializes_expected_shape() { - let tracking = TrackEventsContext { - model_slug: "gpt-5".to_string(), - thread_id: "thread-1".to_string(), - turn_id: "turn-1".to_string(), - }; - let event = TrackEventRequest::AppMentioned(CodexAppMentionedEventRequest { - event_type: "codex_app_mentioned", - event_params: codex_app_metadata( - &tracking, - AppInvocation { - connector_id: Some("calendar".to_string()), - app_name: Some("Calendar".to_string()), - invocation_type: Some(InvocationType::Explicit), - }, - ), - }); - - let payload = serde_json::to_value(&event).expect("serialize app mentioned event"); - - assert_eq!( - payload, - json!({ - "event_type": "codex_app_mentioned", - "event_params": { - "connector_id": "calendar", - "thread_id": "thread-1", - "turn_id": "turn-1", - "app_name": "Calendar", - "product_client_id": originator().value, - "invoke_type": "explicit", - "model_slug": "gpt-5" - } - }) - ); -} - -#[test] -fn app_used_event_serializes_expected_shape() { - let tracking = TrackEventsContext { - model_slug: "gpt-5".to_string(), - thread_id: "thread-2".to_string(), - turn_id: "turn-2".to_string(), - }; - let event = TrackEventRequest::AppUsed(CodexAppUsedEventRequest { - event_type: "codex_app_used", - event_params: codex_app_metadata( - &tracking, - AppInvocation { - connector_id: Some("drive".to_string()), - app_name: Some("Google Drive".to_string()), - invocation_type: Some(InvocationType::Implicit), - }, - ), - }); - - let payload = serde_json::to_value(&event).expect("serialize app used event"); - - assert_eq!( - payload, - json!({ - "event_type": "codex_app_used", - "event_params": { - "connector_id": "drive", - "thread_id": "thread-2", - "turn_id": "turn-2", - "app_name": "Google Drive", - "product_client_id": originator().value, - "invoke_type": "implicit", - "model_slug": "gpt-5" - } - }) - ); -} - #[test] fn compaction_event_serializes_expected_shape() { let event = TrackEventRequest::Compaction(Box::new(CodexCompactionEventRequest { @@ -754,35 +667,6 @@ fn compaction_event_serializes_expected_shape() { ); } -#[test] -fn app_used_dedupe_is_keyed_by_turn_and_connector() { - let (sender, _receiver) = mpsc::channel(1); - let queue = AnalyticsEventsQueue { - sender, - app_used_emitted_keys: Arc::new(Mutex::new(HashSet::new())), - }; - let app = AppInvocation { - connector_id: Some("calendar".to_string()), - app_name: Some("Calendar".to_string()), - invocation_type: Some(InvocationType::Implicit), - }; - - let turn_1 = TrackEventsContext { - model_slug: "gpt-5".to_string(), - thread_id: "thread-1".to_string(), - turn_id: "turn-1".to_string(), - }; - let turn_2 = TrackEventsContext { - model_slug: "gpt-5".to_string(), - thread_id: "thread-1".to_string(), - turn_id: "turn-2".to_string(), - }; - - assert_eq!(queue.should_enqueue_app_used(&turn_1, &app), true); - assert_eq!(queue.should_enqueue_app_used(&turn_1, &app), false); - assert_eq!(queue.should_enqueue_app_used(&turn_2, &app), true); -} - #[test] fn thread_initialized_event_serializes_expected_shape() { let event = TrackEventRequest::ThreadInitialized(ThreadInitializedEvent { @@ -1551,48 +1435,6 @@ async fn reducer_ingests_hook_run_fact() { assert_eq!(payload[0]["event_params"]["status"], "failed"); } -#[tokio::test] -async fn reducer_ingests_app_facts() { - let mut reducer = AnalyticsReducer::default(); - let mut events = Vec::new(); - let tracking = TrackEventsContext { - model_slug: "gpt-5".to_string(), - thread_id: "thread-1".to_string(), - turn_id: "turn-1".to_string(), - }; - - reducer - .ingest( - AnalyticsFact::Custom(CustomAnalyticsFact::AppMentioned(AppMentionedInput { - tracking: tracking.clone(), - mentions: vec![AppInvocation { - connector_id: Some("calendar".to_string()), - app_name: Some("Calendar".to_string()), - invocation_type: Some(InvocationType::Explicit), - }], - })), - &mut events, - ) - .await; - reducer - .ingest( - AnalyticsFact::Custom(CustomAnalyticsFact::AppUsed(AppUsedInput { - tracking: tracking.clone(), - app: AppInvocation { - connector_id: Some("drive".to_string()), - app_name: Some("Drive".to_string()), - invocation_type: Some(InvocationType::Implicit), - }, - })), - &mut events, - ) - .await; - let payload = serde_json::to_value(&events).expect("serialize events"); - assert_eq!(payload.as_array().expect("events array").len(), 2); - assert_eq!(payload[0]["event_type"], "codex_app_mentioned"); - assert_eq!(payload[1]["event_type"], "codex_app_used"); -} - #[test] fn turn_event_serializes_expected_shape() { let event = TrackEventRequest::TurnEvent(Box::new(CodexTurnEventRequest { diff --git a/vendor/codex/codex-rs/analytics/src/client.rs b/vendor/codex/codex-rs/analytics/src/client.rs index 6881984f..91d3a80b 100644 --- a/vendor/codex/codex-rs/analytics/src/client.rs +++ b/vendor/codex/codex-rs/analytics/src/client.rs @@ -6,9 +6,6 @@ use crate::events::TrackEventsRequest; use crate::events::current_runtime_metadata; use crate::facts::AnalyticsFact; use crate::facts::AnalyticsJsonRpcError; -use crate::facts::AppInvocation; -use crate::facts::AppMentionedInput; -use crate::facts::AppUsedInput; use crate::facts::CustomAnalyticsFact; use crate::facts::HookRunFact; use crate::facts::HookRunInput; @@ -27,20 +24,15 @@ use codex_app_server_protocol::RequestId; use codex_app_server_protocol::ServerNotification; use codex_login::AuthManager; use codex_login::default_client::create_client; -use std::collections::HashSet; use std::sync::Arc; -use std::sync::Mutex; use std::time::Duration; use tokio::sync::mpsc; const ANALYTICS_EVENTS_QUEUE_SIZE: usize = 256; const ANALYTICS_EVENTS_TIMEOUT: Duration = Duration::from_secs(10); -const ANALYTICS_EVENT_DEDUPE_MAX_KEYS: usize = 4096; - #[derive(Clone)] pub(crate) struct AnalyticsEventsQueue { pub(crate) sender: mpsc::Sender, - pub(crate) app_used_emitted_keys: Arc>>, } #[derive(Clone)] @@ -60,10 +52,7 @@ impl AnalyticsEventsQueue { send_track_events(&auth_manager, &base_url, events).await; } }); - Self { - sender, - app_used_emitted_keys: Arc::new(Mutex::new(HashSet::new())), - } + Self { sender } } fn try_send(&self, input: AnalyticsFact) { @@ -72,24 +61,6 @@ impl AnalyticsEventsQueue { tracing::warn!("dropping analytics events: queue is full"); } } - - pub(crate) fn should_enqueue_app_used( - &self, - tracking: &TrackEventsContext, - app: &AppInvocation, - ) -> bool { - let Some(connector_id) = app.connector_id.as_ref() else { - return true; - }; - let mut emitted = self - .app_used_emitted_keys - .lock() - .unwrap_or_else(std::sync::PoisonError::into_inner); - if emitted.len() >= ANALYTICS_EVENT_DEDUPE_MAX_KEYS { - emitted.clear(); - } - emitted.insert((tracking.turn_id.clone(), connector_id.clone())) - } } impl AnalyticsEventsClient { @@ -152,15 +123,6 @@ impl AnalyticsEventsClient { ))); } - pub fn track_app_mentioned(&self, tracking: TrackEventsContext, mentions: Vec) { - if mentions.is_empty() { - return; - } - self.record_fact(AnalyticsFact::Custom(CustomAnalyticsFact::AppMentioned( - AppMentionedInput { tracking, mentions }, - ))); - } - pub fn track_request(&self, connection_id: u64, request_id: RequestId, request: ClientRequest) { self.record_fact(AnalyticsFact::Request { connection_id, @@ -169,15 +131,6 @@ impl AnalyticsEventsClient { }); } - pub fn track_app_used(&self, tracking: TrackEventsContext, app: AppInvocation) { - if !self.queue.should_enqueue_app_used(&tracking, &app) { - return; - } - self.record_fact(AnalyticsFact::Custom(CustomAnalyticsFact::AppUsed( - AppUsedInput { tracking, app }, - ))); - } - pub fn track_hook_run(&self, tracking: TrackEventsContext, hook: HookRunFact) { self.record_fact(AnalyticsFact::Custom(CustomAnalyticsFact::HookRun( HookRunInput { tracking, hook }, diff --git a/vendor/codex/codex-rs/analytics/src/events.rs b/vendor/codex/codex-rs/analytics/src/events.rs index 2ec16cdf..f8f94797 100644 --- a/vendor/codex/codex-rs/analytics/src/events.rs +++ b/vendor/codex/codex-rs/analytics/src/events.rs @@ -1,6 +1,5 @@ use std::time::Instant; -use crate::facts::AppInvocation; use crate::facts::CodexCompactionEvent; use crate::facts::CompactionImplementation; use crate::facts::CompactionPhase; @@ -19,7 +18,6 @@ use crate::facts::TurnSteerResult; use crate::facts::TurnSubmissionType; use crate::now_unix_seconds; use codex_app_server_protocol::CodexErrorInfo; -use codex_login::default_client::originator; use codex_protocol::approvals::NetworkApprovalProtocol; use codex_protocol::models::PermissionProfile; use codex_protocol::models::SandboxPermissions; @@ -53,8 +51,6 @@ pub(crate) enum TrackEventRequest { SkillInvocation(SkillInvocationEventRequest), ThreadInitialized(ThreadInitializedEvent), GuardianReview(Box), - AppMentioned(CodexAppMentionedEventRequest), - AppUsed(CodexAppUsedEventRequest), HookRun(CodexHookRunEventRequest), Compaction(Box), TurnEvent(Box), @@ -377,29 +373,6 @@ pub(crate) struct GuardianReviewEventPayload { pub(crate) guardian_review: GuardianReviewEventParams, } -#[derive(Serialize)] -pub(crate) struct CodexAppMetadata { - pub(crate) connector_id: Option, - pub(crate) thread_id: Option, - pub(crate) turn_id: Option, - pub(crate) app_name: Option, - pub(crate) product_client_id: Option, - pub(crate) invoke_type: Option, - pub(crate) model_slug: Option, -} - -#[derive(Serialize)] -pub(crate) struct CodexAppMentionedEventRequest { - pub(crate) event_type: &'static str, - pub(crate) event_params: CodexAppMetadata, -} - -#[derive(Serialize)] -pub(crate) struct CodexAppUsedEventRequest { - pub(crate) event_type: &'static str, - pub(crate) event_params: CodexAppMetadata, -} - #[derive(Serialize)] pub(crate) struct CodexHookRunMetadata { pub(crate) thread_id: Option, @@ -523,21 +496,6 @@ pub(crate) struct CodexTurnSteerEventRequest { pub(crate) event_params: CodexTurnSteerEventParams, } -pub(crate) fn codex_app_metadata( - tracking: &TrackEventsContext, - app: AppInvocation, -) -> CodexAppMetadata { - CodexAppMetadata { - connector_id: app.connector_id, - thread_id: Some(tracking.thread_id.clone()), - turn_id: Some(tracking.turn_id.clone()), - app_name: app.app_name, - product_client_id: Some(originator().value), - invoke_type: app.invocation_type, - model_slug: Some(tracking.model_slug.clone()), - } -} - pub(crate) fn codex_compaction_event_params( input: CodexCompactionEvent, app_server_client: CodexAppServerClientMetadata, diff --git a/vendor/codex/codex-rs/analytics/src/facts.rs b/vendor/codex/codex-rs/analytics/src/facts.rs index fe2a6e9a..1bb7b819 100644 --- a/vendor/codex/codex-rs/analytics/src/facts.rs +++ b/vendor/codex/codex-rs/analytics/src/facts.rs @@ -179,12 +179,6 @@ pub enum InvocationType { Implicit, } -pub struct AppInvocation { - pub connector_id: Option, - pub app_name: Option, - pub invocation_type: Option, -} - #[derive(Clone)] pub struct SubAgentThreadStartedInput { pub thread_id: String, @@ -298,8 +292,6 @@ pub(crate) enum CustomAnalyticsFact { TurnResolvedConfig(Box), TurnTokenUsage(Box), SkillInvoked(SkillInvokedInput), - AppMentioned(AppMentionedInput), - AppUsed(AppUsedInput), HookRun(HookRunInput), } @@ -308,16 +300,6 @@ pub(crate) struct SkillInvokedInput { pub invocations: Vec, } -pub(crate) struct AppMentionedInput { - pub tracking: TrackEventsContext, - pub mentions: Vec, -} - -pub(crate) struct AppUsedInput { - pub tracking: TrackEventsContext, - pub app: AppInvocation, -} - pub(crate) struct HookRunInput { pub tracking: TrackEventsContext, pub hook: HookRunFact, diff --git a/vendor/codex/codex-rs/analytics/src/lib.rs b/vendor/codex/codex-rs/analytics/src/lib.rs index ed0f1036..67059c69 100644 --- a/vendor/codex/codex-rs/analytics/src/lib.rs +++ b/vendor/codex/codex-rs/analytics/src/lib.rs @@ -18,7 +18,6 @@ pub use events::GuardianReviewTerminalStatus; pub use events::GuardianReviewTrackContext; pub use events::GuardianReviewedAction; pub use facts::AnalyticsJsonRpcError; -pub use facts::AppInvocation; pub use facts::CodexCompactionEvent; pub use facts::CodexTurnSteerEvent; pub use facts::CompactionImplementation; diff --git a/vendor/codex/codex-rs/analytics/src/reducer.rs b/vendor/codex/codex-rs/analytics/src/reducer.rs index b4e13c58..e097c802 100644 --- a/vendor/codex/codex-rs/analytics/src/reducer.rs +++ b/vendor/codex/codex-rs/analytics/src/reducer.rs @@ -1,7 +1,5 @@ use crate::events::AppServerRpcTransport; -use crate::events::CodexAppMentionedEventRequest; use crate::events::CodexAppServerClientMetadata; -use crate::events::CodexAppUsedEventRequest; use crate::events::CodexCompactionEventRequest; use crate::events::CodexHookRunEventRequest; use crate::events::CodexRuntimeMetadata; @@ -17,7 +15,6 @@ use crate::events::SkillInvocationEventRequest; use crate::events::ThreadInitializedEvent; use crate::events::ThreadInitializedEventParams; use crate::events::TrackEventRequest; -use crate::events::codex_app_metadata; use crate::events::codex_compaction_event_params; use crate::events::codex_hook_run_metadata; use crate::events::subagent_parent_thread_id; @@ -25,8 +22,6 @@ use crate::events::subagent_source_name; use crate::events::subagent_thread_started_event_request; use crate::facts::AnalyticsFact; use crate::facts::AnalyticsJsonRpcError; -use crate::facts::AppMentionedInput; -use crate::facts::AppUsedInput; use crate::facts::CodexCompactionEvent; use crate::facts::CustomAnalyticsFact; use crate::facts::HookRunInput; @@ -206,12 +201,6 @@ impl AnalyticsReducer { CustomAnalyticsFact::SkillInvoked(input) => { self.ingest_skill_invoked(input, out).await; } - CustomAnalyticsFact::AppMentioned(input) => { - self.ingest_app_mentioned(input, out); - } - CustomAnalyticsFact::AppUsed(input) => { - self.ingest_app_used(input, out); - } CustomAnalyticsFact::HookRun(input) => { self.ingest_hook_run(input, out); } @@ -414,26 +403,6 @@ impl AnalyticsReducer { } } - fn ingest_app_mentioned(&mut self, input: AppMentionedInput, out: &mut Vec) { - let AppMentionedInput { tracking, mentions } = input; - out.extend(mentions.into_iter().map(|mention| { - let event_params = codex_app_metadata(&tracking, mention); - TrackEventRequest::AppMentioned(CodexAppMentionedEventRequest { - event_type: "codex_app_mentioned", - event_params, - }) - })); - } - - fn ingest_app_used(&mut self, input: AppUsedInput, out: &mut Vec) { - let AppUsedInput { tracking, app } = input; - let event_params = codex_app_metadata(&tracking, app); - out.push(TrackEventRequest::AppUsed(CodexAppUsedEventRequest { - event_type: "codex_app_used", - event_params, - })); - } - fn ingest_hook_run(&mut self, input: HookRunInput, out: &mut Vec) { let HookRunInput { tracking, hook } = input; out.push(TrackEventRequest::HookRun(CodexHookRunEventRequest {