WIP fase 2b-2: rimosso login ChatGPT/OAuth/device code, agent/workload identity, backend-client; resta solo chiave API (test non tutti verdi)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-10 06:00:44 +01:00
parent 82347a58ed
commit 231e8cd136
661 changed files with 4924 additions and 64817 deletions

View File

@@ -38,7 +38,6 @@ use crate::metrics::timer::Timer;
use crate::sanitize_metric_tag_value;
use crate::tool_result::ToolResultEvent;
use crate::tool_result::emit_tool_result;
use codex_api::AgentIdentityTelemetry;
use codex_api::ResponseEvent;
use codex_protocol::AgentPath;
use codex_protocol::ThreadId;
@@ -90,7 +89,6 @@ pub struct AuthEnvTelemetryMetadata {
pub codex_api_key_env_enabled: bool,
pub provider_env_key_name: Option<String>,
pub provider_env_key_present: Option<bool>,
pub refresh_token_url_override_present: bool,
}
#[derive(Debug, Clone)]
@@ -704,7 +702,6 @@ impl SessionTelemetry {
auth.env_codex_api_key_enabled = self.metadata.auth_env.codex_api_key_env_enabled,
auth.env_provider_key_name = self.metadata.auth_env.provider_env_key_name.as_deref(),
auth.env_provider_key_present = self.metadata.auth_env.provider_env_key_present,
auth.env_refresh_token_url_override_present = self.metadata.auth_env.refresh_token_url_override_present,
reasoning_effort = reasoning_effort.as_ref().map(ToString::to_string),
reasoning_summary = %reasoning_summary,
context_window = context_window,
@@ -749,7 +746,6 @@ impl SessionTelemetry {
/*cf_ray*/ None,
/*auth_error*/ None,
/*auth_error_code*/ None,
/*agent_identity_telemetry*/ None,
);
response
@@ -772,7 +768,6 @@ impl SessionTelemetry {
cf_ray: Option<&str>,
auth_error: Option<&str>,
auth_error_code: Option<&str>,
agent_identity_telemetry: Option<&AgentIdentityTelemetry>,
) {
let success = status.is_some_and(|code| (200..=299).contains(&code)) && error.is_none();
let success_str = if success { "true" } else { "false" };
@@ -808,13 +803,10 @@ impl SessionTelemetry {
auth.env_codex_api_key_enabled = self.metadata.auth_env.codex_api_key_env_enabled,
auth.env_provider_key_name = self.metadata.auth_env.provider_env_key_name.as_deref(),
auth.env_provider_key_present = self.metadata.auth_env.provider_env_key_present,
auth.env_refresh_token_url_override_present = self.metadata.auth_env.refresh_token_url_override_present,
auth.request_id = request_id,
auth.cf_ray = cf_ray,
auth.error = auth_error,
auth.error_code = auth_error_code,
auth.agent_id = agent_identity_telemetry.map(|metadata| metadata.agent_id.as_str()),
auth.task_id = agent_identity_telemetry.map(|metadata| metadata.task_id.as_str()),
},
log: {},
trace: {},
@@ -838,7 +830,6 @@ impl SessionTelemetry {
cf_ray: Option<&str>,
auth_error: Option<&str>,
auth_error_code: Option<&str>,
agent_identity_telemetry: Option<&AgentIdentityTelemetry>,
) {
let success = error.is_none()
&& status
@@ -873,15 +864,12 @@ impl SessionTelemetry {
auth.env_codex_api_key_enabled = self.metadata.auth_env.codex_api_key_env_enabled,
auth.env_provider_key_name = self.metadata.auth_env.provider_env_key_name.as_deref(),
auth.env_provider_key_present = self.metadata.auth_env.provider_env_key_present,
auth.env_refresh_token_url_override_present = self.metadata.auth_env.refresh_token_url_override_present,
auth.connection_reused = false,
auth.reauth = reauth,
auth.request_id = request_id,
auth.cf_ray = cf_ray,
auth.error = auth_error,
auth.error_code = auth_error_code,
auth.agent_id = agent_identity_telemetry.map(|metadata| metadata.agent_id.as_str()),
auth.task_id = agent_identity_telemetry.map(|metadata| metadata.task_id.as_str()),
},
log: {},
trace: {},
@@ -893,7 +881,6 @@ impl SessionTelemetry {
duration: Duration,
error: Option<&str>,
connection_reused: bool,
agent_identity_telemetry: Option<&AgentIdentityTelemetry>,
) {
let success_str = if error.is_none() { "true" } else { "false" };
self.counter(
@@ -918,10 +905,7 @@ impl SessionTelemetry {
auth.env_codex_api_key_enabled = self.metadata.auth_env.codex_api_key_env_enabled,
auth.env_provider_key_name = self.metadata.auth_env.provider_env_key_name.as_deref(),
auth.env_provider_key_present = self.metadata.auth_env.provider_env_key_present,
auth.env_refresh_token_url_override_present = self.metadata.auth_env.refresh_token_url_override_present,
auth.connection_reused = connection_reused,
auth.agent_id = agent_identity_telemetry.map(|metadata| metadata.agent_id.as_str()),
auth.task_id = agent_identity_telemetry.map(|metadata| metadata.task_id.as_str()),
},
log: {},
trace: {},

View File

@@ -49,7 +49,7 @@ pub enum ToolDecisionSource {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Display)]
pub enum TelemetryAuthMode {
ApiKey,
Chatgpt,
Headers,
}
impl From<AuthMode> for TelemetryAuthMode {
@@ -58,11 +58,7 @@ impl From<AuthMode> for TelemetryAuthMode {
AuthMode::ApiKey | AuthMode::BedrockApiKey | AuthMode::BedrockAccessKeys => {
Self::ApiKey
}
AuthMode::Chatgpt
| AuthMode::ChatgptAuthTokens
| AuthMode::Headers
| AuthMode::AgentIdentity
| AuthMode::PersonalAccessToken => Self::Chatgpt,
AuthMode::Headers => Self::Headers,
}
}
}

View File

@@ -61,13 +61,11 @@ fn runtime_metrics_summary_collects_tool_api_and_streaming_metrics() -> Result<(
/*cf_ray*/ None,
/*auth_error*/ None,
/*auth_error_code*/ None,
/*agent_identity_telemetry*/ None,
);
manager.record_websocket_request(
Duration::from_millis(400),
/*error*/ None,
/*connection_reused*/ false,
/*agent_identity_telemetry*/ None,
);
let sse_response: std::result::Result<
Option<std::result::Result<StreamEvent, eventsource_stream::EventStreamError<&str>>>,