akseljoonas HF Staff commited on
Commit
e0e8f9a
·
1 Parent(s): 56e52d8

fix: restore activity status bar when switching back to session

Browse files

Detect running tools (input-available/input-streaming state) when
switching sessions so the shimmer label persists during tool execution.

frontend/src/components/SessionChat.tsx CHANGED
@@ -94,9 +94,18 @@ export default function SessionChat({ sessionId, isActive, onSessionDead }: Sess
94
  store.setActivityStatus({ type: 'tool', toolName: 'running' });
95
  store.setProcessing(true);
96
  } else {
97
- // No pending approval reset to idle
98
- store.setActivityStatus({ type: 'idle' });
99
- store.setProcessing(false);
 
 
 
 
 
 
 
 
 
100
  }
101
  }
102
  prevActiveRef.current = isActive;
 
94
  store.setActivityStatus({ type: 'tool', toolName: 'running' });
95
  store.setProcessing(true);
96
  } else {
97
+ // Check if any tools are still running (non-approval tools like bash, read, etc.)
98
+ const runningTool = lastAssistant?.parts.find(
99
+ (p) => p.type === 'dynamic-tool' && (p.state === 'input-available' || p.state === 'input-streaming')
100
+ );
101
+ if (runningTool && runningTool.type === 'dynamic-tool') {
102
+ const desc = (runningTool.input as Record<string, unknown>)?.description as string | undefined;
103
+ store.setActivityStatus({ type: 'tool', toolName: runningTool.toolName, description: desc });
104
+ store.setProcessing(true);
105
+ } else {
106
+ store.setActivityStatus({ type: 'idle' });
107
+ store.setProcessing(false);
108
+ }
109
  }
110
  }
111
  prevActiveRef.current = isActive;