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
fix(chat): disable the process-source command in mic-cloud voice mode
M3gA-Mind7cd1ceac2fc9
diff --git a/app/src/features/conversations/Conversations.processSourceCommand.test.tsx b/app/src/features/conversations/Conversations.processSourceCommand.test.tsxnew file mode 100644index 0000000000..a3d72dd2d9--- /dev/null+++ b/app/src/features/conversations/Conversations.processSourceCommand.test.tsx@@ -0,0 +1,240 @@+/**+ * The agent-process-source command must not be offered in voice mode.+ *+ * `showProcessSource` only drives `TranscriptOverlays`, and `TranscriptOverlays`+ * mounts inside `assistantUiMainPanel` alone. The panel choice is an either/or -+ * `composer === 'mic-cloud' ? legacyMainPanel : assistantUiMainPanel` - so in+ * mic-cloud (voice/mascot) mode `legacyMainPanel` mounts instead and the state+ * the command sets has no host. Registered with `enabled: () =>+ * selectedThreadId !== null` alone, the palette listed a command that looked+ * available and silently did nothing.+ *+ * Same root cause as `Conversations.taskBoard.test.tsx` next door: something was+ * left pointing at the wrong half of the either/or.+ */+import { combineReducers, configureStore } from '@reduxjs/toolkit';+import { act, cleanup, render } from '@testing-library/react';+import { Provider } from 'react-redux';+import { MemoryRouter } from 'react-router-dom';+import { afterEach, describe, expect, it, vi } from 'vitest';++import { SidebarSlotOutlet, SidebarSlotProvider } from '../../components/layout/shell/SidebarSlot';+import { registry } from '../../lib/commands/registry';+import agentProfileReducer from '../../store/agentProfileSlice';+import chatRuntimeReducer from '../../store/chatRuntimeSlice';+import layoutReducer from '../../store/layoutSlice';+import socketReducer from '../../store/socketSlice';+import themeReducer from '../../store/themeSlice';+import threadReducer from '../../store/threadSlice';+import type { Thread } from '../../types/thread';++const { mockGetThreads, mockGetThreadMessages, mockGetTaskBoard, mockUseUsageState } = vi.hoisted(+ () => ({+ mockGetThreads: vi.fn().mockResolvedValue({ threads: [], count: 0 }),+ mockGetThreadMessages: vi.fn().mockResolvedValue({ messages: [], count: 0 }),+ mockGetTaskBoard: vi.fn().mockResolvedValue(null),+ mockUseUsageState: vi.fn(() => ({+ teamUsage: null,+ currentPlan: null,+ currentTier: 'FREE' as const,+ isFreeTier: true,+ usagePct: 0,+ isNearLimit: false,+ isAtLimit: false,+ isBudgetExhausted: false,+ shouldShowBudgetCompletedMessage: false,+ isLoading: false,+ refresh: vi.fn(),+ })),+ })+);++vi.mock('../../services/chatService', () => ({+ chatCancel: vi.fn().mockResolvedValue(true),+ chatClearQueue: vi.fn().mockResolvedValue(0),+ chatSend: vi.fn().mockResolvedValue(undefined),+ subscribeChatEvents: vi.fn(() => () => {}),+ useRustChat: vi.fn(() => true),+}));++vi.mock('../../services/api/threadApi', () => ({+ threadApi: {+ createNewThread: vi.fn().mockResolvedValue({ id: 'new-thread', labels: [] }),+ getThreads: mockGetThreads,+ getThreadMessages: mockGetThreadMessages,+ getTurnState: vi.fn().mockResolvedValue(null),+ getTurnStateHistory: vi.fn().mockResolvedValue([]),+ getDerivedTranscript: vi+ .fn()+ .mockResolvedValue({+ threadId: 'none',+ items: [],+ total: 0,+ hasMore: false,+ hasTranscript: false,+ }),+ getTaskBoard: mockGetTaskBoard,+ putTaskBoard: vi+ .fn()+ .mockResolvedValue({ threadId: 't-1', cards: [], updatedAt: '2026-05-04T10:00:00Z' }),+ decidePlan: vi+ .fn()+ .mockResolvedValue({ threadId: 't-1', cards: [], updatedAt: '2026-05-04T10:00:00Z' }),+ appendMessage: vi.fn(async (_threadId: string, message: unknown) => message),+ deleteThread: vi.fn().mockResolvedValue({ deleted: true }),+ generateTitleIfNeeded: vi.fn().mockResolvedValue({}),+ updateMessage: vi.fn().mockResolvedValue({}),+ purge: vi.fn().mockResolvedValue({}),+ updateLabels: vi.fn().mockResolvedValue({}),+ updateTitle: vi.fn().mockResolvedValue({}),+ persistReaction: vi.fn().mockResolvedValue({}),+ listRuns: vi.fn().mockResolvedValue([]),+ listRunEvents: vi.fn().mockResolvedValue([]),+ },+}));++vi.mock('../../services/api/agentProfilesApi', () => ({+ agentProfilesApi: {+ list: vi.fn().mockResolvedValue({ activeProfileId: 'default', profiles: [] }),+ select: vi.fn().mockResolvedValue({ activeProfileId: 'default', profiles: [] }),+ upsert: vi.fn().mockResolvedValue({ activeProfileId: 'default', profiles: [] }),+ delete: vi.fn().mockResolvedValue({ activeProfileId: 'default', profiles: [] }),+ },+}));++vi.mock('../../services/api/openrouterFreeModels', () => ({+ applyOpenRouterFreeModels: () => undefined,+}));++vi.mock('../../hooks/useUsageState', () => ({ useUsageState: mockUseUsageState }));++vi.mock('../../components/chat/ChatNewWindowHero', () => ({ default: () => null }));++vi.mock('../../store/socketSelectors', () => ({+ selectSocketStatus: (state: { socket?: { byUser?: Record<string, { status: string }> } }) =>+ state.socket?.byUser?.__pending__?.status ?? 'disconnected',+}));++vi.mock('../../hooks/useStickToBottom', () => ({+ useStickToBottom: vi.fn(() => ({ containerRef: { current: null }, endRef: { current: null } })),+}));++vi.mock('../../utils/openUrl', () => ({ openUrl: vi.fn() }));++const mockCallCoreRpc = vi.fn().mockResolvedValue({});+vi.mock('../../services/coreRpcClient', async orig => {+ const actual = await orig<typeof import('../../services/coreRpcClient')>();+ return { ...actual, callCoreRpc: (...args: unknown[]) => mockCallCoreRpc(...args) };+});++vi.mock('../../lib/coreState/store', () => ({+ getCoreStateSnapshot: vi.fn(() => ({+ isBootstrapping: false,+ isReady: true,+ snapshot: {+ auth: { isAuthenticated: false, userId: null, user: null, profileId: null },+ sessionToken: null,+ currentUser: null,+ onboardingCompleted: true,+ chatOnboardingCompleted: true,+ analyticsEnabled: false,+ localState: {},+ runtime: {},+ },+ })),+ isWelcomeLocked: vi.fn(() => false),+ setCoreStateSnapshot: vi.fn(),+}));++const THREAD_ID = 'process-source-thread';++const thread: Thread = {+ id: THREAD_ID,+ title: 'Process source thread',+ chatId: null,+ isActive: false,+ messageCount: 0,+ lastMessageAt: '2026-01-01T00:00:00.000Z',+ createdAt: '2026-01-01T00:00:00.000Z',+ labels: ['general'],+};++const ACTION_ID = 'chat.agentProcessSource';++function buildStore(preload: Record<string, unknown>) {+ return configureStore({+ reducer: combineReducers({+ thread: threadReducer,+ layout: layoutReducer,+ socket: socketReducer,+ chatRuntime: chatRuntimeReducer,+ agentProfiles: agentProfileReducer,+ theme: themeReducer,+ }),+ preloadedState: preload as never,+ });+}++async function renderChat(composer?: 'text' | 'mic-cloud') {+ mockGetThreads.mockResolvedValue({ threads: [thread], count: 1 });+ const store = buildStore({+ thread: {+ threads: [thread],+ selectedThreadId: THREAD_ID,+ activeThreadIds: {},+ welcomeThreadId: null,+ messagesByThreadId: { [THREAD_ID]: [] },+ messages: [],+ isLoadingThreads: false,+ isLoadingMessages: false,+ messagesError: null,+ },+ socket: { byUser: { __pending__: { status: 'connected', socketId: 'socket-1' } } },+ });+ const { default: Conversations } = await import('./Conversations');++ await act(async () => {+ render(+ <Provider store={store}>+ <MemoryRouter initialEntries={['/chat']}>+ <SidebarSlotProvider>+ <SidebarSlotOutlet />+ <Conversations composer={composer} />+ </SidebarSlotProvider>+ </MemoryRouter>+ </Provider>+ );+ });+}++// The predicate's other half (`selectedThreadId !== null`) is deliberately not+// asserted here: on `/chat` it is unreachable as a steady state. The boot effect+// reuses an empty thread or calls `handleCreateNewThread`, so the page always+// ends up with a selection and a test for it would only be pinning the mock.+describe('the agent-process-source command follows the panel that hosts it', () => {+ afterEach(() => {+ cleanup();+ registry.reset();+ });++ it('is enabled on the assistant-ui surface, which mounts TranscriptOverlays', async () => {+ await renderChat('text');++ const action = registry.getAction(ACTION_ID);+ expect(action, 'the command must be registered on the text composer').toBeDefined();+ expect(action?.enabled?.()).toBe(true);+ // The palette runs it through `runAction`, which re-checks `enabled`.+ expect(registry.runAction(ACTION_ID)).toBe(true);+ });++ it('is disabled in mic-cloud voice mode, where nothing renders the panel', async () => {+ await renderChat('mic-cloud');++ const action = registry.getAction(ACTION_ID);+ // Registered but refused - `Conversations` is mounted either way, so the+ // action does not disappear; it must report itself unavailable.+ expect(action, 'the command is still registered in voice mode').toBeDefined();+ expect(action?.enabled?.()).toBe(false);+ expect(registry.runAction(ACTION_ID)).toBe(false);+ });+});diff --git a/app/src/features/conversations/Conversations.tsx b/app/src/features/conversations/Conversations.tsxindex a8231190cd..3b57446115 100644--- a/app/src/features/conversations/Conversations.tsx+++ b/app/src/features/conversations/Conversations.tsx@@ -306,13 +306,22 @@ const Conversations = ({// component. assistant-ui renders its tool calls as inline cards and has no// equivalent block, so the whole-run view (and the visited-source list, which// exists nowhere else) is reached from the command palette instead.+ //+ // The composer check is not cosmetic: `showProcessSource` only drives+ // `TranscriptOverlays`, which mounts inside `assistantUiMainPanel` alone, and+ // the panel choice below is an either/or (`composer === 'mic-cloud' ?+ // legacyMainPanel : assistantUiMainPanel`). In mic-cloud voice mode the state+ // this sets has no host, so without the guard the palette would offer a+ // command that silently does nothing. `enabled` is re-read through a ref on+ // every render (see `useRegisterAction`), so switching modes updates it+ // without re-registering.useRegisterAction({id: 'chat.agentProcessSource',label: 'Open agent process source',labelKey: 'conversations.agentTaskInsights.viewProcessSource',group: 'Chat',handler: () => setShowProcessSource(true),- enabled: () => selectedThreadId !== null,+ enabled: () => selectedThreadId !== null && composer !== 'mic-cloud',keywords: ['agent', 'process', 'source', 'timeline', 'run'],});const [inputMode, setInputMode] = useState<InputMode>('text');