web: show 'Waiting for subagents...' status in chat panel

This commit is contained in:
kumarabhirup 2026-02-21 11:04:37 -08:00
parent 149dfb7d50
commit 119dcdc775
No known key found for this signature in database
GPG Key ID: DB7CA2289CAB0167

View File

@ -881,6 +881,8 @@ export const ChatPanel = forwardRef<ChatPanelHandle, ChatPanelProps>(
}, []);
// ── Poll for subagent spawns during active streaming ──
const [hasRunningSubagents, setHasRunningSubagents] = useState(false);
useEffect(() => {
if (!currentSessionId || !onSubagentSpawned) {return;}
let cancelled = false;
@ -899,7 +901,9 @@ export const ChatPanel = forwardRef<ChatPanelHandle, ChatPanelProps>(
label?: string;
status: "running" | "completed" | "error";
}> = data.subagents ?? [];
let anyRunning = false;
for (const sa of subagents) {
if (sa.status === "running") {anyRunning = true;}
onSubagentSpawned({
childSessionKey: sa.sessionKey,
runId: sa.runId,
@ -909,6 +913,7 @@ export const ChatPanel = forwardRef<ChatPanelHandle, ChatPanelProps>(
status: sa.status,
});
}
if (!cancelled) {setHasRunningSubagents(anyRunning);}
} catch { /* ignore */ }
};
@ -1343,7 +1348,7 @@ export const ChatPanel = forwardRef<ChatPanelHandle, ChatPanelProps>(
: status === "submitted"
? "Thinking..."
: status === "streaming"
? "Streaming..."
? (hasRunningSubagents ? "Waiting for subagents..." : "Streaming...")
: status === "error"
? "Error"
: status;