diff --git a/codex-rs/analytics/src/analytics_client_tests.rs b/codex-rs/analytics/src/analytics_client_tests.rs index f4cd18da1e9..a2b29d0626d 100644 --- a/codex-rs/analytics/src/analytics_client_tests.rs +++ b/codex-rs/analytics/src/analytics_client_tests.rs @@ -173,6 +173,7 @@ fn sample_thread_with_metadata( parent_thread_id, preview: "first prompt".to_string(), ephemeral, + history_mode: Default::default(), model_provider: "openai".to_string(), created_at: 1, updated_at: 2, @@ -182,6 +183,7 @@ fn sample_thread_with_metadata( cli_version: "0.0.0".to_string(), source, thread_source, + session_provenance: None, agent_nickname: None, agent_role: None, git_info: None, @@ -3310,7 +3312,6 @@ fn turn_event_serializes_expected_shape() { status: Some(TurnStatus::Completed), turn_error: None, codex_error_kind: None, - codex_error_subreason: None, codex_error_http_status_code: None, steer_count: Some(0), total_tool_call_count: None, @@ -3383,7 +3384,6 @@ fn turn_event_serializes_expected_shape() { "status": "completed", "turn_error": null, "codex_error_kind": null, - "codex_error_subreason": null, "codex_error_http_status_code": null, "steer_count": 0, "total_tool_call_count": null, @@ -3775,6 +3775,7 @@ async fn turn_event_counts_completed_tool_items() { status: DynamicToolCallStatus::Completed, content_items: None, success: Some(true), + error: None, duration_ms: Some(3), }, ThreadItem::CollabAgentToolCall { @@ -4090,10 +4091,6 @@ async fn turn_lifecycle_emits_failed_turn_event() { payload["event_params"]["codex_error_kind"], json!("invalid_request") ); - assert_eq!( - payload["event_params"]["codex_error_subreason"], - json!("unknown turn environment id `env-2`") - ); assert_eq!( payload["event_params"]["codex_error_http_status_code"], json!(null) diff --git a/codex-rs/analytics/src/client_tests.rs b/codex-rs/analytics/src/client_tests.rs index b7aa9f1c97d..3da274ab55e 100644 --- a/codex-rs/analytics/src/client_tests.rs +++ b/codex-rs/analytics/src/client_tests.rs @@ -127,6 +127,7 @@ fn sample_thread(thread_id: &str) -> Thread { parent_thread_id: None, preview: "first prompt".to_string(), ephemeral: false, + history_mode: Default::default(), model_provider: "openai".to_string(), created_at: 1, updated_at: 2, @@ -136,6 +137,7 @@ fn sample_thread(thread_id: &str) -> Thread { cli_version: "0.0.0".to_string(), source: AppServerSessionSource::Exec, thread_source: None, + session_provenance: None, agent_nickname: None, agent_role: None, git_info: None, diff --git a/codex-rs/analytics/src/events.rs b/codex-rs/analytics/src/events.rs index f0fcddd27fe..d03017340be 100644 --- a/codex-rs/analytics/src/events.rs +++ b/codex-rs/analytics/src/events.rs @@ -801,7 +801,6 @@ pub(crate) struct CodexTurnEventParams { pub(crate) status: Option, pub(crate) turn_error: Option, pub(crate) codex_error_kind: Option, - pub(crate) codex_error_subreason: Option, pub(crate) codex_error_http_status_code: Option, pub(crate) steer_count: Option, pub(crate) total_tool_call_count: Option, diff --git a/codex-rs/analytics/src/facts.rs b/codex-rs/analytics/src/facts.rs index 38af5ed8b82..d3688e4e307 100644 --- a/codex-rs/analytics/src/facts.rs +++ b/codex-rs/analytics/src/facts.rs @@ -30,9 +30,6 @@ use codex_protocol::request_permissions::RequestPermissionsResponse; use serde::Serialize; use std::path::PathBuf; -const INVALID_REQUEST_SUBREASON_MAX_BYTES: usize = 512; -const INVALID_REQUEST_SUBREASON_TRUNCATION_SUFFIX: &str = "..."; - #[derive(Clone, Debug, PartialEq, Eq, Serialize)] pub struct AcceptedLineFingerprint { pub path_hash: String, @@ -182,7 +179,6 @@ pub(crate) enum CodexErrKind { #[derive(Clone)] pub(crate) struct TurnCodexError { pub(crate) kind: CodexErrKind, - pub(crate) subreason: Option, pub(crate) http_status_code: Option, } @@ -190,26 +186,6 @@ impl TurnCodexError { fn from_codex_err(error: &CodexErr) -> Self { Self { kind: error.into(), - subreason: match error { - CodexErr::InvalidRequest(message) => { - // InvalidRequest can contain raw provider response bodies, so bound the - // analytics copy without changing the source CodexErr. - let subreason = if message.len() <= INVALID_REQUEST_SUBREASON_MAX_BYTES { - message.clone() - } else { - let truncated_len = message.floor_char_boundary( - INVALID_REQUEST_SUBREASON_MAX_BYTES - .saturating_sub(INVALID_REQUEST_SUBREASON_TRUNCATION_SUFFIX.len()), - ); - format!( - "{}{INVALID_REQUEST_SUBREASON_TRUNCATION_SUFFIX}", - &message[..truncated_len] - ) - }; - Some(subreason) - } - _ => None, - }, http_status_code: error.http_status_code_value(), } } diff --git a/codex-rs/analytics/src/reducer.rs b/codex-rs/analytics/src/reducer.rs index 61ae4d4df90..05e1348fd13 100644 --- a/codex-rs/analytics/src/reducer.rs +++ b/codex-rs/analytics/src/reducer.rs @@ -2476,7 +2476,6 @@ fn codex_turn_event_params( status: completed.status, turn_error: completed.turn_error, codex_error_kind: codex_error.map(|error| error.kind), - codex_error_subreason: codex_error.and_then(|error| error.subreason.clone()), codex_error_http_status_code: codex_error.and_then(|error| error.http_status_code), steer_count: Some(turn_state.steer_count), total_tool_call_count: Some(turn_state.tool_counts.total),