🤯 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: improve fallback trace error UI (#15746)
YuTengjingc4e446908311
diff --git a/src/features/Conversation/Error/index.test.tsx b/src/features/Conversation/Error/index.test.tsxindex 4bd1bb2fca7..334b90c48d1 100644--- a/src/features/Conversation/Error/index.test.tsx+++ b/src/features/Conversation/Error/index.test.tsx@@ -165,6 +165,55 @@ describe('ErrorMessageExtra', () => {expect(screen.getByText('dynamic')).toBeInTheDocument();});+ it('shows the trace-id report UI for fallback provider errors', () => {+ serverConfigMock.enableBusinessFeatures = true;++ render(+ <ErrorMessageExtra+ error={{ message: 'response.ProviderBizError' }}+ data={{+ error: {+ body: { traceId: 'trace-provider' },+ type: 'ProviderBizError',+ } as any,+ id: 'msg-provider-fallback',+ }}+ />,+ );++ expect(screen.getByText('dynamic')).toBeInTheDocument();+ });++ it('keeps localized Google block errors even when ProviderBizError carries a traceId', () => {+ serverConfigMock.enableBusinessFeatures = true;++ render(+ <ErrorMessageExtra+ error={{ message: 'response.GoogleAIBlockReason.SAFETY' }}+ data={{+ error: {+ body: {+ context: {+ promptFeedback: {+ blockReason: 'SAFETY',+ },+ },+ message: 'response.GoogleAIBlockReason.SAFETY',+ provider: 'google',+ traceId: 'trace-google-block',+ },+ message: 'response.GoogleAIBlockReason.SAFETY',+ type: 'ProviderBizError',+ } as any,+ id: 'msg-google-block-trace',+ }}+ />,+ );++ expect(screen.queryByText('dynamic')).not.toBeInTheDocument();+ expect(screen.getByText('response.GoogleAIBlockReason.SAFETY')).toBeInTheDocument();+ });+it('renders the auth guide when the refreshed error is missing type but still carries session code', () => {render(<ErrorMessageExtradiff --git a/src/features/Conversation/Error/index.tsx b/src/features/Conversation/Error/index.tsxindex f9f72114d27..1f86582327d 100644--- a/src/features/Conversation/Error/index.tsx+++ b/src/features/Conversation/Error/index.tsx@@ -116,6 +116,45 @@ const hasLocalizedErrorMessage = (return LEGACY_LOCALIZED_ERROR_TYPES.has(String(errorType));};+const isGoogleBlockedProviderError = (error?: ChatMessageError | null): boolean => {+ if (error?.type !== 'ProviderBizError') return false;++ const body = error.body as+ | {+ context?: {+ finishReason?: unknown;+ promptFeedback?: {+ blockReason?: unknown;+ };+ };+ provider?: unknown;+ }+ | undefined;++ if (body?.provider !== 'google') return false;++ return (+ typeof body.context?.promptFeedback?.blockReason === 'string' ||+ typeof body.context?.finishReason === 'string'+ );+};++const shouldShowTraceIdError = (+ error?: ChatMessageError | null,+): error is ChatMessageError & { body: { traceId: string } } => {+ if (typeof error?.body?.traceId !== 'string') return false;+ if (isGoogleBlockedProviderError(error)) return false;++ const errorType = error.type;+ if (errorType === undefined || errorType === null) return true;+ if (typeof errorType === 'number') return false;++ const spec = getErrorCodeSpec(String(errorType));+ if (spec?.isFallback) return true;++ return !hasLocalizedErrorMessage(errorType);+};+const isHeterogeneousAgentStatusGuideError = (value: unknown,): value is HeterogeneousAgentSessionError => {@@ -297,13 +336,9 @@ const ErrorMessageExtra = memo<ErrorExtraProps>(({ error: alertError, data, onRereturn <ChatInvalidAPIKey id={data.id} provider={data.error?.body?.provider} />;}- // Show a report action for unknown traceable errors instead of the raw body.- // Error types with a dedicated localized message keep the ErrorContent below.- if (- enableBusinessFeatures &&- !hasLocalizedErrorMessage(error?.type) &&- typeof error?.body?.traceId === 'string'- ) {+ // Show a report action for unknown or fallback-bucket traceable errors.+ // Specific known error types keep their dedicated localized message below.+ if (enableBusinessFeatures && shouldShowTraceIdError(error)) {return <TraceIdError id={data.id} traceId={error.body.traceId} />;}