[plugins] Refresh plugin and tool caches after remote install (#28951)

Summary
- Refresh the installed remote-plugin snapshot and Codex Apps tools
after completing a remote JIT install.
- Gate `completed: true` on every expected `app_connector_id` appearing
after the uncached `tools/list` refresh, while continuing to skip local
bundle verification for server-side installs.
- Keep the cached recommendations response and filter refreshed
installed remote IDs locally, so this does not add another
recommendations fetch.
- Add regression coverage for tools appearing after the hard refresh and
remaining absent after the refresh. The resumed model request sees the
refreshed tool router when installation completes.

Root Cause
- Remote suggestions from `openai-curated-remote` returned `true` before
taking the existing connector refresh path, leaving the resumed turn
with the pre-install Apps tool catalog.

Validation
- `just test -p codex-core request_plugin_install`
- `just test -p codex-core-plugins
recommended_plugin_candidates_filter_installed_and_disabled_plugins`
- `just test -p codex-core-plugins`
- `just fix -p codex-core-plugins`
- `just fix -p codex-core`
- `just fmt`
- `just test -p codex-core` was not fully clean locally: 2,729 passed,
26 failed, and 16 skipped. The failures were dominated by local
Seatbelt/network/timing issues, including plugin-install timeouts under
full-suite contention; the focused plugin-install runs pass.
This commit is contained in:
Alex Daley authored and GitHub committed 2026-06-18 20:08:04 -04:00
1 parent 5c12034e42
commit 7e37354a58
5 files changed
+370 -53

No files matched your search

@@ -328,7 +328,27 @@ async fn verify_request_plugin_install_completed(
}),
DiscoverableTool::Plugin(plugin) => {
if is_remote_plugin_install_suggestion(&plugin.id) {
return true;
let (_, accessible_connectors) = tokio::join!(
refresh_remote_installed_plugins_cache_after_install(
session,
turn,
auth,
plugin.id.as_str(),
),
refresh_missing_requested_connectors(
session,
turn,
auth,
&plugin.app_connector_ids,
plugin.id.as_str(),
)
);
return accessible_connectors.is_some_and(|accessible_connectors| {
all_requested_connectors_picked_up(
&plugin.app_connector_ids,
&accessible_connectors,
)
});
}
session.reload_user_config_layer().await;
@@ -351,6 +371,29 @@ async fn verify_request_plugin_install_completed(
}
}
async fn refresh_remote_installed_plugins_cache_after_install(
session: &crate::session::session::Session,
turn: &crate::session::turn_context::TurnContext,
auth: Option<&codex_login::CodexAuth>,
tool_id: &str,
) {
let plugins_manager = &session.services.plugins_manager;
let plugins_config = turn.config.plugins_config_input();
if let Err(err) = plugins_manager
.build_and_cache_remote_installed_plugin_marketplaces(
&plugins_config,
auth,
&[REMOTE_GLOBAL_MARKETPLACE_NAME],
/*on_effective_plugins_changed*/ None,
)
.await
{
warn!(
"failed to refresh remote installed plugins cache after plugin install request for {tool_id}: {err:#}"
);
}
}
fn is_remote_plugin_install_suggestion(plugin_id: &str) -> bool {
plugin_id
.rsplit_once('@')