mirror of
https://github.com/openai/codex.git
synced 2026-11-20 22:40:37 +00:00
Add opt-in OAuth discovery to config server loaders (#62432)
## What changed Allow config server bundle and auth loaders to discover authorization and token endpoints, plus an optional device authorization endpoint, from OAuth metadata when callers enable discovery and omit `config_server.oauth`. Discovery uses the bootstrap HTTP policy, times out after five seconds, and keeps the discovered settings in memory. Existing managed-config entry points pass `ConfigServerDiscovery::Disabled`. If bundle loader initialization fails, report the error on the first read and retry on later reads until a loader and its refresh worker can start. ## Testing Add tests for endpoint parsing and defaults, the discovery timeout, explicit OAuth precedence, disabled discovery, and local network policy. GitOrigin-RevId: 7cb72054147ec34f985d55dfe708fccfafcb4ba3
This commit is contained in:
@@ -963,7 +963,8 @@ impl AccountRequestProcessor {
|
||||
.await
|
||||
.map_err(|err| internal_error(format!("failed to set external auth: {err}")))?;
|
||||
self.config_manager
|
||||
.update_managed_config_loader(self.auth_manager.clone(), &self.config);
|
||||
.update_managed_config_loader(self.auth_manager.clone(), &self.config)
|
||||
.await;
|
||||
self.config_manager
|
||||
.sync_default_client_residency_requirement()
|
||||
.await;
|
||||
@@ -1040,7 +1041,8 @@ impl AccountRequestProcessor {
|
||||
.invalidate_mcp_runtimes_for(McpRefreshReason::AccountAuthReloaded)
|
||||
.await;
|
||||
self.config_manager
|
||||
.update_managed_config_loader(self.auth_manager.clone(), &self.config);
|
||||
.update_managed_config_loader(self.auth_manager.clone(), &self.config)
|
||||
.await;
|
||||
self.config_manager
|
||||
.sync_default_client_residency_requirement()
|
||||
.await;
|
||||
@@ -1583,7 +1585,9 @@ pub(crate) async fn logout_configured_account(
|
||||
.reload_with_cached_auth()
|
||||
.await
|
||||
.map_err(|err| internal_error(format!("logout failed: {err}")))?;
|
||||
config_manager.update_managed_config_loader(Arc::clone(auth_manager), fallback_config);
|
||||
config_manager
|
||||
.update_managed_config_loader(Arc::clone(auth_manager), fallback_config)
|
||||
.await;
|
||||
let config = config_manager
|
||||
.load_latest_config(/*fallback_cwd*/ None)
|
||||
.await;
|
||||
|
||||
@@ -228,7 +228,8 @@ impl AccountRequestProcessor {
|
||||
|
||||
async fn reload_workspace_config(&self) {
|
||||
self.config_manager
|
||||
.update_managed_config_loader(self.auth_manager.clone(), &self.config);
|
||||
.update_managed_config_loader(self.auth_manager.clone(), &self.config)
|
||||
.await;
|
||||
self.config_manager
|
||||
.sync_default_client_residency_requirement()
|
||||
.await;
|
||||
|
||||
Reference in New Issue
Block a user