diff --git a/packages/ui/src/hooks/useEventStream.ts b/packages/ui/src/hooks/useEventStream.ts index 156a48e0..7af4d791 100644 --- a/packages/ui/src/hooks/useEventStream.ts +++ b/packages/ui/src/hooks/useEventStream.ts @@ -1462,6 +1462,17 @@ export const useEventStream = (options?: { enabled?: boolean }) => { return true; } + if (currentSessionIdRef.current === sessionId) { + const explicitSelection = useContextStore.getState().getSessionAgentSelection(sessionId); + if (explicitSelection && explicitSelection !== agentCandidate) { + const status = useSessionStore.getState().sessionStatus?.get(sessionId); + const isBusy = status?.type === 'busy' || status?.type === 'retry'; + if (isBusy) { + return false; + } + } + } + const last = lastUserAgentSelectionRef.current.get(sessionId); if (!last) return true;