From ce30547af39f692bef777591bdb329a7fa00e86e Mon Sep 17 00:00:00 2001 From: amankumarsingh77 Date: Tue, 28 Jul 2026 19:42:25 +0530 Subject: fix(cdp): re-enable domains when re-attaching to a known tab Every Target.attachToTarget mints a new sessionId and CDP domain enablement is per-session, but switchTo only enabled domains on a tab's first visit. Switching away and back left the refreshed session with Page, Network, Runtime and Log disabled, so that tab silently stopped collecting console and network records and stopped reporting dialogs and load events for the rest of the session. Report: docs/superpowers/reports/2026-07-26-bug-audit.md#f3 Co-Authored-By: Claude Opus 5 (1M context) --- src/cdp/session.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/cdp/session.ts b/src/cdp/session.ts index bf423e1..39cd87e 100644 --- a/src/cdp/session.ts +++ b/src/cdp/session.ts @@ -369,12 +369,11 @@ export const createCdpSession = ( // Each Target.attachToTarget produces a new sessionId — update it. sessionIdToTargetId.delete(existing.sessionId); existing.sessionId = attachedSessionId; - sessionIdToTargetId.set(attachedSessionId, tid); } else { tabs.set(tid, tab); - await enableDomains(attachedSessionId); - sessionIdToTargetId.set(attachedSessionId, tid); } + sessionIdToTargetId.set(attachedSessionId, tid); + await enableDomains(attachedSessionId); // Update global pointers to point at the new active tab sessionId = tab.sessionId; targetId = tid; -- cgit v1.2.3