fix: respect canceled_by_user and replaced_with_devtools detach reasons

Skip re-attach when user explicitly dismisses debugger bar or opens
DevTools. Prevents frustrating re-attach loop that fights user intent.

Addresses review feedback from greptile-apps.
This commit is contained in:
NK
2026-02-17 22:04:16 -08:00
committed by Peter Steinberger
parent 67bac62c2c
commit 7c028e8c09

View File

@@ -653,15 +653,18 @@ async function onDebuggerDetach(source, reason) {
if (!tabId) return
if (!tabs.has(tabId)) return
// User explicitly cancelled or DevTools replaced the connection — respect their intent
if (reason === 'canceled_by_user' || reason === 'replaced_with_devtools') {
void detachTab(tabId, reason)
return
}
// Check if tab still exists — distinguishes navigation from tab close
let tabInfo
try {
tabInfo = await chrome.tabs.get(tabId)
} catch {
// Tab is gone (closed) — normal cleanup
void detachTab(tabId, reason)
return
}