← Commit history

battery: profile discovery prefers a signed-in live profile over an id key

John Lauer ·f9b8afbcd1 ·1mo ago ·parent 35e0214
1 file changed +6−1
tools/verb-battery.mjs+6−1
@@ -319,7 +319,12 @@ function discoverProfile() {     process.exit(2);   }   const ps = r.profiles;-  const live = ps.find((p) => p.live && p.browser === 'chrome') || ps.find((p) => p.live);+  // Prefer a SIGNED-IN live profile over an id key (`chrome:p_xxxx`). An id key can belong to a browser+  // outside the default user-data dir (pup loads nbe into its own Chrome), which Layer 1 rightly refuses+  // to map to a disk profile when several candidates exist (laptop battery, 2026-09-20).+  const signed = (p) => p.live && p.email;+  const live = ps.find((p) => signed(p) && p.browser === 'chrome') || ps.find(signed)+    || ps.find((p) => p.live && p.browser === 'chrome') || ps.find((p) => p.live);   if (live) return live.profile;   const installed = ps.find((p) => p.extensionInstalled && p.browser === 'chrome') || ps.find((p) => p.extensionInstalled);   if (installed) { call('nbrowser_wake_profile', { profile: installed.profile }); return installed.profile; }