From 58ddcb818b7a931fc1a330302aeee28d4b686ad9 Mon Sep 17 00:00:00 2001 From: xintaofei Date: Sun, 22 Mar 2026 23:00:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BC=9A=E8=AF=9D=E6=9C=89?= =?UTF-8?q?=E6=97=B6=E6=97=A0=E6=B3=95=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/contexts/acp-connections-context.tsx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/contexts/acp-connections-context.tsx b/src/contexts/acp-connections-context.tsx index f6216d9..5c59b5b 100644 --- a/src/contexts/acp-connections-context.tsx +++ b/src/contexts/acp-connections-context.tsx @@ -1893,11 +1893,22 @@ export function AcpConnectionsProvider({ children }: { children: ReactNode }) { [] ) - const cancel = useCallback(async (contextKey: string) => { - const conn = storeRef.current.connections.get(contextKey) - if (!conn) return - await acpCancel(conn.connectionId) - }, []) + const cancel = useCallback( + async (contextKey: string) => { + const conn = storeRef.current.connections.get(contextKey) + if (!conn) return + await acpCancel(conn.connectionId) + // Optimistically transition status so the UI stops showing + // "responding" immediately. If the agent was slow to respond to + // the CancelNotification the frontend would otherwise stay stuck + // in the "prompting" state indefinitely. + const current = storeRef.current.connections.get(contextKey) + if (current?.status === "prompting") { + dispatch({ type: "STATUS_CHANGED", contextKey, status: "connected" }) + } + }, + [dispatch] + ) const respondPermission = useCallback( async (contextKey: string, requestId: string, optionId: string) => {