Avoid fatal TUI errors on skills list failure (#18061)

Addresses #17951

Problem: The TUI treated skills/list failures as fatal during refresh,
so proxy/firewall responses that break plugin discovery could crash the
session.

Solution: Route startup and refresh skills/list responses through shared
graceful handling that logs a warning and keeps the TUI running.
This commit is contained in:
Eric Traut
2026-04-16 10:30:28 -07:00
committed by GitHub
parent 2ca270d08d
commit ff9744fd66

View File

@@ -2514,14 +2514,16 @@ impl App {
Ok(true)
}
AppCommandView::ListSkills { cwds, force_reload } => {
let response = app_server
.skills_list(codex_app_server_protocol::SkillsListParams {
cwds: cwds.to_vec(),
force_reload,
per_cwd_extra_user_roots: None,
})
.await?;
self.handle_skills_list_response(response);
self.handle_skills_list_result(
app_server
.skills_list(codex_app_server_protocol::SkillsListParams {
cwds: cwds.to_vec(),
force_reload,
per_cwd_extra_user_roots: None,
})
.await,
"failed to refresh skills",
);
Ok(true)
}
AppCommandView::Compact => {
@@ -2595,6 +2597,19 @@ impl App {
}
}
fn handle_skills_list_result(
&mut self,
result: Result<SkillsListResponse>,
failure_message: &str,
) {
match result {
Ok(response) => self.handle_skills_list_response(response),
Err(err) => {
tracing::warn!("{failure_message}: {err:#}");
}
}
}
async fn try_resolve_app_server_request(
&mut self,
app_server: &AppServerSession,
@@ -4002,17 +4017,16 @@ impl App {
app.enqueue_primary_thread_session(started.session, started.turns)
.await?;
}
match app_server
.skills_list(codex_app_server_protocol::SkillsListParams {
cwds: vec![app.config.cwd.to_path_buf()],
force_reload: true,
per_cwd_extra_user_roots: None,
})
.await
{
Ok(response) => app.handle_skills_list_response(response),
Err(err) => tracing::warn!("failed to load skills on startup: {err:#}"),
}
app.handle_skills_list_result(
app_server
.skills_list(codex_app_server_protocol::SkillsListParams {
cwds: vec![app.config.cwd.to_path_buf()],
force_reload: true,
per_cwd_extra_user_roots: None,
})
.await,
"failed to load skills on startup",
);
// On startup, if Agent mode (workspace-write) or ReadOnly is active, warn about world-writable dirs on Windows.
#[cfg(target_os = "windows")]