Skip to content

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

fix(app): show Brain's sync and vault panels only where the engine serves them

Shanu01e33737f119
diff --git a/app/src/components/settings/panels/MemoryDataPanel.tsx b/app/src/components/settings/panels/MemoryDataPanel.tsx
index a7aa060c53..386ad4b392 100644
--- a/app/src/components/settings/panels/MemoryDataPanel.tsx
+++ b/app/src/components/settings/panels/MemoryDataPanel.tsx
@@ -88,7 +88,9 @@ const MemoryDataPanel = ({ embedded = false }: MemoryDataPanelProps = {}) => {
</div>
</dl>
</SettingsSection>
- <VaultHealthChecklist onToast={addToast} title={t('vaultHealth.setupTitle')} />
+ <MemoryFamilyGate family="tree">
+ <VaultHealthChecklist onToast={addToast} title={t('vaultHealth.setupTitle')} />
+ </MemoryFamilyGate>
<MemoryWindowControl onError={handleWindowError} onSaved={handleWindowSaved} />
<MemoryFamilyGate family="tree">
<MemoryWorkspace onToast={addToast} />
diff --git a/app/src/pages/Brain.tsx b/app/src/pages/Brain.tsx
index 9ed448ff19..b5d3955966 100644
--- a/app/src/pages/Brain.tsx
+++ b/app/src/pages/Brain.tsx
@@ -435,7 +435,9 @@ export default function Brain() {
{activeTab === 'sources' && (
<div className="space-y-5 animate-fade-up">
<MemoryEngineRow />
- <CodingSessionsCard onToast={addToast} />
+ <MemoryFamilyGate family="sources">
+ <CodingSessionsCard onToast={addToast} />
+ </MemoryFamilyGate>
<MemoryFamilyGate family="sources">
<MemorySourcesRegistry onToast={addToast} />
</MemoryFamilyGate>
@@ -451,16 +453,20 @@ export default function Brain() {
</MemoryFamilyGate>
{/* openhuman#6257: what is syncing right now, beside the
history of what already ran. */}
- <Card padded divided={false} data-testid="brain-sync-activity">
- <SyncActivityCard />
- </Card>
+ <MemoryFamilyGate family="sources">
+ <Card padded divided={false} data-testid="brain-sync-activity">
+ <SyncActivityCard />
+ </Card>
+ </MemoryFamilyGate>
</div>
)}
{/* Sync → History: the run history as a full-height table. */}
{activeTab === 'sync' && syncView === 'history' && (
<div className="flex min-h-0 flex-1 flex-col" data-testid="brain-sync-history">
- <SyncAuditPanel fill />
+ <MemoryFamilyGate family="sources">
+ <SyncAuditPanel fill />
+ </MemoryFamilyGate>
</div>
)}
</div>
diff --git a/app/src/pages/__tests__/Brain.test.tsx b/app/src/pages/__tests__/Brain.test.tsx
index 2e1a88e63d..b3b9e94645 100644
--- a/app/src/pages/__tests__/Brain.test.tsx
+++ b/app/src/pages/__tests__/Brain.test.tsx
@@ -1,10 +1,18 @@
import { act, screen, waitFor } from '@testing-library/react';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { resetMemoryEngineCacheForTests } from '../../components/intelligence/useMemoryEngineCapabilities';
import { renderWithProviders } from '../../test/test-utils';
import Brain from '../Brain';
const graphExportMock = vi.hoisted(() => vi.fn());
+// The bound memory engine, as `MemoryFamilyGate` reads it. Rejected by default,
+// so every gate fails open and the tabs render as they always have.
+const engineMock = vi.hoisted(() => ({ list: vi.fn(), get: vi.fn() }));
+vi.mock('../../utils/tauriCommands/memoryEngine', () => ({
+ memoryEnginesList: (...a: unknown[]) => engineMock.list(...a),
+ memoryEngineGet: (...a: unknown[]) => engineMock.get(...a),
+}));
// Controllable authenticated identity so we can simulate a logout→login cycle
// (userId null → set) and assert the graph reloads (#4149).
const coreAuthRef = vi.hoisted(() => ({ current: 'user-A' as string | null }));
@@ -84,6 +92,9 @@ describe('Brain page', () => {
beforeEach(() => {
vi.clearAllMocks();
coreAuthRef.current = 'user-A';
+ resetMemoryEngineCacheForTests();
+ engineMock.get.mockRejectedValue(new Error('no engine rpc in this test'));
+ engineMock.list.mockRejectedValue(new Error('no engine rpc in this test'));
});
afterEach(() => {
@@ -188,4 +199,30 @@ describe('Brain page', () => {
expect(screen.queryByTestId('brain-sync-activity')).toBeNull();
expect(screen.queryByTestId('brain-sync-activity-card')).toBeNull();
});
+
+ // A remote engine without the Sources family (hosted CortexDB) has no
+ // `memory_sources.*` RPCs at all: the sync panels must say so rather than
+ // render and fail.
+ it('shows the sync panels as unavailable on an engine without sources', async () => {
+ graphExportMock.mockResolvedValue(makeGraph(0));
+ engineMock.get.mockResolvedValue({ driver: 'tinyhumans' });
+ engineMock.list.mockResolvedValue({
+ active: 'tinyhumans',
+ engines: [
+ {
+ id: 'tinyhumans',
+ label: 'CortexDB (via TinyHumans)',
+ capabilities: ['core', 'recall', 'portability', 'answer'],
+ },
+ ],
+ });
+ await act(async () => {
+ renderWithProviders(<Brain />, { initialEntries: ['/?tab=sync'] });
+ });
+ await waitFor(() => {
+ expect(screen.getAllByTestId('memory-family-unavailable').length).toBeGreaterThan(0);
+ });
+ expect(screen.queryByTestId('brain-sync-activity')).toBeNull();
+ expect(screen.queryByTestId('brain-sync-activity-card')).toBeNull();
+ });
});