← Commit history

battery: the profile_required probe uses a fresh, never-pinned session each run

John Lauer ·f5bea98dca ·21d ago ·parent 95fb680
1 file changed +5−4
tools/verb-battery.mjs+5−4
@@ -102,9 +102,10 @@ const T = {   // acting as whichever profile happens to be active (an agent nearly posted as the wrong person).   guard_profile_required: () => {     const live = (call('nbrowser_profiles').profiles || []).filter((p) => p.live && p.origin !== 'pup');-    const r = call('nbrowser_open_window', { sessionId: SID + '-noprof', thread: THREAD, purpose: 'battery: unnamed open must be refused when several identities are connected', url: HARNESS });-    if (live.length < 2) { if (r.ok === true) call('nbrowser_close_window', { sessionId: SID + '-noprof' }); return A(true, `[skip] only ${live.length} identity connected - defaulting is unambiguous, guard not applicable`, ''); }-    if (r.ok === true) { call('nbrowser_close_window', { sessionId: SID + '-noprof' }); return [false, 'unnamed open was ALLOWED with several identities connected']; }+    const fresh = `${SID}-noprof-${Date.now()}`;   // never pinned: a pin would make the guard skip by design+    const r = call('nbrowser_open_window', { sessionId: fresh, thread: THREAD, purpose: 'battery: unnamed open must be refused when several identities are connected', url: HARNESS });+    if (live.length < 2) { if (r.ok === true) call('nbrowser_close_window', { sessionId: fresh }); return A(true, `[skip] only ${live.length} identity connected - defaulting is unambiguous, guard not applicable`, ''); }+    if (r.ok === true) { call('nbrowser_close_window', { sessionId: fresh }); return [false, 'unnamed open was ALLOWED with several identities connected']; }     return A(r.errorCode === 'profile_required' && Array.isArray(r.profiles) && r.profiles.length >= 2, `refused: ${r.errorCode}, listed ${(r.profiles || []).length} identities`, `errorCode:${r.errorCode} listed:${(r.profiles || []).length}`);   },   // nb-bridge#52: a window can be opened OUT OF SIGHT in one step and stays drivable there.@@ -392,7 +393,7 @@ if (import.meta.url === `file://${process.argv[1]}`) {   // Closing the window does NOT drop the session's profile PIN, and a pin left by a run that used a   // different profile makes every later verb fail profile_mismatch (laptop, 2026-10-21). Re-pin to the   // profile THIS run will drive, so a run is never poisoned by the one before it.-  for (const sid of [SID, SID + '-l1', SID + '-min', SID + '-noprof', SID + '-dead', SID + '-cdpblock', SID + '-demo']) {+  for (const sid of [SID, SID + '-l1', SID + '-min', SID + '-dead', SID + '-cdpblock', SID + '-demo']) {   // NOT the profile_required probe: it must stay unpinned     call('nbrowser_pin_session', { sessionId: sid, profile: PROFILE });   }   // WARM-UP: a daily run can land seconds after ab auto-respawned the bridge (self-update), before