🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix: show success status for tool calls with no return value (#13905)
Innei2f4fbd35d493
diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/StatusIndicator.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/StatusIndicator.tsxindex 8e9a6d7cb4f..637fd9ff3e0 100644--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/StatusIndicator.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/StatusIndicator.tsx@@ -10,64 +10,74 @@ import { LOADING_FLAT } from '@/const/message';interface StatusIndicatorProps {intervention?: ToolIntervention;+ /**+ * Whether the tool is currently executing (from operation state).+ * When false and result exists, treat as completed even if content is empty.+ */+ isToolExecuting?: boolean;result?: { content: string | null; error?: any; state?: any };/** Successful tool payload that should surface as warning (e.g. activateTools with only notFound). */successVariant?: 'default' | 'warning';}-const StatusIndicator = memo<StatusIndicatorProps>(({ intervention, result, successVariant }) => {- const { t } = useTranslation('chat');+const StatusIndicator = memo<StatusIndicatorProps>(+ ({ intervention, isToolExecuting, result, successVariant }) => {+ const { t } = useTranslation('chat');- const hasError = !!result?.error;- const hasSuccessResult = !!result?.content && result.content !== LOADING_FLAT;- const hasResult = hasSuccessResult || hasError;- const isPending = intervention?.status === 'pending';- const isReject = intervention?.status === 'rejected';- const isAbort = intervention?.status === 'aborted';+ const hasError = !!result?.error;+ const hasSuccessResult = !!result?.content && result.content !== LOADING_FLAT;+ const hasResult = hasSuccessResult || hasError;+ const isPending = intervention?.status === 'pending';+ const isReject = intervention?.status === 'rejected';+ const isAbort = intervention?.status === 'aborted';- let icon;+ // Tool is complete if operation is not running and we have a result object (even if content is empty)+ const isToolComplete = isToolExecuting === false && !!result;- if (isAbort) {- icon = (- <Tooltip title={t('tool.intervention.toolAbort')}>- <Icon color={cssVar.colorTextTertiary} icon={PauseIcon} />- </Tooltip>- );- } else if (isReject) {- icon = (- <Tooltip title={t('tool.intervention.toolRejected')}>- <Icon color={cssVar.colorTextTertiary} icon={Ban} />- </Tooltip>- );- } else if (hasError) {- icon = <Icon color={cssVar.colorError} icon={X} />;- } else if (isPending) {- icon = <Icon color={cssVar.colorInfo} icon={HandIcon} />;- } else if (hasSuccessResult && !hasError && successVariant === 'warning') {- icon = <Icon color={cssVar.colorWarning} icon={AlertTriangle} />;- } else if (hasResult) {- icon = <Icon color={cssVar.colorSuccess} icon={Check} />;- } else {- icon = <NeuralNetworkLoading size={16} />;- }+ let icon;- return (- <Block- horizontal- align={'center'}- flex={'none'}- gap={4}- height={24}- justify={'center'}- variant={'outlined'}- width={24}- style={{- fontSize: 12,- }}- >- {icon}- </Block>- );-});+ if (isAbort) {+ icon = (+ <Tooltip title={t('tool.intervention.toolAbort')}>+ <Icon color={cssVar.colorTextTertiary} icon={PauseIcon} />+ </Tooltip>+ );+ } else if (isReject) {+ icon = (+ <Tooltip title={t('tool.intervention.toolRejected')}>+ <Icon color={cssVar.colorTextTertiary} icon={Ban} />+ </Tooltip>+ );+ } else if (hasError) {+ icon = <Icon color={cssVar.colorError} icon={X} />;+ } else if (isPending) {+ icon = <Icon color={cssVar.colorInfo} icon={HandIcon} />;+ } else if (hasSuccessResult && !hasError && successVariant === 'warning') {+ icon = <Icon color={cssVar.colorWarning} icon={AlertTriangle} />;+ } else if (hasResult || isToolComplete) {+ icon = <Icon color={cssVar.colorSuccess} icon={Check} />;+ } else {+ icon = <NeuralNetworkLoading size={16} />;+ }++ return (+ <Block+ horizontal+ align={'center'}+ flex={'none'}+ gap={4}+ height={24}+ justify={'center'}+ variant={'outlined'}+ width={24}+ style={{+ fontSize: 12,+ }}+ >+ {icon}+ </Block>+ );+ },+);export default StatusIndicator;diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/index.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/index.tsxindex c4bf46eefa7..efd5cc347a8 100644--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/index.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/index.tsx@@ -7,7 +7,6 @@ import { Flexbox } from '@lobehub/ui';import { memo } from 'react';import SafeBoundary from '@/components/ErrorBoundary';-import { LOADING_FLAT } from '@/const/message';import ExecutionTime from './ExecutionTime';import StatusIndicator from './StatusIndicator';@@ -22,23 +21,32 @@ interface InspectorProps {* Whether the tool arguments are currently streaming*/isArgumentsStreaming?: boolean;+ /**+ * Whether the tool is currently executing (from operation state)+ */+ isToolCalling?: boolean;result?: { content: string | null; error?: any; state?: any };}const Inspectors = memo<InspectorProps>(- ({ identifier, apiName, arguments: argsStr, result, intervention, isArgumentsStreaming }) => {- const hasError = !!result?.error;- const hasSuccessResult = !!result?.content && result.content !== LOADING_FLAT;- const hasResult = hasSuccessResult || hasError;-+ ({+ identifier,+ apiName,+ arguments: argsStr,+ result,+ intervention,+ isArgumentsStreaming,+ isToolCalling,+ }) => {const isPending = intervention?.status === 'pending';const isAborted = intervention?.status === 'aborted';const isRejected = intervention?.status === 'rejected';- // Distinguish between arguments streaming and tool executing- const isToolExecuting =- !hasResult && !isPending && !isAborted && !isRejected && !isArgumentsStreaming;- const isTitleLoading = isArgumentsStreaming || isToolExecuting;+ // Align with Tool/index.tsx: isToolCalling uses operation state + busy-message fallback.+ // Do not infer "executing" from missing result alone (ended runs may omit merged result).+ const isToolCallActive = Boolean(isToolCalling) && !isPending && !isAborted && !isRejected;+ const isTitleLoading = isArgumentsStreaming || isToolCallActive;+ const showExecutionTimer = isToolCallActive && !isArgumentsStreaming;const activateToolsState = result?.state as ActivateToolsState | undefined;let statusSuccessVariant: 'warning' | undefined;@@ -69,6 +77,7 @@ const Inspectors = memo<InspectorProps>(<Flexbox allowShrink horizontal align={'center'} gap={6}><StatusIndicatorintervention={intervention}+ isToolExecuting={isToolCalling}result={result}successVariant={statusSuccessVariant}/>@@ -84,7 +93,7 @@ const Inspectors = memo<InspectorProps>(result={result}/></SafeBoundary>- <ExecutionTime isExecuting={isToolExecuting} />+ <ExecutionTime isExecuting={showExecutionTimer} /></Flexbox>);}@@ -96,6 +105,7 @@ const Inspectors = memo<InspectorProps>(<Flexbox horizontal align={'center'} gap={6}><StatusIndicatorintervention={intervention}+ isToolExecuting={isToolCalling}result={result}successVariant={statusSuccessVariant}/>@@ -107,7 +117,7 @@ const Inspectors = memo<InspectorProps>(isLoading={isTitleLoading}partialArgs={partialJson || undefined}/>- <ExecutionTime isExecuting={isToolExecuting} />+ <ExecutionTime isExecuting={showExecutionTimer} /></Flexbox>);},diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsxindex 5e13ecae52d..9b4b58e0e97 100644--- a/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx@@ -82,12 +82,19 @@ const Tool = memo<GroupToolProps>(operationSelectors.isMessageInToolCalling(assistantMessageId),);- // Fallback: arguments completed but no final result yet+ // Only treat "missing/placeholder result" as in-flight while this assistant+ // message still has a running operation. After the run ends, tools may+ // legitimately have no merged `result` — do not keep showing "executing".+ const isAssistantMessageBusy = useChatStore(+ operationSelectors.isMessageProcessing(assistantMessageId),+ );+const hasError = !!result?.error;- const isToolCallingFallback =+ const looksLikeWaitingForToolResult =!hasError &&!isArgumentsStreaming &&(!result || result.content === LOADING_FLAT || !result.content);+ const isToolCallingFallback = looksLikeWaitingForToolResult && isAssistantMessageBusy;const isToolCalling = isToolCallingFromOperation || isToolCallingFallback;const hasCustomRender = !!getBuiltinRender(identifier, apiName);@@ -142,6 +149,7 @@ const Tool = memo<GroupToolProps>(identifier={identifier}intervention={intervention}isArgumentsStreaming={isArgumentsStreaming}+ isToolCalling={isToolCalling}result={result}/>}diff --git a/src/features/Onboarding/components/ModeSwitch.test.tsx b/src/features/Onboarding/components/ModeSwitch.test.tsxindex 0a44e5eed11..eaefe052de2 100644--- a/src/features/Onboarding/components/ModeSwitch.test.tsx+++ b/src/features/Onboarding/components/ModeSwitch.test.tsx@@ -3,18 +3,30 @@ import type { ReactNode } from 'react';import { MemoryRouter } from 'react-router-dom';import { afterEach, describe, expect, it, vi } from 'vitest';+import ModeSwitch from './ModeSwitch';++const mockConfig = vi.hoisted(() => ({ agentOnboardingEnabled: true }));+vi.mock('react-i18next', () => ({useTranslation: () => ({t: (key: string) =>- ({- 'agent.modeSwitch.agent': 'Conversational',- 'agent.modeSwitch.classic': 'Classic',- 'agent.modeSwitch.label': 'Choose your onboarding mode',- })[key] || key,+ (+ ({+ 'agent.modeSwitch.agent': 'Conversational',+ 'agent.modeSwitch.classic': 'Classic',+ 'agent.modeSwitch.label': 'Choose your onboarding mode',+ }) as Record<string, string>+ )[key] || key,}),}));-const renderModeSwitch = async ({+vi.mock('@/routes/onboarding/config', () => ({+ get AGENT_ONBOARDING_ENABLED() {+ return mockConfig.agentOnboardingEnabled;+ },+}));++const renderModeSwitch = ({actions,enabled,entry = '/onboarding/agent',@@ -25,12 +37,7 @@ const renderModeSwitch = async ({entry?: string;showLabel?: boolean;}) => {- vi.resetModules();- vi.doMock('@/routes/onboarding/config', () => ({- AGENT_ONBOARDING_ENABLED: enabled,- }));-- const { default: ModeSwitch } = await import('./ModeSwitch');+ mockConfig.agentOnboardingEnabled = enabled;render(<MemoryRouter initialEntries={[entry]}>@@ -41,28 +48,28 @@ const renderModeSwitch = async ({afterEach(() => {cleanup();- vi.doUnmock('@/routes/onboarding/config');+ mockConfig.agentOnboardingEnabled = true;});describe('ModeSwitch', () => {- it('renders both onboarding variants when agent onboarding is enabled', async () => {- await renderModeSwitch({ enabled: true, showLabel: true });+ it('renders both onboarding variants when agent onboarding is enabled', () => {+ renderModeSwitch({ enabled: true, showLabel: true });expect(screen.getByText('Choose your onboarding mode')).toBeInTheDocument();expect(screen.getByRole('radio', { name: 'Conversational' })).toBeChecked();expect(screen.getByRole('radio', { name: 'Classic' })).not.toBeChecked();});- it('hides the onboarding switch entirely when agent onboarding is disabled', async () => {- await renderModeSwitch({ enabled: false });+ it('hides the onboarding switch entirely when agent onboarding is disabled', () => {+ renderModeSwitch({ enabled: false });expect(screen.queryByRole('radio', { name: 'Conversational' })).not.toBeInTheDocument();expect(screen.queryByRole('radio', { name: 'Classic' })).not.toBeInTheDocument();expect(screen.queryByText('Choose your onboarding mode')).not.toBeInTheDocument();});- it('keeps action buttons visible when agent onboarding is disabled', async () => {- await renderModeSwitch({+ it('keeps action buttons visible when agent onboarding is disabled', () => {+ renderModeSwitch({actions: <button type="button">Restart</button>,enabled: false,});diff --git a/src/features/PageEditor/History/DocumentHistoryDiff.tsx b/src/features/PageEditor/History/DocumentHistoryDiff.tsxindex 258da7b6c7f..eb7ccaadc9f 100644--- a/src/features/PageEditor/History/DocumentHistoryDiff.tsx+++ b/src/features/PageEditor/History/DocumentHistoryDiff.tsx@@ -92,7 +92,7 @@ const DocumentHistoryDiff = memo<DocumentHistoryDiffProps>(({ documentId, histor<Flexbox className={styles.container} flex={1} gap={0}>{isLoading && !data ? (<Flexbox align={'center'} className={styles.empty} justify={'center'}>- <CircleLoading />;+ <CircleLoading /></Flexbox>) : error || !data || !normalizedValues.oldValue || !normalizedValues.newValue ? (<Flexbox align={'center'} className={styles.empty} justify={'center'}>