From ed41944897363063d0180042bc61b80b6ff0aa12 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 1 Oct 2025 13:57:06 -0400 Subject: [PATCH] Preflight auth for codex-acp --- crates/agent_ui/src/acp/thread_view.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rs index 544a609ededcdbf27205f26a66c5587c4dbc0be0..a7255d90bb72d0695f626b6f6d188ec5868449c9 100644 --- a/crates/agent_ui/src/acp/thread_view.rs +++ b/crates/agent_ui/src/acp/thread_view.rs @@ -577,6 +577,31 @@ impl AcpThreadView { AgentDiff::set_active_thread(&workspace, thread.clone(), window, cx); + // Proactively surface Authentication Required if the agent advertises auth methods. + if let Some(acp_conn) = thread + .read(cx) + .connection() + .clone() + .downcast::() + { + let methods = acp_conn.auth_methods(); + if !methods.is_empty() { + // Immediately transition to auth-required UI, but defer to avoid re-entrant update. + let err = AuthRequired { + description: None, + provider_id: None, + }; + let this_weak = cx.weak_entity(); + let agent = agent.clone(); + let connection = thread.read(cx).connection().clone(); + window.defer(cx, move |window, cx| { + Self::handle_auth_required( + this_weak, err, agent, connection, window, cx, + ); + }); + } + } + this.model_selector = thread .read(cx) .connection()