Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(memory): explain live sidecar before runtime Repair (#1540)

rkrkrkkf447a123c033
diff --git a/ui/src/components/settings/SettingsDependenciesPage.logic.ts b/ui/src/components/settings/SettingsDependenciesPage.logic.ts
index 1b70fd533..2f6258db8 100644
--- a/ui/src/components/settings/SettingsDependenciesPage.logic.ts
+++ b/ui/src/components/settings/SettingsDependenciesPage.logic.ts
@@ -1,7 +1,18 @@
-import type { DependencyItem } from '@/context/ApiContext';
+import type { DependencyItem, MemoryStatusResult } from '@/context/ApiContext';
const INSTALLABLE_DEPENDENCIES = new Set(['askill', 'avault', 'show-runtime', 'memory-runtime', 'tmux']);
export const dependencyHasInstallAction = (
dependency: Pick<DependencyItem, 'id' | 'status'>,
): boolean => dependency.status !== 'unsupported' && INSTALLABLE_DEPENDENCIES.has(dependency.id);
+
+/** A reachable sidecar is the live process Repair must not replace. */
+export const memoryRuntimeSidecarRunning = (
+ status: MemoryStatusResult | null | undefined,
+): boolean => (
+ !!status
+ && typeof status === 'object'
+ && 'status' in status
+ && status.status === 'ok'
+ && status.source?.status === 'available'
+);
diff --git a/ui/src/components/settings/SettingsDependenciesPage.test.ts b/ui/src/components/settings/SettingsDependenciesPage.test.ts
index 1c35d7343..0fbba5d85 100644
--- a/ui/src/components/settings/SettingsDependenciesPage.test.ts
+++ b/ui/src/components/settings/SettingsDependenciesPage.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { dependencyHasInstallAction } from './SettingsDependenciesPage.logic';
+import { dependencyHasInstallAction, memoryRuntimeSidecarRunning } from './SettingsDependenciesPage.logic';
describe('dependencyHasInstallAction', () => {
it('hides install and repair actions for unsupported dependencies', () => {
@@ -13,3 +13,23 @@ describe('dependencyHasInstallAction', () => {
expect(dependencyHasInstallAction({ id: 'node', status: 'missing' })).toBe(false);
});
});
+
+describe('memoryRuntimeSidecarRunning', () => {
+ it('is true only for a successful status whose sidecar source is available', () => {
+ expect(memoryRuntimeSidecarRunning({
+ status: 'ok',
+ source: { status: 'available', observed_at: '2026-08-18T14:44:35.331Z', reason: null },
+ health: null,
+ })).toBe(true);
+ });
+
+ it('stays false when Memory is enabled but the sidecar is not reachable', () => {
+ expect(memoryRuntimeSidecarRunning(null)).toBe(false);
+ expect(memoryRuntimeSidecarRunning({ status: 'failed', error: 'memory_sidecar_unavailable' })).toBe(false);
+ expect(memoryRuntimeSidecarRunning({
+ status: 'ok',
+ source: { status: 'unavailable', observed_at: null, reason: 'memory_sidecar_unavailable' },
+ health: null,
+ })).toBe(false);
+ });
+});
diff --git a/ui/src/components/settings/SettingsDependenciesPage.test.tsx b/ui/src/components/settings/SettingsDependenciesPage.test.tsx
index bf8d1ff2e..cc073b66d 100644
--- a/ui/src/components/settings/SettingsDependenciesPage.test.tsx
+++ b/ui/src/components/settings/SettingsDependenciesPage.test.tsx
@@ -10,6 +10,7 @@ import { SettingsDependenciesPage } from './SettingsDependenciesPage';
const api = vi.hoisted(() => ({
factoryResetMemory: vi.fn(),
getMemorySettings: vi.fn(),
+ getMemoryStatus: vi.fn(),
installDependency: vi.fn(),
listDependencies: vi.fn(),
}));
@@ -109,6 +110,7 @@ const renderPage = () => render(
beforeEach(() => {
api.listDependencies.mockResolvedValue({ ok: true, deps: [memoryRuntime()] });
api.getMemorySettings.mockResolvedValue(settings());
+ api.getMemoryStatus.mockResolvedValue({ status: 'failed', error: 'memory_sidecar_unavailable' });
api.installDependency.mockResolvedValue({ ok: true });
api.factoryResetMemory.mockResolvedValue({
ok: true,
@@ -160,7 +162,9 @@ describe('SettingsDependenciesPage Memory reinitialization', () => {
const user = userEvent.setup();
renderPage();
- await user.click(await screen.findByRole('button', { name: 'settings.dependencies.repair' }));
+ const repair = await screen.findByRole('button', { name: 'settings.dependencies.repair' });
+ await waitFor(() => expect((repair as HTMLButtonElement).disabled).toBe(false));
+ await user.click(repair);
expect(await screen.findByRole('button', { name: 'memory.factoryReset.retry' })).toBeTruthy();
expect(api.getMemorySettings).toHaveBeenCalledTimes(2);
@@ -241,11 +245,46 @@ describe('SettingsDependenciesPage Memory reinitialization', () => {
const user = userEvent.setup();
renderPage();
- await user.click(await screen.findByRole('button', { name: 'settings.dependencies.repair' }));
+ const repair = await screen.findByRole('button', { name: 'settings.dependencies.repair' });
+ await waitFor(() => expect((repair as HTMLButtonElement).disabled).toBe(false));
+ await user.click(repair);
expect((screen.getByRole('button', { name: 'memory.factoryReset.button' }) as HTMLButtonElement).disabled).toBe(true);
finishInstall?.({ ok: true });
});
+ it('disables Memory runtime Repair and explains why while the sidecar is available', async () => {
+ api.getMemoryStatus.mockResolvedValue({
+ status: 'ok',
+ source: { status: 'available', observed_at: '2026-08-18T14:44:35.331Z', reason: null },
+ health: { status: 'ok', version: '1.2.3', capabilities: {}, disabled_features: [], cascade: null, recorder: null },
+ });
+ renderPage();
+
+ const repair = await screen.findByRole('button', { name: 'settings.dependencies.repair' });
+ await waitFor(() => expect(screen.getByText('settings.dependencies.memoryRuntimeDisableBeforeRepair')).toBeTruthy());
+ expect((repair as HTMLButtonElement).disabled).toBe(true);
+ expect(api.installDependency).not.toHaveBeenCalled();
+ });
+
+ it('localizes a live-sidecar Repair refusal instead of showing the raw token', async () => {
+ api.installDependency.mockResolvedValue({
+ ok: false,
+ message: 'memory_runtime_install_requires_disabled_memory',
+ output: null,
+ reason: 'memory_runtime_install_requires_disabled_memory',
+ });
+ const user = userEvent.setup();
+ renderPage();
+
+ const repair = await screen.findByRole('button', { name: 'settings.dependencies.repair' });
+ await waitFor(() => expect((repair as HTMLButtonElement).disabled).toBe(false));
+ await user.click(repair);
+ expect(showToast).toHaveBeenCalledWith(
+ 'errors.memory_runtime_install_requires_disabled_memory',
+ 'error',
+ );
+ });
+
it('MEMORY-FACTORY-002 closes confirmation and reports partial per-root outcomes', async () => {
api.factoryResetMemory.mockResolvedValue({
ok: false,
diff --git a/ui/src/components/settings/SettingsDependenciesPage.tsx b/ui/src/components/settings/SettingsDependenciesPage.tsx
index 03afd1e29..f8c37d570 100644
--- a/ui/src/components/settings/SettingsDependenciesPage.tsx
+++ b/ui/src/components/settings/SettingsDependenciesPage.tsx
@@ -24,9 +24,9 @@ import { ConfirmDialog } from '../ui/confirm-dialog';
import { SettingsPageShell } from './SettingsPageShell';
import { SettingsResourceRow } from './SettingsPrimitives';
import { useApi } from '@/context/ApiContext';
-import type { DependencyItem, InstallResult, MemorySettings } from '@/context/ApiContext';
+import type { DependencyItem, InstallResult, MemorySettings, MemoryStatusResult } from '@/context/ApiContext';
import { useToast } from '@/context/ToastContext';
-import { dependencyHasInstallAction } from './SettingsDependenciesPage.logic';
+import { dependencyHasInstallAction, memoryRuntimeSidecarRunning } from './SettingsDependenciesPage.logic';
import { errorMessage } from '@/lib/errorMessage';
import type { MemoryFactoryResetResult } from '@/lib/memoryFactoryReset';
import { memoryErrorMessage } from '@/lib/memoryRead';
@@ -62,6 +62,8 @@ export const SettingsDependenciesPage: React.FC = () => {
const [deps, setDeps] = useState<DependencyItem[] | null>(null);
const [busy, setBusy] = useState<string | null>(null);
const [memorySettings, setMemorySettings] = useState<MemorySettings | null>(null);
+ const [memoryStatus, setMemoryStatus] = useState<MemoryStatusResult | null>(null);
+ const [memoryStatusLoaded, setMemoryStatusLoaded] = useState(false);
const [reinitializeOpen, setReinitializeOpen] = useState(false);
const [reinitializeBusy, setReinitializeBusy] = useState(false);
const [reinitializeResult, setReinitializeResult] = useState<MemoryFactoryResetResult | null>(null);
@@ -84,9 +86,19 @@ export const SettingsDependenciesPage: React.FC = () => {
}
}, [api]);
+ const refreshMemoryStatus = useCallback(async () => {
+ try {
+ setMemoryStatus(await api.getMemoryStatus());
+ } catch {
+ setMemoryStatus(null);
+ } finally {
+ setMemoryStatusLoaded(true);
+ }
+ }, [api]);
+
const refreshAll = useCallback(async () => {
- await Promise.all([refreshDependencies(), refreshMemorySettings()]);
- }, [refreshDependencies, refreshMemorySettings]);
+ await Promise.all([refreshDependencies(), refreshMemorySettings(), refreshMemoryStatus()]);
+ }, [refreshDependencies, refreshMemorySettings, refreshMemoryStatus]);
useEffect(() => {
void refreshAll();
@@ -191,6 +203,8 @@ export const SettingsDependenciesPage: React.FC = () => {
const showAction = dependencyHasInstallAction(d);
const isMemoryRuntime = d.id === 'memory-runtime';
const memoryRuntimeReady = isMemoryRuntime && d.installed && d.status === 'ready';
+ const sidecarRunning = isMemoryRuntime && memoryRuntimeSidecarRunning(memoryStatus);
+ const repairBlockedBySidecar = isMemoryRuntime && (!memoryStatusLoaded || sidecarRunning);
const dependencyOperationBusy = busy !== null;
const reinitializeDisabled = !memoryRuntimeReady
|| memorySettings === null
@@ -228,7 +242,7 @@ export const SettingsDependenciesPage: React.FC = () => {
<Button
variant={d.installed ? 'secondary' : 'brand'}
size="xs"
- disabled={dependencyOperationBusy || reinitializeBusy}
+ disabled={dependencyOperationBusy || reinitializeBusy || repairBlockedBySidecar}
onClick={() => void install(d)}
>
{installing ? (
@@ -251,6 +265,11 @@ export const SettingsDependenciesPage: React.FC = () => {
}
footer={isMemoryRuntime ? (
<div className="flex flex-col gap-3 border-t border-destructive/25 pt-3">
+ {sidecarRunning ? (
+ <div className="text-[11px] leading-snug text-muted">
+ {t('settings.dependencies.memoryRuntimeDisableBeforeRepair')}
+ </div>
+ ) : null}
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
<div className="min-w-0">
<div className="text-[12px] font-semibold text-foreground">
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 49b7fa7bd..dadf05de9 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -314,6 +314,7 @@
"installing": "Installing…",
"installed": "{{name}} is ready.",
"installFailed": "Install failed.",
+ "memoryRuntimeDisableBeforeRepair": "Memory is running. Turn it off in Settings \u2192 Memory before repairing the runtime.",
"backendsTitle": "Agent backends",
"backendsDetail": "Claude · OpenCode · Codex — managed in the Backends tab.",
"manageBackends": "Manage in Backends",
@@ -1664,6 +1665,7 @@
"memory_runtime_missing": "The memory-runtime dependency isn't installed yet.",
"memory_runtime_unsupported": "The memory-runtime dependency isn't supported on this platform.",
"memory_runtime_install_failed": "The memory-runtime dependency failed to install.",
+ "memory_runtime_install_requires_disabled_memory": "Turn Memory off in Settings \u2192 Memory before repairing a running Memory runtime.",
"memory_reconcile_failed": "Avibe couldn't apply the Memory settings. Check the runtime logs for the failing step.",
"memory_sidecar_unavailable": "The Memory sidecar isn't reachable right now.",
"memory_provider_timeout": "The Memory request timed out.",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 1d6b551bd..e53ced057 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -314,6 +314,7 @@
"installing": "安装中…",
"installed": "{{name}} 已就绪。",
"installFailed": "安装失败。",
+ "memoryRuntimeDisableBeforeRepair": "记忆功能正在运行。请先在「设置 → 记忆」中关闭记忆,再修复运行时。",
"backendsTitle": "Agent 后端",
"backendsDetail": "Claude · OpenCode · Codex —— 在 Backends 标签页管理。",
"manageBackends": "前往 Backends",
@@ -1664,6 +1665,7 @@
"memory_runtime_missing": "memory-runtime 依赖尚未安装。",
"memory_runtime_unsupported": "memory-runtime 依赖在此平台上不受支持。",
"memory_runtime_install_failed": "memory-runtime 依赖安装失败。",
+ "memory_runtime_install_requires_disabled_memory": "记忆运行时正在使用中。请先在「设置 → 记忆」中关闭记忆,再修复。",
"memory_reconcile_failed": "Avibe 无法应用记忆设置。请查看运行时日志了解失败步骤。",
"memory_sidecar_unavailable": "记忆 sidecar 当前不可访问。",
"memory_provider_timeout": "记忆请求超时。",