Live-reproduced #24 on 0.4.8 driving the Mercari signin token-exchange hop (login.jp.mercari.com): the cross-process nav gives the tab a NEW Chrome tabId while the CDP targetId stays the same. So cb-tab-<oldTabId> can't be recovered — recoverSessionTab parsed the old tabId, chrome.tabs.get(oldTabId) failed (gone), and it gave up → permanent 'stale sessionId ... its tab is gone' until the page settled ~6s later and something re-attached. current/tab <targetId>/daemon restart all failed because the relay still mapped the targetId to the dead session. Fix: remember each session's targetId across detach (sessionTargets map). When recoverSessionTab can't recover by the encoded tabId, fall back to the STABLE targetId — chrome.debugger.getTargets() to find the tab now hosting that target, attach it, and ALIAS the dead cb-tab-<oldTabId> session to the live tab so the daemon's session id keeps resolving. Longer retry window (~6s) since this hop takes seconds to settle. Builds on 0.4.6/0.4.8 reattach; covers the tabId-churn case those missed. Needs dogfood on the real Mercari flow (can't repro the tabId churn synthetically).
32 KiB
32 KiB