fix(auth): isolate chatgptAuthTokens concept to auth manager and app-server (#10423)

So that the rest of the codebase (like TUI) don't need to be concerned
whether ChatGPT auth was handled by Codex itself or passed in via
app-server's external auth mode.
This commit is contained in:
Owen Lin
2026-02-05 10:46:06 -08:00
committed by GitHub
parent 5c0fd62ff1
commit 3582b74d01
20 changed files with 92 additions and 71 deletions

View File

@@ -2,8 +2,8 @@ use crate::harness::attributes_to_map;
use crate::harness::build_metrics_with_defaults;
use crate::harness::find_metric;
use crate::harness::latest_metrics;
use codex_app_server_protocol::AuthMode;
use codex_otel::OtelManager;
use codex_otel::TelemetryAuthMode;
use codex_otel::metrics::Result;
use codex_protocol::ThreadId;
use codex_protocol::protocol::SessionSource;
@@ -22,7 +22,7 @@ fn manager_attaches_metadata_tags_to_metrics() -> Result<()> {
"gpt-5.1",
Some("account-id".to_string()),
None,
Some(AuthMode::ApiKey),
Some(TelemetryAuthMode::ApiKey),
true,
"tty".to_string(),
SessionSource::Cli,
@@ -52,7 +52,10 @@ fn manager_attaches_metadata_tags_to_metrics() -> Result<()> {
"app.version".to_string(),
env!("CARGO_PKG_VERSION").to_string(),
),
("auth_mode".to_string(), AuthMode::ApiKey.to_string()),
(
"auth_mode".to_string(),
TelemetryAuthMode::ApiKey.to_string(),
),
("model".to_string(), "gpt-5.1".to_string()),
("service".to_string(), "codex-cli".to_string()),
("session_source".to_string(), "cli".to_string()),
@@ -73,7 +76,7 @@ fn manager_allows_disabling_metadata_tags() -> Result<()> {
"gpt-4o",
Some("account-id".to_string()),
None,
Some(AuthMode::ApiKey),
Some(TelemetryAuthMode::ApiKey),
true,
"tty".to_string(),
SessionSource::Cli,