Skip to content

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

chore: remove dead CEF profile purge caller

Steven Enamakel63f4ee8cb6e1
diff --git a/app/src/utils/__tests__/clearAllAppData.test.ts b/app/src/utils/__tests__/clearAllAppData.test.ts
index b5fff14fbd..092c6abe52 100644
--- a/app/src/utils/__tests__/clearAllAppData.test.ts
+++ b/app/src/utils/__tests__/clearAllAppData.test.ts
@@ -2,11 +2,10 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import { clearAllAppData } from '../clearAllAppData';
-const { mockPurge, mockReset, mockRestart, mockPurgeCef } = vi.hoisted(() => ({
+const { mockPurge, mockReset, mockRestart } = vi.hoisted(() => ({
mockPurge: vi.fn().mockResolvedValue(undefined),
mockReset: vi.fn().mockResolvedValue(undefined),
mockRestart: vi.fn().mockResolvedValue(undefined),
- mockPurgeCef: vi.fn().mockResolvedValue(undefined),
}));
vi.mock('../../store', () => ({ persistor: { purge: mockPurge } }));
@@ -14,7 +13,6 @@ vi.mock('../../store', () => ({ persistor: { purge: mockPurge } }));
vi.mock('../tauriCommands', () => ({
resetOpenHumanDataAndRestartCore: mockReset,
restartApp: mockRestart,
- scheduleCefProfilePurge: mockPurgeCef,
}));
describe('clearAllAppData', () => {
@@ -22,7 +20,6 @@ describe('clearAllAppData', () => {
mockPurge.mockReset().mockResolvedValue(undefined);
mockReset.mockReset().mockResolvedValue(undefined);
mockRestart.mockReset().mockResolvedValue(undefined);
- mockPurgeCef.mockReset().mockResolvedValue(undefined);
window.localStorage.clear();
window.sessionStorage.clear();
});
@@ -39,7 +36,6 @@ describe('clearAllAppData', () => {
await clearAllAppData({ clearSession, userId: 'user-1' });
- expect(mockPurgeCef).toHaveBeenCalledWith('user-1');
expect(clearSession).toHaveBeenCalledTimes(1);
expect(mockReset).toHaveBeenCalledTimes(1);
// #4950: the reset must receive the signed-in user id so it deletes the
@@ -64,7 +60,6 @@ describe('clearAllAppData', () => {
await clearAllAppData();
- expect(mockPurgeCef).toHaveBeenCalledWith(null);
// No clearSession was provided — call sequence still completes.
expect(mockReset).toHaveBeenCalledTimes(1);
// Pre-login recovery (Welcome screen) has no user id: the reset falls back
@@ -76,15 +71,6 @@ describe('clearAllAppData', () => {
expect(window.localStorage.getItem('user-2:persist:accounts')).toBeNull();
});
- it('continues if scheduleCefProfilePurge fails (best-effort)', async () => {
- mockPurgeCef.mockRejectedValueOnce(new Error('cef-purge boom'));
-
- await expect(clearAllAppData()).resolves.toBeUndefined();
-
- expect(mockReset).toHaveBeenCalledTimes(1);
- expect(mockRestart).toHaveBeenCalledTimes(1);
- });
-
it('continues if clearSession fails (best-effort)', async () => {
const clearSession = vi.fn().mockRejectedValue(new Error('logout boom'));
diff --git a/app/src/utils/clearAllAppData.ts b/app/src/utils/clearAllAppData.ts
index 31f918bc6b..b31d4e27ff 100644
--- a/app/src/utils/clearAllAppData.ts
+++ b/app/src/utils/clearAllAppData.ts
@@ -1,9 +1,5 @@
import { persistor } from '../store';
-import {
- resetOpenHumanDataAndRestartCore,
- restartApp,
- scheduleCefProfilePurge,
-} from './tauriCommands';
+import { resetOpenHumanDataAndRestartCore, restartApp } from './tauriCommands';
const ACTIVE_USER_KEY = 'OPENHUMAN_ACTIVE_USER_ID';
@@ -57,20 +53,17 @@ interface ClearAllAppDataOptions {
// skipped silently if the caller cannot/does not provide it (e.g. pre-login
// recovery from a corrupt key file, where there is no live session).
clearSession?: () => Promise<unknown>;
- // User scope passed to the CEF profile purge so per-user browser data is
- // queued for deletion on the next launch. `null` purges the unauthenticated
- // default profile.
+ // User scope passed to the core reset so only the active account is deleted.
userId?: string | null;
}
/**
* Sign out + wipe every local data store and restart the app:
*
- * 1. Queue the CEF profile directory for deletion on next launch.
- * 2. Best-effort `clearSession` to drop the core's auth state.
- * 3. Reset the openhuman workspace dir + restart the core sidecar.
- * 4. Purge redux-persist + window storage.
- * 5. Restart the desktop shell so CEF reboots into the fresh profile.
+ * 1. Best-effort `clearSession` to drop the core's auth state.
+ * 2. Reset the openhuman workspace dir + restart the core sidecar.
+ * 3. Purge redux-persist + window storage.
+ * 4. Restart the desktop shell into the cleared session.
*
* Used by Settings (Danger Zone) and the Welcome screen's decryption-recovery
* action. Throws on the first step that can't be recovered from — callers are
@@ -80,16 +73,7 @@ export const clearAllAppData = async ({
clearSession,
userId = null,
}: ClearAllAppDataOptions = {}): Promise<void> => {
- // 1. Queue the active user-scoped CEF profile for deletion on next launch.
- // The CEF process may still hold SQLite/cache handles, so we delete
- // after the shell restarts.
- try {
- await scheduleCefProfilePurge(userId);
- } catch (err) {
- console.warn('[clearAllAppData] Failed to queue CEF profile purge:', err);
- }
-
- // 2. Best-effort core-side session clear. If the core is wedged or there is
+ // 1. Best-effort core-side session clear. If the core is wedged or there is
// no session yet (pre-login recovery), keep going — we still want to wipe
// local data.
if (clearSession) {
@@ -100,8 +84,8 @@ export const clearAllAppData = async ({
}
}
- // 3. Delete the signed-in user's data dir + restart core. We pass `userId`
- // explicitly: step 2's `clearSession()` already ran `auth_clear_session`,
+ // 2. Delete the signed-in user's data dir + restart core. We pass `userId`
+ // explicitly: step 1's `clearSession()` already ran `auth_clear_session`,
// which removes the `active_user.toml` marker. If the reset resolved its
// target from that (now-absent) marker it would fall back to the pre-login
// `users/local` dir and delete an empty directory — leaving the real
@@ -111,12 +95,12 @@ export const clearAllAppData = async ({
// pins the deletion to the correct user regardless of marker state.
await resetOpenHumanDataAndRestartCore(userId);
- // 4. Purge redux-persist + browser storage. `persistor.purge()` wipes the
+ // 3. Purge redux-persist + browser storage. `persistor.purge()` wipes the
// persisted backend; `clearUserScopedStorage` removes only the active
// user's localStorage keys so other accounts' data is not destroyed.
await persistor.purge();
clearUserScopedStorage(userId);
- // 5. Full app restart so CEF reboots into the fresh pre-login profile.
+ // 4. Full app restart into the fresh pre-login session.
await restartApp();
};
diff --git a/app/src/utils/tauriCommands/core.test.ts b/app/src/utils/tauriCommands/core.test.ts
index 5d8cf5b41c..f050fcc4e3 100644
--- a/app/src/utils/tauriCommands/core.test.ts
+++ b/app/src/utils/tauriCommands/core.test.ts
@@ -12,7 +12,6 @@ describe('tauriCommands/core', () => {
const mockInvoke = invoke as Mock;
let restartApp: typeof import('./core').restartApp;
let restartCoreProcess: typeof import('./core').restartCoreProcess;
- let scheduleCefProfilePurge: typeof import('./core').scheduleCefProfilePurge;
let mockClearCoreRpcTokenCache: Mock;
beforeEach(async () => {
@@ -21,7 +20,6 @@ describe('tauriCommands/core', () => {
const actual = await vi.importActual<typeof import('./core')>('./core');
restartApp = actual.restartApp;
restartCoreProcess = actual.restartCoreProcess;
- scheduleCefProfilePurge = actual.scheduleCefProfilePurge;
const { clearCoreRpcTokenCache } = await import('../../services/coreRpcClient');
mockClearCoreRpcTokenCache = clearCoreRpcTokenCache as Mock;
});
@@ -222,47 +220,4 @@ describe('tauriCommands/core', () => {
expect(mockInvoke).toHaveBeenCalledWith('apply_app_update');
});
});
-
- describe('scheduleCefProfilePurge', () => {
- test('returns null and does not invoke when not in Tauri', async () => {
- mockIsTauri.mockReturnValue(false);
- const debug = vi.spyOn(console, 'debug').mockImplementation(() => {});
-
- const out = await scheduleCefProfilePurge('x');
-
- expect(out).toBeNull();
- expect(mockInvoke).not.toHaveBeenCalled();
- expect(debug).toHaveBeenCalledWith(
- expect.stringContaining('scheduleCefProfilePurge: skipped — not running in Tauri')
- );
- debug.mockRestore();
- });
-
- test('invoke with userId null when argument is undefined', async () => {
- mockInvoke.mockResolvedValueOnce('/path');
-
- const out = await scheduleCefProfilePurge();
-
- expect(mockInvoke).toHaveBeenCalledWith('schedule_cef_profile_purge', { userId: null });
- expect(out).toBe('/path');
- });
-
- test('invoke with userId null when argument is null', async () => {
- mockInvoke.mockResolvedValueOnce('/path');
-
- const out = await scheduleCefProfilePurge(null);
-
- expect(mockInvoke).toHaveBeenCalledWith('schedule_cef_profile_purge', { userId: null });
- expect(out).toBe('/path');
- });
-
- test('invoke with userId string when provided', async () => {
- mockInvoke.mockResolvedValueOnce('/other');
-
- const out = await scheduleCefProfilePurge('user-9');
-
- expect(mockInvoke).toHaveBeenCalledWith('schedule_cef_profile_purge', { userId: 'user-9' });
- expect(out).toBe('/other');
- });
- });
});
diff --git a/app/src/utils/tauriCommands/core.ts b/app/src/utils/tauriCommands/core.ts
index e320590e10..4536ce2c43 100644
--- a/app/src/utils/tauriCommands/core.ts
+++ b/app/src/utils/tauriCommands/core.ts
@@ -114,20 +114,6 @@ export async function getActiveUserIdFromCore(): Promise<string | null> {
}
}
-/**
- * Queue deletion of a user-scoped CEF profile on the next app launch.
- */
-export async function scheduleCefProfilePurge(userId?: string | null): Promise<string | null> {
- if (!isTauri()) {
- console.debug('[cef-profile] scheduleCefProfilePurge: skipped — not running in Tauri');
- return null;
- }
- console.debug('[cef-profile] scheduleCefProfilePurge: invoking schedule_cef_profile_purge', {
- hasUserId: userId != null,
- });
- return invoke<string>('schedule_cef_profile_purge', { userId: userId ?? null });
-}
-
/**
* Check if the running core sidecar is outdated compared to what the app expects.
*/