[fix]: honour extension CDP url changes on re-initialization
Merged
SE
16h ago+102+102+012345678901234567890123456789-1-1-0123456789
why
- before this, if a stagehand instance was closed, then recreated, and a CDP url was provided in
localBrowser.connect(), the provided CDP url would not get used: the extension would keep using the old one
what changed
- the extension now stores the CDP URL associated with the extension’s browser connection
- the extension will replace the connection when initialization supplies a different URL
- it will reuse reuse a connection when the URL matches or is omitted
test plan
- added a test that initializes with URL A, closes the Stagehand instance, then initializes with URL B and verifies the old connection closes before the new one opens.
- added a test that omits the URL on reinitialization and verifies the existing connection is reused.
- added a test that makes connection replacement fail, verifies the runtime stays idle with no connection, then retries successfully.
- updated the active-instance test to supply a different URL and verify reinitialization is still rejected
Summary by cubic
Fixes the extension keeping a stale browser connection when a Stagehand instance is closed and recreated with a different CDP URL in localBrowser.connect().
- The runtime now stores the CDP URL for the active browser connection and, on re-initialization, replaces the connection when the URL differs and reuses it when the URL matches or is omitted.
- When replacement fails, the runtime stays idle so re-initialization can be retried.
- Adds a changeset and updates the bundled extension assets.