You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: improve connection reliability with retry logic and stale target handling
Add resilience to browser connection and page enumeration:
- Retry puppeteer.connect with exponential backoff on transient failures
- Extract readDevToolsActivePort helper with I/O retry (fail fast on
validation errors)
- Clear stale browser reference before reconnecting
- Dispose previous McpContext before creating a new one
- Wrap browser.pages() in try/catch with a single retry for stale targets
- Guard detectOpenDevToolsWindows() so failures don't break tool calls
- Catch per-page hasDevTools()/openDevTools() errors individually
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
`Could not connect to Chrome in ${userDataDir}. Check if Chrome is running and remote debugging is enabled by going to chrome://inspect/#remote-debugging.`,
`Could not connect to Chrome. ${autoConnect ? `Check if Chrome is running and remote debugging is enabled by going to chrome://inspect/#remote-debugging.` : `Check if Chrome is running.`}`,
127
130
{
128
-
cause: err,
131
+
cause: lastConnectError,
129
132
},
130
133
);
131
134
}
132
135
logger('Connected Puppeteer');
133
-
returnbrowser;
136
+
// browser is guaranteed to be set here: either puppeteer.connect succeeded
`Could not connect to Chrome in ${userDataDir}. Check if Chrome is running and remote debugging is enabled by going to chrome://inspect/#remote-debugging.`,
0 commit comments