The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(conversations): add missing reducers to test store
Steven Enamakel48ac4aaeb93a
diff --git a/app/src/features/conversations/Conversations.processSourceCommand.test.tsx b/app/src/features/conversations/Conversations.processSourceCommand.test.tsxindex 937d95e113..ce02553d89 100644--- a/app/src/features/conversations/Conversations.processSourceCommand.test.tsx+++ b/app/src/features/conversations/Conversations.processSourceCommand.test.tsx@@ -125,6 +125,9 @@ function buildStore(preload: Record<string, unknown>) {socket: socketReducer,chatRuntime: chatRuntimeReducer,theme: themeReducer,+ threadTodos: threadTodosReducer,+ threadGoal: threadGoalReducer,+ runMode: runModeReducer,}),preloadedState: preload as never,});diff --git a/app/src/features/conversations/components/aui/ChatSources.citations.test.tsx b/app/src/features/conversations/components/aui/ChatSources.citations.test.tsxnew file mode 100644index 0000000000..5dc4d53c82--- /dev/null+++ b/app/src/features/conversations/components/aui/ChatSources.citations.test.tsx@@ -0,0 +1,126 @@+/**+ * `[n]` in the model's own answer text becomes an inline citation marker+ * (`elements/inline-citation.tsx`'s `CitationMarker`) instead of plain text,+ * when the turn has that many sources — mounted through the live `/chat`+ * surface (`AssistantUiChat`) the same way `ChatSources.test.tsx` proves its+ * own wiring, not by rendering `MarkdownText` in isolation with a hand-built+ * source list.+ */+import { combineReducers, configureStore } from '@reduxjs/toolkit';+import { render, screen, waitFor } from '@testing-library/react';+import { Provider } from 'react-redux';+import { beforeEach, describe, expect, it, vi } from 'vitest';++import { threadApi } from '../../../../services/api/threadApi';+import chatRuntimeReducer from '../../../../store/chatRuntimeSlice';+import mascotReducer from '../../../../store/mascotSlice';+import threadReducer from '../../../../store/threadSlice';+import type { DerivedDisplayItem } from '../../../../types/derivedTranscript';+import type { ThreadMessage } from '../../../../types/thread';+import { AssistantUiChat } from '../AssistantUiChat';++const THREAD_ID = 't-citations';+const REQUEST_ID = 'req-citations';++function toolCall(callId: string, url: string): DerivedDisplayItem {+ return { kind: 'toolCall', callId, name: 'web_fetch', args: { url }, status: 'success' };+}++function page(...newestFirst: DerivedDisplayItem[]) {+ return {+ items: [...newestFirst, { kind: 'turnBoundary', requestId: REQUEST_ID } as DerivedDisplayItem],+ hasTranscript: true,+ hasMore: false,+ };+}++function agentMessage(content: string): ThreadMessage {+ return {+ id: 'm-1',+ content,+ type: 'text',+ extraMetadata: { requestId: REQUEST_ID },+ sender: 'agent',+ createdAt: '2026-01-01T00:00:00.000Z',+ };+}++function buildStore(message: ThreadMessage) {+ return configureStore({+ reducer: combineReducers({ thread: threadReducer, chatRuntime: chatRuntimeReducer, mascot: mascotReducer }),+ preloadedState: {+ thread: {+ threads: [+ {+ id: THREAD_ID,+ title: 'Citations thread',+ chatId: null,+ isActive: false,+ messageCount: 1,+ lastMessageAt: '2026-01-01T00:00:00.000Z',+ createdAt: '2026-01-01T00:00:00.000Z',+ labels: [],+ },+ ],+ selectedThreadId: THREAD_ID,+ activeThreadIds: {},+ welcomeThreadId: null,+ messagesByThreadId: { [THREAD_ID]: [message] },+ messages: [message],+ isLoadingThreads: false,+ isLoadingMessages: false,+ messagesError: null,+ },+ } as never,+ });+}++function renderChat(message: ThreadMessage) {+ return render(+ <Provider store={buildStore(message)}>+ <AssistantUiChat+ model={null}+ onModelChange={vi.fn()}+ inputValue=""+ onInputValueChange={vi.fn()}+ attachments={[]}+ onAttachFiles={vi.fn()}+ onRemoveAttachment={vi.fn()}+ maxAttachments={5}+ attachmentsEnabled={false}+ attachmentInteractionBlocked={false}+ onAttachmentOnlySend={vi.fn()}+ />+ </Provider>+ );+}++beforeEach(() => {+ vi.restoreAllMocks();+});++describe('inline citation markers', () => {+ it('turns [1] into a citation marker when the turn has a matching source', async () => {+ vi.spyOn(threadApi, 'getDerivedTranscript').mockResolvedValue(+ page(toolCall('c1', 'https://example.com/a')) as never+ );++ renderChat(agentMessage('That page says so [1].'));++ await waitFor(() => expect(screen.getByTestId('turn-sources')).toBeTruthy());+ const marker = screen.getByRole('button', { name: '1' });+ expect(marker).toBeTruthy();+ // Plain text, not a markdown link: the bracketed number itself is gone+ // from the rendered prose, replaced by the marker.+ expect(screen.queryByText('[1]')).toBeNull();+ });++ it('leaves [1] as plain text when the turn has no sources', async () => {+ vi.spyOn(threadApi, 'getDerivedTranscript').mockResolvedValue(page() as never);++ renderChat(agentMessage('See item [1] on the list.'));++ await waitFor(() => expect(screen.getByText(/See item/)).toBeTruthy());+ expect(screen.queryByRole('button', { name: '1' })).toBeNull();+ });+});