Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

eval: prevent premature storage migration retry

louis63e3c9e8e04e
diff --git a/evals/coding-agent/README.md b/evals/coding-agent/README.md
index 5014bb38f..4f21f55a7 100644
--- a/evals/coding-agent/README.md
+++ b/evals/coding-agent/README.md
@@ -9,7 +9,7 @@ This is an agent eval suite, not a unit-test suite. Every case contains:
- saved prompt, transcript, candidate patch, grader output, runtime fingerprint, and result;
- repeated-trial reporting with success rate, `pass@k`, and `pass^k`.
-The current app corpus contains 61 git-mined regressions. See
+The current app corpus contains 63 git-mined regressions. See
[DESIGN.md](./DESIGN.md) for the Anthropic guidance, source contract, and
history-mining workflow. The companion website manifest uses this same harness.
@@ -564,3 +564,26 @@ boundaries, retries, recovery, retention and data-compatible rollback. The
28 passing controls calibrate a structured review grader; they are not native
migration tests or model trials. Existing coding manifests and the shared runner
are unchanged. The current native rollout-policy gap is recorded, not repaired.
+
+## Explicit migration retry readiness
+
+`app-migration-startup-retry` executes the real React prompt and UI controls with
+synthetic native status and command ports. The parent offers a retry while startup
+is busy or blocked: two intended failures and fourteen preserved passes. The
+historical fix and current source pass all sixteen outcomes, including explicit
+start/retry, process-scoped deferral, ineligible and reopening storage, permitted
+original-database recovery, no source deletion and an unresolved start request.
+Only the prompt component is applied as the historical oracle.
+
+Run `bun test evals/coding-agent/calibrate-migration-startup-retry.test.js` with the
+desktop JavaScript dependencies installed. Eleven controls reject unused fixes,
+either missing readiness gate, blanket suppression, automatic native start,
+lost deferral and source deletion. Equivalent readiness expressions pass; a
+missing component remains a setup error. These are grader calibrations, not
+model trials. Button casing and unrelated presentation copy are not scored.
+
+This UI case is separate from the managed-rollout review above. It does not
+establish native migration/recovery durability, disk or NAS behavior, recording
+continuity, native authorization, deployment reach or enforced trial isolation.
+The native rollout-policy finding remains open. No native build or production
+operation is performed; runtime links and fixtures appear only at grading time.
diff --git a/evals/coding-agent/calibrate-migration-startup-retry.test.js b/evals/coding-agent/calibrate-migration-startup-retry.test.js
new file mode 100644
index 000000000..e434e5c3e
--- /dev/null
+++ b/evals/coding-agent/calibrate-migration-startup-retry.test.js
@@ -0,0 +1,58 @@
+// screenpipe — AI that knows everything you've seen, said, or heard
+// https://screenpipe.com
+import { afterAll, expect, test } from 'bun:test';
+import { execFileSync, spawnSync } from 'node:child_process';
+import { dirname, join, resolve } from 'node:path';
+import { mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+
+const repo = resolve(import.meta.dir, '../..');
+const app = 'apps/screenpipe-app-tauri';
+const page = `apps/screenpipe-app-tauri/components/storage-migration-prompt.tsx`;
+const fixture = `apps/screenpipe-app-tauri/components/storage-migration-prompt.test.tsx`;
+const item = JSON.parse(readFileSync(join(import.meta.dir, 'cases.json'), 'utf8')).cases
+ .find(c => c.id === 'app-migration-startup-retry');
+const root = mkdtempSync(join(tmpdir(), 'onboarding-assignment-calibration-'));
+const archives = new Map();
+const fixtureSource = readFileSync(join(import.meta.dir, 'graders/migration-startup-retry.fixture.tsx'));
+const paths = ['app/onboarding', 'components', 'lib', 'scripts', 'vitest.config.ts',
+ 'vitest.setup.ts', 'package.json', 'tsconfig.json', 'postcss.config.js', 'tailwind.config.js']
+ .filter(path => spawnSync('git', ['cat-file', '-e', `${item.oracle_ref}:${app}/${path}`], { cwd: repo }).status === 0)
+ .map(path => `${app}/${path}`);
+afterAll(() => rmSync(root, { recursive: true, force: true }));
+
+function change(cwd, path, from, to) {
+ const file = join(cwd, path), source = readFileSync(file, 'utf8');
+ expect(source.split(from)).toHaveLength(2);
+ writeFileSync(file, source.replace(from, to));
+}
+function grade(name, ref = item.oracle_ref, mutate = () => {}) {
+ const cwd = join(root, name); mkdirSync(cwd);
+ if (!archives.has(ref)) archives.set(ref, execFileSync('git',
+ ['-c', 'core.commitGraph=false', 'archive', ref, ...paths], { cwd: repo, maxBuffer: 128 * 1024 * 1024 }));
+ execFileSync('tar', ['-x', '-C', cwd], { input: archives.get(ref) });
+ writeFileSync(join(cwd, fixture), fixtureSource);
+ symlinkSync(join(repo, app, 'node_modules'), join(cwd, app, 'node_modules'), 'dir');
+ mutate(cwd);
+ return spawnSync('/bin/bash', ['-c', item.grader.command], { cwd, encoding: 'utf8',
+ timeout: 120_000, env: { ...process.env, PATH: `${dirname(process.execPath)}:${process.env.PATH}` },
+ maxBuffer: 4 * 1024 * 1024 });
+}
+function fails(result) {
+ expect(result.error).toBeUndefined(); expect(result.signal).toBeNull();
+ expect(result.status).toBe(1);
+ expect(result.stdout + result.stderr).toMatch(/expected|Unable to find (?:an element|role)/);
+ expect(result.stdout + result.stderr).not.toMatch(/Failed to load url|Cannot find module|Failed to resolve import/);
+}
+
+test('parent fails readiness while preserving neighboring outcomes',()=>{const r=grade('parent',item.base_ref);fails(r);expect(r.stdout).toContain('2 failed | 14 passed');},120000);
+test('reference passes all outcomes',()=>{const r=grade('reference');expect(r.status).toBe(0);expect(r.stdout).toContain('16 passed');},120000);
+test('equivalent readiness expression is accepted',()=>expect(grade('equivalent',item.oracle_ref,cwd=>change(cwd,page,'!status.busy && !status.blocked_reason','!(status.busy || status.blocked_reason)')).status).toBe(0),120000);
+test('unused correct component does not repair caller',()=>fails(grade('unused',item.base_ref,cwd=>writeFileSync(join(cwd,page+'.unused.tsx'),execFileSync('git',['show',`${item.oracle_ref}:${page}`],{cwd:repo})))),120000);
+test('busy-only gate misses blocked recovery',()=>fails(grade('no-blocked',item.oracle_ref,cwd=>change(cwd,page,'!status.busy && !status.blocked_reason','!status.busy'))),120000);
+test('blocked-only gate misses busy recovery',()=>fails(grade('no-busy',item.oracle_ref,cwd=>change(cwd,page,'!status.busy && !status.blocked_reason','!status.blocked_reason'))),120000);
+test('blanket suppression loses healthy explicit action',()=>fails(grade('suppress',item.oracle_ref,cwd=>change(cwd,page,'const open = Boolean(','const open = false && Boolean('))),120000);
+test('automatic effect cannot hide behind a closed dialog',()=>fails(grade('auto',item.oracle_ref,cwd=>change(cwd,page,'setStatus(result.data);','setStatus(result.data); void commands.startStorageMigration(result.data.root);'))),120000);
+test('deferral must survive webview recreation',()=>fails(grade('deferral',item.oracle_ref,cwd=>change(cwd,page,'window.localStorage.setItem(deferredKey(status.root), status.app_session_id);',''))),120000);
+test('recovery must not become source deletion',()=>fails(grade('delete',item.oracle_ref,cwd=>change(cwd,page,'await commands.cancelStorageMigration(status.root)','await commands.deleteOriginalStorageDatabase(status.root)'))),120000);
+test('missing component remains an import error',()=>{const r=grade('missing',item.oracle_ref,cwd=>rmSync(join(cwd,page)));expect(r.status).toBe(1);expect(r.stdout+r.stderr).toMatch(/Failed to resolve import|Failed to load url/);expect(r.stdout).toContain('no tests');},120000);
diff --git a/evals/coding-agent/cases.json b/evals/coding-agent/cases.json
index 15e58bf37..6db7a7214 100644
--- a/evals/coding-agent/cases.json
+++ b/evals/coding-agent/cases.json
@@ -1,7 +1,7 @@
{
"schema_version": 1,
"suite": "screenpipe-app-coding-agent-regressions",
- "dataset_version": "2026-09-20.13",
+ "dataset_version": "2026-09-20.14",
"suite_type": "regression",
"owner": "screenpipe engineering",
"policy": {
@@ -2041,6 +2041,45 @@
],
"command": "cd apps/screenpipe-app-tauri && \"${BUN_BIN:-bun}\" test ../../evals/coding-agent/graders/device-settings-identity.test.js"
}
+ },
+ {
+ "id": "app-migration-startup-retry",
+ "name": "Wait for storage readiness before offering explicit migration retry",
+ "source": {
+ "kind": "git_regression",
+ "fix_commit": "65b05ea2ad2cc5c82a92456482ced5da3c27ad10",
+ "pull_request": "https://github.com/screenpipe/screenpipe/pull/7029"
+ },
+ "base_ref": "69be03c40091bcb1974b12f5d124852f346f69cc",
+ "oracle_ref": "65b05ea2ad2cc5c82a92456482ced5da3c27ad10",
+ "oracle_paths": [
+ "apps/screenpipe-app-tauri/components/storage-migration-prompt.tsx"
+ ],
+ "tags": [
+ "regression",
+ "escaped-failure",
+ "migration",
+ "recovery",
+ "consent"
+ ],
+ "prompt": "The visible desktop migration prompt can offer a retry while startup still owns the database. Hide the migration dialog and perform no start, cancel or deletion when native status is busy or has a blocking reason, even if a failed in-place migration is pending. Once that status is ready, allow exactly an explicit retry for the selected root. Busy activity also stays quiet. Preserve ordinary legacy-storage offers without automatic start or source deletion; Do later must survive a recreated webview in the same app process, while a new process may offer the choice again without automatically converting. Keep the prompt closed for empty/ineligible, already-converted, vault-blocked and completed-but-reopening storage. Interrupted in-place conversion permits explicit retry without offering the original-database fallback; where native status permits cancellation, that recovery action must call cancel for the selected root and never delete the original. Failed starts must display their error and permit another explicit retry. Repeated app launches after failure/interruption must never automatically retry. During an unresolved explicit start, disable repeated start and deferral until the request resolves. Exercise the actual React prompt and native command boundary with synthetic status and storage ports. No particular helper, wording or internal implementation is required. This case does not establish native recovery, durability, deployment exposure or managed migration authorization; do not broaden automatic conversion, change native code, build native targets, publish or contact live services.",
+ "agent_timeout_seconds": 1200,
+ "grader_dependency_links": [
+ {
+ "source_path": "apps/screenpipe-app-tauri/node_modules",
+ "destination_path": "apps/screenpipe-app-tauri/node_modules"
+ }
+ ],
+ "grader": {
+ "timeout_seconds": 120,
+ "fixtures": [
+ {
+ "local_path": "graders/migration-startup-retry.fixture.tsx",
+ "destination_path": "apps/screenpipe-app-tauri/components/storage-migration-prompt.test.tsx"
+ }
+ ],
+ "command": "cd apps/screenpipe-app-tauri && NODE_OPTIONS=--localstorage-file=.eval-localstorage bun x vitest run --config vitest.config.ts components/storage-migration-prompt.test.tsx --maxWorkers=1 --minWorkers=1"
+ }
}
]
}
diff --git a/evals/coding-agent/graders/migration-startup-retry.fixture.tsx b/evals/coding-agent/graders/migration-startup-retry.fixture.tsx
new file mode 100644
index 000000000..a5b36cfd9
--- /dev/null
+++ b/evals/coding-agent/graders/migration-startup-retry.fixture.tsx
@@ -0,0 +1,182 @@
+// screenpipe — AI that knows everything you've seen, said, or heard
+// https://screenpipe.com
+
+import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import type { StorageMigrationActivity, StorageMigrationStatus } from "@/lib/utils/tauri";
+
+const commands = vi.hoisted(() => ({
+ getStorageMigrationStatus: vi.fn(), startStorageMigration: vi.fn(),
+ cancelStorageMigration: vi.fn(), deleteOriginalStorageDatabase: vi.fn(),
+}));
+vi.mock("@/lib/utils/tauri", () => ({ commands }));
+import { StorageMigrationPrompt } from "./storage-migration-prompt";
+
+const idle: StorageMigrationActivity = { root: "/fixture", busy: false, message: "", error: null, elapsed_seconds: 0, completed_records: null, total_records: null, bytes_saved: null, available_bytes: null, completed: false };
+let status: StorageMigrationStatus;
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ sessionStorage.clear();
+ window.localStorage.clear();
+ status = {
+ app_session_id: "app-launch-1",
+ root: "/fixture", busy: false, message: "", error: null, pending: false, in_place: false, bytes_saved: null, available_bytes: null,
+ completed: false, using_new_storage: false, generation: null, source_bytes: 20 * 1024 ** 3,
+ migrated_bytes: null, can_migrate: true, can_cancel: false, can_delete_source: false,
+ blocked_reason: null,
+ };
+ commands.getStorageMigrationStatus.mockImplementation(async () => ({ status: "ok", data: { ...status } }));
+ commands.startStorageMigration.mockResolvedValue({ status: "ok", data: null });
+ commands.cancelStorageMigration.mockResolvedValue({ status: "ok", data: null });
+});
+afterEach(cleanup);
+
+describe("explicit storage migration readiness", () => {
+ it.each([
+ { busy: true },
+ { blocked_reason: "Screenpipe is restarting or restoring recording. Wait for startup to finish." },
+ ])("withholds retry and recording-resumed claims while startup owns storage: %j", async (startup) => {
+ Object.assign(status, {
+ pending: true, in_place: true, error: "The previous storage migration did not finish.",
+ ...startup,
+ });
+ const app = render(<StorageMigrationPrompt activity={idle} />);
+ await waitFor(() => expect(commands.getStorageMigrationStatus).toHaveBeenCalled());
+ expect(screen.queryByRole("alertdialog")).toBeNull();
+ expect(screen.queryByRole("button", { name: /try again/i })).toBeNull();
+ expect(commands.startStorageMigration).not.toHaveBeenCalled();
+ expect(commands.cancelStorageMigration).not.toHaveBeenCalled();
+ expect(commands.deleteOriginalStorageDatabase).not.toHaveBeenCalled();
+ app.unmount();
+ Object.assign(status, { busy: false, blocked_reason: null });
+ render(<StorageMigrationPrompt activity={idle} />);
+ fireEvent.click(await screen.findByRole("button", { name: /try again/i }));
+ await waitFor(() => expect(commands.startStorageMigration).toHaveBeenCalledOnce());
+ });
+
+ it("offers only resume for an interrupted in-place conversion", async () => {
+ Object.assign(status, { pending: true, in_place: true, can_cancel: false, error: "Free more disk space to resume." });
+ render(<StorageMigrationPrompt activity={{ ...idle, error: status.error }} />);
+ await screen.findByRole("alertdialog");
+ expect(screen.queryByRole("button", { name: /use original database/i })).toBeNull();
+ fireEvent.click(screen.getByRole("button", { name: /try again/i }));
+ await waitFor(() => expect(commands.startStorageMigration).toHaveBeenCalledWith("/fixture"));
+ });
+ it("detects legacy storage, explains the pause and starts only on request", async () => {
+ render(<StorageMigrationPrompt activity={idle} />);
+ await screen.findByRole("alertdialog");
+ expect(commands.startStorageMigration).not.toHaveBeenCalled();
+ fireEvent.click(screen.getByRole("button", { name: /start now/i }));
+ await waitFor(() => expect(commands.startStorageMigration).toHaveBeenCalledWith("/fixture"));
+ expect(commands.deleteOriginalStorageDatabase).not.toHaveBeenCalled();
+ });
+
+ it("respects do later when a webview is recreated in the same app process", async () => {
+ const app = render(<StorageMigrationPrompt activity={idle} />);
+ fireEvent.click(await screen.findByRole("button", { name: /do later/i }));
+ expect(screen.queryByRole("alertdialog")).toBeNull();
+ app.unmount();
+ sessionStorage.clear();
+ render(<StorageMigrationPrompt activity={idle} />);
+ await waitFor(() => expect(commands.getStorageMigrationStatus).toHaveBeenCalledTimes(2));
+ expect(screen.queryByRole("alertdialog")).toBeNull();
+ expect(commands.startStorageMigration).not.toHaveBeenCalled();
+ expect(commands.deleteOriginalStorageDatabase).not.toHaveBeenCalled();
+ });
+
+ it("offers migration after every app process restart even with webview storage retained", async () => {
+ for (const session of ["app-launch-1", "app-launch-2", "app-launch-3"]) {
+ status.app_session_id = session;
+ const app = render(<StorageMigrationPrompt activity={idle} />);
+ fireEvent.click(await screen.findByRole("button", { name: /do later/i }));
+ expect(screen.queryByRole("alertdialog")).toBeNull();
+ app.unmount();
+ }
+ expect(commands.startStorageMigration).not.toHaveBeenCalled();
+ expect(commands.deleteOriginalStorageDatabase).not.toHaveBeenCalled();
+ });
+
+ it.each([
+ { can_migrate: false, source_bytes: 0 },
+ { can_migrate: false, completed: true, using_new_storage: true },
+ { can_migrate: false, blocked_reason: "Vault protection is enabled." },
+ ])("does not interrupt users without an eligible migration: %j", async (overrides) => {
+ Object.assign(status, overrides);
+ render(<StorageMigrationPrompt activity={idle} />);
+ await waitFor(() => expect(commands.getStorageMigrationStatus).toHaveBeenCalled());
+ expect(screen.queryByRole("alertdialog")).toBeNull();
+ });
+
+ it("stays closed across app launches while completed storage is reopening", async () => {
+ Object.assign(status, {
+ completed: true, using_new_storage: false, can_migrate: false,
+ generation: "migrated-generation",
+ });
+ for (const session of ["app-launch-1", "app-launch-2", "app-launch-3"]) {
+ status.app_session_id = session;
+ const app = render(<StorageMigrationPrompt activity={idle} />);
+ await waitFor(() => expect(commands.getStorageMigrationStatus).toHaveBeenCalled());
+ expect(screen.queryByRole("alertdialog")).toBeNull();
+ app.unmount();
+ commands.getStorageMigrationStatus.mockClear();
+ }
+ expect(commands.startStorageMigration).not.toHaveBeenCalled();
+ });
+
+ it.each(["failure", "interruption"])("requires an explicit retry after %s across app launches", async (reason) => {
+ Object.assign(status, {
+ pending: true, in_place: true,
+ error: reason === "failure" ? "Not enough free disk space." : "The previous storage migration did not finish.",
+ });
+ for (const session of ["app-launch-1", "app-launch-2"]) {
+ status.app_session_id = session;
+ const app = render(<StorageMigrationPrompt activity={{ ...idle, error: status.error }} />);
+ await screen.findByRole("button", { name: /try again/i });
+ expect(commands.startStorageMigration).not.toHaveBeenCalled();
+ fireEvent.click(screen.getByRole("button", { name: /do later/i }));
+ app.unmount();
+ }
+ status.app_session_id = "app-launch-3";
+ render(<StorageMigrationPrompt activity={{ ...idle, error: status.error }} />);
+ fireEvent.click(await screen.findByRole("button", { name: /try again/i }));
+ await waitFor(() => expect(commands.startStorageMigration).toHaveBeenCalledTimes(1));
+ expect(commands.startStorageMigration).toHaveBeenCalledWith("/fixture");
+ });
+
+ it("surfaces start failures and permits retry without losing the original", async () => {
+ commands.startStorageMigration.mockResolvedValueOnce({ status: "error", error: "Could not prevent sleep. Migration has not started." });
+ render(<StorageMigrationPrompt activity={idle} />);
+ fireEvent.click(await screen.findByRole("button", { name: /start now/i }));
+ expect(await screen.findByRole("alert")).toHaveTextContent("Could not prevent sleep");
+ fireEvent.click(screen.getByRole("button", { name: /try again/i }));
+ await waitFor(() => expect(commands.startStorageMigration).toHaveBeenCalledTimes(2));
+ });
+
+ it("offers recovery for an interrupted migration", async () => {
+ Object.assign(status, { pending: true, can_cancel: true, error: "Verification failed; original kept." });
+ render(<StorageMigrationPrompt activity={{ ...idle, error: status.error }} />);
+ expect(await screen.findByRole("alert")).toHaveTextContent("Verification failed");
+ fireEvent.click(screen.getByRole("button", { name: /use original database/i }));
+ await waitFor(() => expect(commands.cancelStorageMigration).toHaveBeenCalledWith("/fixture"));
+ expect(commands.deleteOriginalStorageDatabase).not.toHaveBeenCalled();
+ });
+
+
+ it("does not duplicate an unresolved explicit start or allow deferral mid-request", async () => {
+ let finish!: () => void;
+ commands.startStorageMigration.mockImplementationOnce(() => new Promise(resolve => { finish = () => resolve({status:"ok",data:null}); }));
+ render(<StorageMigrationPrompt activity={idle} />);
+ fireEvent.click(await screen.findByRole("button", {name:/start now/i}));
+ const pending=screen.getByRole("button", {name:/starting/i});
+ expect(pending).toBeDisabled();expect(screen.getByRole("button", {name:/do later/i})).toBeDisabled();
+ fireEvent.click(pending);expect(commands.startStorageMigration).toHaveBeenCalledTimes(1);
+ await act(async()=>finish());
+ expect(commands.deleteOriginalStorageDatabase).not.toHaveBeenCalled();
+ });
+ it("keeps quiet when activity owns storage and never starts a migration", async () => {
+ render(<StorageMigrationPrompt activity={{...idle,busy:true}} />);
+ await act(async()=>{});
+ expect(screen.queryByRole("alertdialog")).toBeNull();expect(commands.startStorageMigration).not.toHaveBeenCalled();
+ });
+});