Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(components): update MemorySourceRow to handle empty state

Steven Enamakela9cc1c3482a1
diff --git a/app/src/components/intelligence/MemorySourceRow.tsx b/app/src/components/intelligence/MemorySourceRow.tsx
index ebc5e4bce9..0204c47c27 100644
--- a/app/src/components/intelligence/MemorySourceRow.tsx
+++ b/app/src/components/intelligence/MemorySourceRow.tsx
@@ -234,22 +234,22 @@ export function MemorySourceRow({
)}
</div>
<div className="flex shrink-0 items-center gap-2">
- <Button
- iconOnly
- variant="tertiary"
- size="xs"
- onClick={() => onToggleSettings(source.id)}
- title={t('memorySources.settings.button')}
- aria-label={t('memorySources.settings.button')}
- data-testid={`memory-source-settings-${source.id}`}
- aria-expanded={settingsExpanded}
- className={
- settingsExpanded
- ? 'bg-primary-100 text-primary-600 dark:bg-primary-500/20 dark:text-primary-400'
- : 'text-content-faint hover:text-content-secondary'
- }>
- <GearIcon />
- </Button>
+ <CollapsibleTrigger asChild>
+ <Button
+ iconOnly
+ variant="tertiary"
+ size="xs"
+ title={t('memorySources.settings.button')}
+ aria-label={t('memorySources.settings.button')}
+ data-testid={`memory-source-settings-${source.id}`}
+ className={
+ settingsExpanded
+ ? 'bg-primary-100 text-primary-600 dark:bg-primary-500/20 dark:text-primary-400'
+ : 'text-content-faint hover:text-content-secondary'
+ }>
+ <GearIcon />
+ </Button>
+ </CollapsibleTrigger>
<Button
variant="primary"
size="sm"
diff --git a/app/src/components/settings/panels/AgentEditorToolsPicker.test.tsx b/app/src/components/settings/panels/AgentEditorToolsPicker.test.tsx
new file mode 100644
index 0000000000..b6bdb02baf
--- /dev/null
+++ b/app/src/components/settings/panels/AgentEditorToolsPicker.test.tsx
@@ -0,0 +1,70 @@
+/**
+ * AgentEditorToolsPicker — chip row + "Add tools" modal for the agent editor's
+ * tool allowlist. Covers the "Allow all" control, now a `Toggle` primitive.
+ */
+import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
+import { describe, expect, it, vi } from 'vitest';
+
+import { agentRegistryApi } from '../../../services/api/agentRegistryApi';
+import { AgentEditorToolsField } from './AgentEditorToolsPicker';
+
+vi.mock('../../../services/api/agentRegistryApi', () => ({
+ agentRegistryApi: {
+ availableTools: vi.fn(),
+ },
+}));
+
+const mockAvailableTools = vi.mocked(agentRegistryApi.availableTools);
+
+describe('AgentEditorToolsField', () => {
+ it('shows the none-selected hint when the allowlist is empty', () => {
+ render(<AgentEditorToolsField toolAllowlist={[]} onChange={vi.fn()} />);
+ expect(screen.getByText('settings.agents.editor.toolsNoneSelected')).toBeInTheDocument();
+ });
+
+ it('renders selected tools as chips', () => {
+ render(<AgentEditorToolsField toolAllowlist={['memory_search', 'web_fetch']} onChange={vi.fn()} />);
+ expect(screen.getByText('memory_search')).toBeInTheDocument();
+ expect(screen.getByText('web_fetch')).toBeInTheDocument();
+ });
+
+ it('opens the picker modal and toggles "Allow all" on and off', async () => {
+ mockAvailableTools.mockResolvedValue([
+ { name: 'memory_search', description: 'Search memory' },
+ { name: 'web_fetch', description: 'Fetch a URL' },
+ ]);
+ const onChange = vi.fn();
+ render(<AgentEditorToolsField toolAllowlist={[]} onChange={onChange} />);
+
+ fireEvent.click(screen.getByLabelText('settings.agents.editor.selectTools'));
+
+ await waitFor(() => {
+ expect(screen.getByTestId('agent-tools-allow-all-toggle')).toBeInTheDocument();
+ });
+
+ const allowAllToggle = screen.getByTestId('agent-tools-allow-all-toggle');
+ expect(allowAllToggle).toHaveAttribute('aria-pressed', 'false');
+ expect(allowAllToggle).toHaveAttribute('data-state', 'off');
+
+ await act(async () => {
+ fireEvent.click(allowAllToggle);
+ });
+
+ expect(onChange).toHaveBeenCalledWith(['*']);
+ });
+
+ it('reflects an already-all-selected allowlist as pressed', async () => {
+ mockAvailableTools.mockResolvedValue([{ name: 'memory_search', description: 'Search memory' }]);
+ render(<AgentEditorToolsField toolAllowlist={['*']} onChange={vi.fn()} />);
+
+ expect(screen.getByText('settings.agents.editor.toolsAllSelected')).toBeInTheDocument();
+
+ fireEvent.click(screen.getByLabelText('settings.agents.editor.selectTools'));
+
+ await waitFor(() => {
+ const toggle = screen.getByTestId('agent-tools-allow-all-toggle');
+ expect(toggle).toHaveAttribute('aria-pressed', 'true');
+ expect(toggle).toHaveAttribute('data-state', 'on');
+ });
+ });
+});