From ae1626b77267448cd41316bca3537b13ff2ccab9 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 17 Feb 2026 05:30:08 +0000 Subject: [PATCH] Retry perf seed when post-reload threads are missing Co-authored-by: Julius Marminge --- apps/desktop/src/desktopPerfAutomation.ts | 54 +++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/apps/desktop/src/desktopPerfAutomation.ts b/apps/desktop/src/desktopPerfAutomation.ts index df7f45ca39..c18e4ebbec 100644 --- a/apps/desktop/src/desktopPerfAutomation.ts +++ b/apps/desktop/src/desktopPerfAutomation.ts @@ -429,6 +429,37 @@ async function seedRendererState( return window.webContents.executeJavaScript(script, true); } +async function readRendererPersistedStateSnapshot(window: BrowserWindow): Promise<{ + url: string; + projects: number; + threads: number; +}> { + const script = ` + (() => { + const key = "t3code:renderer-state:v7"; + const raw = localStorage.getItem(key); + let projects = 0; + let threads = 0; + if (raw) { + try { + const parsed = JSON.parse(raw); + projects = Array.isArray(parsed?.projects) ? parsed.projects.length : 0; + threads = Array.isArray(parsed?.threads) ? parsed.threads.length : 0; + } catch { + projects = -1; + threads = -1; + } + } + return { + url: window.location.href, + projects, + threads, + }; + })(); + `; + return window.webContents.executeJavaScript(script, true); +} + async function runRendererPerfInteractions( window: BrowserWindow, benchmarkThreadIds: string[], @@ -1016,6 +1047,10 @@ export async function runDesktopPerfAutomation(window: BrowserWindow): Promise