mirror of
https://github.com/openai/codex.git
synced 2026-11-22 07:13:50 +00:00
Respect system proxies during plugin startup sync (#34506)
## Why The curated plugin startup sync can fall back from Git to HTTP, but those requests did not use Codex's effective outbound proxy policy. ## What changed - Thread the configured HTTP client factory into curated plugin sync. - Route GitHub API, zipball, backup metadata, and returned download URLs through the route-aware client when system proxy support is enabled. - Preserve the existing default HTTP client behavior, including its custom CA fallback, when system proxy support is disabled. - Apply the standard Codex headers to startup-sync HTTP requests. ## Testing Add coverage that records route selection for repository, archive, metadata, and backend-supplied download URLs, and verifies standard headers are sent. GitOrigin-RevId: e1ea13bdab58a84c9948a2c8b82a5ec5c964ea99
This commit is contained in:
1 parent
cc875d61ce
commit
94bb6a09a6
17 files changed
+453
-87
No files matched your search
@@ -70,6 +70,7 @@ use codex_core_skills::PluginSkillSnapshots;
|
||||
use codex_core_skills::config_rules::skill_config_rules_from_stack;
|
||||
use codex_core_skills::loader::MAX_CONCURRENT_ROOT_SCANS;
|
||||
use codex_hooks::plugin_hook_declarations;
|
||||
use codex_http_client::HttpClientFactory;
|
||||
use codex_login::AuthManager;
|
||||
use codex_login::CodexAuth;
|
||||
use codex_plugin::AppConnectorId;
|
||||
@@ -115,6 +116,7 @@ pub struct PluginsConfigInput {
|
||||
pub plugins_enabled: bool,
|
||||
pub remote_plugin_enabled: bool,
|
||||
pub chatgpt_base_url: String,
|
||||
http_client_factory: HttpClientFactory,
|
||||
}
|
||||
|
||||
impl PluginsConfigInput {
|
||||
@@ -123,14 +125,24 @@ impl PluginsConfigInput {
|
||||
plugins_enabled: bool,
|
||||
remote_plugin_enabled: bool,
|
||||
chatgpt_base_url: String,
|
||||
http_client_factory: HttpClientFactory,
|
||||
) -> Self {
|
||||
Self {
|
||||
config_layer_stack,
|
||||
plugins_enabled,
|
||||
remote_plugin_enabled,
|
||||
chatgpt_base_url,
|
||||
http_client_factory,
|
||||
}
|
||||
}
|
||||
|
||||
/// Builds route-aware service state for remote plugin requests.
|
||||
pub fn remote_plugin_service_config(&self) -> RemotePluginServiceConfig {
|
||||
RemotePluginServiceConfig::new(
|
||||
self.chatgpt_base_url.clone(),
|
||||
self.http_client_factory.clone(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Effective-plugin changes that downstream composition layers may act on.
|
||||
@@ -236,9 +248,7 @@ struct ConfiguredMarketplaceUpgradeState {
|
||||
}
|
||||
|
||||
fn remote_plugin_service_config(config: &PluginsConfigInput) -> RemotePluginServiceConfig {
|
||||
RemotePluginServiceConfig {
|
||||
chatgpt_base_url: config.chatgpt_base_url.clone(),
|
||||
}
|
||||
config.remote_plugin_service_config()
|
||||
}
|
||||
|
||||
fn featured_plugin_ids_cache_key(
|
||||
@@ -1975,7 +1985,7 @@ impl PluginsManager {
|
||||
let use_remote_global_catalog =
|
||||
config.remote_plugin_enabled && auth_manager.current_auth_uses_codex_backend();
|
||||
if !use_remote_global_catalog {
|
||||
self.start_curated_repo_sync();
|
||||
self.start_curated_repo_sync(config.http_client_factory.clone());
|
||||
}
|
||||
let should_spawn_marketplace_auto_upgrade = {
|
||||
let mut state = match self.configured_marketplace_upgrade_state.write() {
|
||||
@@ -2356,7 +2366,7 @@ impl PluginsManager {
|
||||
}
|
||||
}
|
||||
|
||||
fn start_curated_repo_sync(self: &Arc<Self>) {
|
||||
fn start_curated_repo_sync(self: &Arc<Self>, http_client_factory: HttpClientFactory) {
|
||||
if CURATED_REPO_SYNC_STARTED.swap(true, Ordering::SeqCst) {
|
||||
return;
|
||||
}
|
||||
@@ -2364,8 +2374,8 @@ impl PluginsManager {
|
||||
let codex_home = self.codex_home.clone();
|
||||
if let Err(err) = std::thread::Builder::new()
|
||||
.name("plugins-curated-repo-sync".to_string())
|
||||
.spawn(
|
||||
move || match sync_openai_plugins_repo(codex_home.as_path()) {
|
||||
.spawn(move || {
|
||||
match sync_openai_plugins_repo(codex_home.as_path(), http_client_factory) {
|
||||
Ok(curated_plugin_version) => {
|
||||
let configured_curated_plugin_ids =
|
||||
configured_curated_plugin_ids_from_codex_home(codex_home.as_path());
|
||||
@@ -2389,8 +2399,8 @@ impl PluginsManager {
|
||||
CURATED_REPO_SYNC_STARTED.store(false, Ordering::SeqCst);
|
||||
warn!("failed to sync curated plugins repo: {err}");
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
})
|
||||
{
|
||||
CURATED_REPO_SYNC_STARTED.store(false, Ordering::SeqCst);
|
||||
warn!("failed to start curated plugins repo sync task: {err}");
|
||||
|
||||
Reference in new issue
Block a user