Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(conversation): stop double "…is running" line under a settled inline tool (#17371)

Arvin Xu0b8d54ae9c6c
diff --git a/src/features/Conversation/Messages/AssistantGroup/components/Group.test.tsx b/src/features/Conversation/Messages/AssistantGroup/components/Group.test.tsx
index 7ea7e857b52..47f3ba77de5 100644
--- a/src/features/Conversation/Messages/AssistantGroup/components/Group.test.tsx
+++ b/src/features/Conversation/Messages/AssistantGroup/components/Group.test.tsx
@@ -540,6 +540,55 @@ describe('Group', () => {
expect(screen.getByTestId('tail-running')).toHaveAttribute('data-id', 'assistant-1');
});
+ it('does not add a tail indicator when the inline segment ends on a LOADING_FLAT placeholder', () => {
+ // The settled tool is followed by a LOADING_FLAT placeholder that stays
+ // inside the inline segment; that block mounts MessageContent and renders
+ // its OWN running line, so the tail must NOT stack a second identical one.
+ mockIsGenerating = true;
+ render(
+ <Group
+ isLatestItem
+ id="assistant-1"
+ messageIndex={0}
+ blocks={[
+ blk({
+ content: '',
+ id: 'block-1',
+ tools: [{ apiName: 'bash', id: 'tool-1', result: { content: 'done' } } as any],
+ }),
+ blk({ content: LOADING_FLAT, id: 'block-2' }),
+ ]}
+ />,
+ );
+
+ expect(screen.queryByTestId('tail-running')).not.toBeInTheDocument();
+ });
+
+ it('keeps the tail indicator when the trailing block is a blank content:"" shell', () => {
+ // The gateway emits an empty `content: ''` assistant shell on stream_start.
+ // ContentBlock does NOT mount MessageContent for it (no text/LOADING_FLAT/
+ // tools), so it renders no running line of its own — the tail must stay to
+ // fill the gap after the settled tool until the first content chunk lands.
+ mockIsGenerating = true;
+ render(
+ <Group
+ isLatestItem
+ id="assistant-1"
+ messageIndex={0}
+ blocks={[
+ blk({
+ content: '',
+ id: 'block-1',
+ tools: [{ apiName: 'bash', id: 'tool-1', result: { content: 'done' } } as any],
+ }),
+ blk({ content: '', id: 'block-2' }),
+ ]}
+ />,
+ );
+
+ expect(screen.getByTestId('tail-running')).toHaveAttribute('data-id', 'assistant-1');
+ });
+
it('anchors the running indicator to the tool RESULT createdAt, not the tool-call block', () => {
mockIsGenerating = true;
// The tool result lands after the tool-call block; the tail timer must start
diff --git a/src/features/Conversation/Messages/AssistantGroup/components/Group.tsx b/src/features/Conversation/Messages/AssistantGroup/components/Group.tsx
index eca5a3156f6..43672ba6dc8 100644
--- a/src/features/Conversation/Messages/AssistantGroup/components/Group.tsx
+++ b/src/features/Conversation/Messages/AssistantGroup/components/Group.tsx
@@ -471,11 +471,23 @@ const Group = memo<GroupChildrenProps>(
// fill it. Multi-tool segments keep their own chrome; a tool still executing
// is covered by its own loading placeholder (areWorkflowToolsComplete=false).
const lastSegment = segments.at(-1);
+ // …unless that inline segment already ends on a LOADING_FLAT placeholder:
+ // that block mounts MessageContent, which renders its OWN "…is running" line
+ // (ContentBlock gates on text/LOADING_FLAT/tools), so the tail would stack a
+ // second identical line on top. Narrowly LOADING_FLAT (and tool-less): a
+ // blank `content: ''` shell — what the gateway emits on stream_start — does
+ // NOT mount MessageContent, so the tail must stay to fill the gap until the
+ // first content chunk lands.
+ const lastInlineBlock =
+ lastSegment?.kind === 'workflow' ? lastSegment.blocks.at(-1) : undefined;
+ const lastInlineRendersOwnLoading =
+ lastInlineBlock?.content === LOADING_FLAT && !lastInlineBlock.tools?.length;
const showTailRunningIndicator =
isGenerating &&
lastSegment?.kind === 'workflow' &&
shouldInlineWorkflowSegment(lastSegment.blocks) &&
- areWorkflowToolsComplete(lastSegment.blocks.flatMap((block) => block.tools ?? []));
+ areWorkflowToolsComplete(lastSegment.blocks.flatMap((block) => block.tools ?? [])) &&
+ !lastInlineRendersOwnLoading;
if (isCollapsed) {
return (