mirror of
https://github.com/openai/codex.git
synced 2026-09-06 15:29:32 +00:00
tui: fix remote plugin section CI issues
This commit is contained in:
@@ -824,10 +824,11 @@ fn plugin_remote_section_error_next_step(label: &str, err: &str) -> &'static str
|
||||
} else if err.contains("service unavailable")
|
||||
|| err.contains("temporarily unavailable")
|
||||
|| err.contains("status 503")
|
||||
|| err.contains("failed to send")
|
||||
|| err.contains("request")
|
||||
|| err.contains("status")
|
||||
{
|
||||
"Try again later; local plugin functionality is still available."
|
||||
} else if err.contains("failed to send") || err.contains("request") || err.contains("status") {
|
||||
"Try again later; local plugin functionality is still available."
|
||||
} else if err.contains("disabled by admin") || err.contains("admin disabled") {
|
||||
"Ask a workspace admin to confirm plugin access."
|
||||
} else if label == "Shared with me" && err.contains("plugin") && err.contains("disabled") {
|
||||
@@ -857,7 +858,8 @@ pub(super) async fn request_plugin_list(
|
||||
request_handle: AppServerRequestHandle,
|
||||
cwd: PathBuf,
|
||||
) -> Result<PluginListResponse> {
|
||||
request_plugin_list_with_marketplace_kinds(request_handle, cwd, None).await
|
||||
request_plugin_list_with_marketplace_kinds(request_handle, cwd, /*marketplace_kinds*/ None)
|
||||
.await
|
||||
}
|
||||
|
||||
pub(super) async fn request_plugin_list_for_kinds(
|
||||
|
||||
@@ -498,9 +498,6 @@ impl App {
|
||||
AppEvent::PluginsLoaded { cwd, result } => {
|
||||
self.chat_widget.on_plugins_loaded(cwd, result);
|
||||
}
|
||||
AppEvent::OpenPluginsList { cwd, response } => {
|
||||
self.chat_widget.open_plugins_list(cwd, response);
|
||||
}
|
||||
AppEvent::PluginRemoteSectionsLoaded {
|
||||
cwd,
|
||||
marketplaces,
|
||||
|
||||
@@ -416,12 +416,6 @@ pub(crate) enum AppEvent {
|
||||
result: Result<PluginListResponse, String>,
|
||||
},
|
||||
|
||||
/// Open the plugin list from an already cached response.
|
||||
OpenPluginsList {
|
||||
cwd: PathBuf,
|
||||
response: PluginListResponse,
|
||||
},
|
||||
|
||||
/// Result of explicitly fetching remote-backed plugin sections.
|
||||
PluginRemoteSectionsLoaded {
|
||||
cwd: PathBuf,
|
||||
|
||||
@@ -222,6 +222,10 @@ impl ChatWidget {
|
||||
.bottom_pane
|
||||
.active_tab_id_for_active_view(PLUGINS_SELECTION_VIEW_ID)
|
||||
.is_some()
|
||||
|| self
|
||||
.bottom_pane
|
||||
.selected_index_for_active_view(PLUGINS_SELECTION_VIEW_ID)
|
||||
.is_some()
|
||||
|| !matches!(
|
||||
self.plugins_cache_for_current_cwd(),
|
||||
PluginsCacheState::Ready(_)
|
||||
@@ -247,7 +251,7 @@ impl ChatWidget {
|
||||
.as_deref()
|
||||
.and_then(|tab_id| {
|
||||
marketplace_tab_id_matching_saved_id(tab_id, &response.marketplaces)
|
||||
});
|
||||
});
|
||||
self.plugins_active_tab_id = active_tab_id;
|
||||
self.plugins_cache = PluginsCacheState::Ready(response.clone());
|
||||
if should_refresh_plugins_popup {
|
||||
@@ -356,36 +360,6 @@ impl ChatWidget {
|
||||
));
|
||||
}
|
||||
|
||||
pub(crate) fn open_plugins_list(&mut self, cwd: PathBuf, response: PluginListResponse) {
|
||||
if self.config.cwd.as_path() != cwd.as_path() {
|
||||
return;
|
||||
}
|
||||
|
||||
let response = match self.plugins_cache_for_current_cwd() {
|
||||
PluginsCacheState::Ready(current_response) => current_response,
|
||||
PluginsCacheState::Uninitialized
|
||||
| PluginsCacheState::Loading
|
||||
| PluginsCacheState::Failed(_) => response,
|
||||
};
|
||||
self.plugins_fetch_state.cache_cwd = Some(cwd);
|
||||
self.plugins_cache = PluginsCacheState::Ready(response.clone());
|
||||
let active_tab_id = self
|
||||
.bottom_pane
|
||||
.active_tab_id_for_active_view(PLUGINS_SELECTION_VIEW_ID)
|
||||
.map(str::to_string)
|
||||
.or_else(|| self.plugins_active_tab_id.clone())
|
||||
.or_else(|| Some(ALL_PLUGINS_TAB_ID.to_string()));
|
||||
self.plugins_active_tab_id = active_tab_id.clone();
|
||||
let params =
|
||||
self.plugins_popup_params(&response, active_tab_id, /*initial_selected_idx*/ None);
|
||||
if !self
|
||||
.bottom_pane
|
||||
.replace_selection_view_if_active(PLUGINS_SELECTION_VIEW_ID, params)
|
||||
{
|
||||
self.open_plugins_popup(&response);
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn open_marketplace_add_prompt(&mut self) {
|
||||
self.plugins_active_tab_id = Some(ADD_MARKETPLACE_TAB_ID.to_string());
|
||||
let tx = self.app_event_tx.clone();
|
||||
@@ -2099,7 +2073,7 @@ fn marketplace_tab_id_matching_saved_id(
|
||||
.as_ref()
|
||||
.is_some_and(|path| path.as_path().starts_with(root))
|
||||
.then(|| marketplace_tab_id(marketplace))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
fn merge_remote_marketplaces(
|
||||
|
||||
Reference in New Issue
Block a user