Use runtime authentication for Analytics requests (#60101)

## What changed

- Honor `RuntimeAgentInstances` and the configured runtime auth mode for Analytics plan discovery and report requests to OpenAI endpoints.
- Share installation ID resolution and Codex runtime registration setup through `codex-runtime-agent-instance`.
- Preserve typed runtime authentication errors so expired credentials retain the “Sign in again to load Analytics” guidance.

## Testing

Add coverage for both runtime auth modes across regional and staging endpoints, fresh assertions for each request, sign-in guidance after bootstrap failure, redirect rejection, and invalid organization/project selectors.

GitOrigin-RevId: 50e0d959b3abd81ebe7a6a584e272f14cf52e504
This commit is contained in:
cooper-oai
2026-11-07 10:41:36 +00:00
committed by copyberry
parent efdacaf46f
commit cce9d3228b
25 changed files with 529 additions and 50 deletions
@@ -80,6 +80,24 @@ impl RuntimeAuthManager {
}
}
/// Construct a Codex runtime owner without registering it or generating its key.
pub fn for_codex(
credentials: Arc<AuthManager>,
chatgpt_base_url: &str,
installation_id: &str,
) -> Self {
Self::for_chatgpt(
credentials,
installation_id.to_owned(),
chatgpt_base_url.to_owned(),
RuntimeRegistrationMetadata {
harness: Some("codex".to_string()),
harness_version: Some(env!("CARGO_PKG_VERSION").to_string()),
role: crate::RuntimeRole::Orchestrator,
},
)
}
pub fn registration_url(&self) -> Result<Url, RegistrationError> {
self.login.registration_url()
}