Skip to content

Commit fa22aa2

Browse files
IM.codesclaude
andcommitted
fix: scan-sweep animation only triggers on authoritative running state
isVisuallyBusy was using activeThinking as a fallback trigger for the scan-sweep animation, causing ghost animations when thinking lingered after agent stopped (Gemini idle confirmation delay, undefined state). Now only session.state === 'running' drives animations. activeThinking is kept for text labels and thinking timers only. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 27b1379 commit fa22aa2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

web/src/thinking-utils.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ export function getActiveThinkingTs(events: Array<{ type: string; ts: number; pa
4343
* Unified "visual busy" derivation — single source of truth for all running animations.
4444
* Use this instead of ad-hoc conditions in each component.
4545
*
46-
* An agent is visually busy when:
47-
* - session.state === 'running', OR
48-
* - activeThinking is true AND session.state is NOT 'idle'
49-
* (prevents animation flicker when thinking lingers briefly after idle)
46+
* Only authoritative session.state drives the main animation (scan-sweep, subcard pulse).
47+
* activeThinking is intentionally NOT used here — it's a derivative signal that can linger
48+
* after the agent stops (e.g., Gemini idle confirmation takes 3+s). Using it caused ghost
49+
* animations on the main session input bar. activeThinking should only drive text labels
50+
* and thinking timers, not high-visibility animations.
5051
*/
51-
export function isVisuallyBusy(sessionState: string | undefined, activeThinking: boolean): boolean {
52-
if (sessionState === 'running') return true;
53-
if (activeThinking && sessionState !== 'idle') return true;
54-
return false;
52+
export function isVisuallyBusy(sessionState: string | undefined, _activeThinking: boolean): boolean {
53+
if (!sessionState || sessionState === 'idle' || sessionState === 'stopped') return false;
54+
return sessionState === 'running';
5555
}

0 commit comments

Comments
 (0)