mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Replace Sites migration state with a runtime compatibility guard (#46108)
## Why Older Desktop clients can still provide bundled Sites to an independently updated SSH app-server. A cached remote Sites install must take precedence, even when disabled, while a missing remote bundle must preserve the bundled fallback. ## What changed - Remove persisted bundled-plugin exclusions, Sites migration checks, and the migration wait when loading local plugin configuration. - Suppress `sites@openai-bundled` during plugin loading when the remote global catalog is active and a cached remote Sites install is available. - Remove exclusion-based catalog filtering and read/install guards, and simplify `install_plugin` to accept `ConfigLayerStack`. ## Testing Expand the agent-turn Sites test to cover enabled remote precedence, disabled remote suppression of bundled Sites, and fallback when the remote bundle is missing. GitOrigin-RevId: e2758596e5493ccee051cdfbf6b4afbe4f98948c
This commit is contained in:
1 parent
77c1feb00e
commit
108e6a6dbe
15 files changed
+41
-727
No files matched your search
@@ -1492,7 +1492,7 @@ impl PluginRequestProcessor {
|
||||
};
|
||||
|
||||
let result = match plugins_manager
|
||||
.install_plugin(&config.plugins_config_input(), request)
|
||||
.install_plugin(&config.config_layer_stack, request)
|
||||
.await
|
||||
{
|
||||
Ok(result) => result,
|
||||
|
||||
@@ -12,30 +12,14 @@ impl PluginRequestProcessor {
|
||||
&self,
|
||||
cwds: &[AbsolutePathBuf],
|
||||
) -> Result<Config, JSONRPCErrorError> {
|
||||
let config = if cwds.is_empty() {
|
||||
if cwds.is_empty() {
|
||||
self.config_manager
|
||||
.load_non_project_config()
|
||||
.await
|
||||
.map_err(|err| internal_error(format!("failed to reload config: {err}")))
|
||||
} else {
|
||||
self.load_latest_config(/*fallback_cwd*/ None).await
|
||||
}?;
|
||||
// TODO(sites-migration): Remove this initial migration wait after bundled Sites is retired.
|
||||
let auth = self.auth_manager.auth().await;
|
||||
match Box::pin(
|
||||
self.thread_manager
|
||||
.plugins_manager()
|
||||
.ensure_sites_migration_ready(&config.plugins_config_input(), auth.as_ref()),
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(Some(change)) => (self.effective_plugins_changed_callback())(change),
|
||||
Ok(None) => {}
|
||||
Err(err) => {
|
||||
warn!(error = %err, "Sites migration refresh failed; preserving local plugins")
|
||||
}
|
||||
}
|
||||
Ok(config)
|
||||
}
|
||||
|
||||
pub(super) async fn load_marketplace_context(
|
||||
|
||||
@@ -394,72 +394,6 @@ enabled = true
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn plugin_installed_hides_bundled_sites_when_remote_sites_is_effective() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
let server = MockServer::start().await;
|
||||
write_curated_marketplace(
|
||||
codex_home.path(),
|
||||
"bundled_marketplace.json",
|
||||
"openai-bundled",
|
||||
Some("OpenAI Bundled"),
|
||||
&["sites"],
|
||||
)?;
|
||||
write_installed_plugin(&codex_home, "openai-bundled", "sites")?;
|
||||
write_installed_plugin(&codex_home, "openai-curated-remote", "sites")?;
|
||||
std::fs::write(
|
||||
codex_home.path().join("config.toml"),
|
||||
format!(
|
||||
r#"chatgpt_base_url = "{}/backend-api/"
|
||||
|
||||
[features]
|
||||
plugins = true
|
||||
plugin_sharing = false
|
||||
|
||||
[plugins."sites@openai-bundled"]
|
||||
enabled = false
|
||||
"#,
|
||||
server.uri()
|
||||
),
|
||||
)?;
|
||||
write_remote_plugin_test_auth(codex_home.path())?;
|
||||
|
||||
let mut remote_sites: serde_json::Value = serde_json::from_str(&remote_installed_plugin_body(
|
||||
"", "1.2.3", /*enabled*/ false,
|
||||
))?;
|
||||
remote_sites["plugins"][0]["id"] =
|
||||
serde_json::json!("plugins~plugin_connector_1p_689987207de08191979cf68eca2941c6");
|
||||
remote_sites["plugins"][0]["name"] = serde_json::json!("sites");
|
||||
remote_sites["plugins"][0]["release"]["display_name"] = serde_json::json!("Sites");
|
||||
mount_remote_installed_plugins(&server, "GLOBAL", &serde_json::to_string(&remote_sites)?).await;
|
||||
mount_remote_installed_plugins(&server, "WORKSPACE", empty_remote_installed_plugins_body())
|
||||
.await;
|
||||
mount_empty_user_installed_plugins(&server).await;
|
||||
let mut app_server = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
.build_initialized_with_timeout(DEFAULT_TIMEOUT)
|
||||
.await?;
|
||||
let request_id = app_server
|
||||
.send_plugin_installed_request(PluginInstalledParams {
|
||||
cwds: None,
|
||||
install_suggestion_plugin_names: None,
|
||||
})
|
||||
.await?;
|
||||
let response: PluginInstalledResponse =
|
||||
timeout(DEFAULT_TIMEOUT, app_server.read_response(request_id)).await??;
|
||||
|
||||
assert_eq!(
|
||||
response
|
||||
.marketplaces
|
||||
.iter()
|
||||
.flat_map(|marketplace| &marketplace.plugins)
|
||||
.map(|plugin| (plugin.id.as_str(), plugin.enabled))
|
||||
.collect::<Vec<_>>(),
|
||||
vec![("sites@openai-curated-remote", false)]
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn plugin_installed_prefers_api_curated_conflicts_after_switching_to_api_auth() -> Result<()>
|
||||
{
|
||||
|
||||
@@ -421,102 +421,6 @@ async fn plugin_search_stitches_local_results_into_the_first_remote_page() -> Re
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn plugin_search_hides_bundled_sites_when_remote_sites_is_effective() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
let server = MockServer::start().await;
|
||||
let curated_root = codex_home.path().join(".tmp/plugins");
|
||||
write_local_marketplace(
|
||||
&curated_root,
|
||||
"openai-bundled",
|
||||
"bundled_marketplace.json",
|
||||
&[LocalPluginFixture {
|
||||
name: "sites",
|
||||
display_name: "Sites",
|
||||
keywords: &[],
|
||||
description: "Build and deploy websites",
|
||||
}],
|
||||
)?;
|
||||
write_installed_plugin(codex_home.path(), "openai-bundled", "sites")?;
|
||||
write_installed_plugin(codex_home.path(), "openai-curated-remote", "sites")?;
|
||||
std::fs::write(
|
||||
codex_home.path().join("config.toml"),
|
||||
format!(
|
||||
r#"chatgpt_base_url = "{}/backend-api/"
|
||||
|
||||
[features]
|
||||
plugins = true
|
||||
remote_plugin = true
|
||||
|
||||
[plugins."sites@openai-bundled"]
|
||||
enabled = false
|
||||
"#,
|
||||
server.uri()
|
||||
),
|
||||
)?;
|
||||
write_chatgpt_search_auth(codex_home.path())?;
|
||||
|
||||
let remote_sites_backend_id = "plugins~plugin_connector_1p_689987207de08191979cf68eca2941c6";
|
||||
let mut remote_sites = remote_plugin_json(
|
||||
remote_sites_backend_id,
|
||||
"sites",
|
||||
"GLOBAL",
|
||||
/*discoverability*/ None,
|
||||
);
|
||||
remote_sites["release"]["version"] = json!("1.2.3");
|
||||
remote_sites["enabled"] = json!(true);
|
||||
Mock::given(method("GET"))
|
||||
.and(path("/backend-api/ps/plugins/installed"))
|
||||
.respond_with(ResponseTemplate::new(200).set_body_json(json!({
|
||||
"plugins": [remote_sites],
|
||||
"pagination": {"next_page_token": null},
|
||||
})))
|
||||
.mount(&server)
|
||||
.await;
|
||||
Mock::given(method("GET"))
|
||||
.and(path("/backend-api/ps/plugins/search"))
|
||||
.and(query_param("q", "sites"))
|
||||
.respond_with(ResponseTemplate::new(200).set_body_json(json!({
|
||||
"plugins": [remote_plugin_json(
|
||||
remote_sites_backend_id,
|
||||
"sites",
|
||||
"GLOBAL",
|
||||
/*discoverability*/ None,
|
||||
)],
|
||||
"pagination": {"next_page_token": null},
|
||||
})))
|
||||
.expect(1)
|
||||
.mount(&server)
|
||||
.await;
|
||||
|
||||
let mut app_server = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
.without_auto_env()
|
||||
.build_initialized_with_timeout(DEFAULT_TIMEOUT)
|
||||
.await?;
|
||||
let request_id = app_server
|
||||
.send_plugin_search_request(PluginSearchParams {
|
||||
search_term: "sites".to_string(),
|
||||
scope: None,
|
||||
cwds: None,
|
||||
cursor: None,
|
||||
limit: None,
|
||||
})
|
||||
.await?;
|
||||
let response: PluginSearchResponse =
|
||||
timeout(DEFAULT_TIMEOUT, app_server.read_response(request_id)).await??;
|
||||
|
||||
assert_eq!(
|
||||
response
|
||||
.data
|
||||
.iter()
|
||||
.map(|result| result.plugin.id.as_str())
|
||||
.collect::<Vec<_>>(),
|
||||
vec!["sites@openai-curated-remote"]
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn plugin_search_returns_local_matches_for_api_key_auth() -> Result<()> {
|
||||
for remote_plugin_enabled in [false, true] {
|
||||
|
||||
Reference in new issue
Block a user