fix(browser): auto-attach provisioned sessions - #129
Merged
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
browser_executeto the run-startBU_CDP_WSand attach its existing page before the first snippetSessionreplacementBU_CDP_WSflows explicit and preserve explicitwsUrlorprofileDirconnectionsconnect()idempotent for compatibility with the current Cloud prompt during rolloutRoot cause
Cloud V4 starts a fresh
bcodeprocess for each user run while the AgentCore runtime and remote browser can remain alive. The fresh process has no in-memory WebSocket or target attachment, so a directPage.navigatefails withNot connectedeven though the browser and page are alive. In staging session12d6be06-d2f9-426a-9821-80a85e9cac8b, the first SAP navigation failed exactly this way and succeeded immediately after an explicit connect plususe.The runtime now owns only the safe invariant: a fresh V4 process attaches its run-start browser once. Recovery remains deliberate because
BU_CDP_WSdoes not change when an agent creates and switches to another browser during a run.The deeper reconnect audit also found that explicit
connect({ wsUrl })replacedSession.wswithout closing the prior socket or clearingactiveSessionId. A command on the new socket could therefore carry a target session ID created by the old browser. Explicit replacement is now atomic from the Session perspective: pending old calls fail, the old socket is retired, stale messages are ignored, and target attachment is cleared.Compatibility
V4_RUN_IDplusBU_CDP_WSorBU_CDP_URL: one initial automatic connect and target attachmentBU_CDP_WSorBU_CDP_URLwithoutV4_RUN_ID: unchanged explicit flow for evals and local harnessesbrowser_executetimeout, or explicit alternate browser: no automatic fallback to the run-start endpointwsUrlremains usableTests
packages/bcode-browser: 33 passed, 8 existing live-browser skips, 0 failedPage.navigate, idempotent compatibility, concurrent bootstrap, dropped sockets, timeout replacement, eval/local isolation, failed bootstrap recovery, and explicit browser switching with stale-target retirement