fix(v3): normalize CUA coordinates to actual viewport - #2767
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 80ea5e2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Architecture diagram
sequenceDiagram
participant V3 as V3CuaAgentHandler
participant Page as Active Page (Browser)
participant Google as GoogleCUAClient
participant Test as Regression Test
Note over V3,Google: CUA Coordinate Normalization Flow
alt Normalization for all CUA clients (NEW unified path)
V3->>Page: awaitActivePage()
Page-->>V3: page reference
V3->>Page: page.mainFrame().evaluate() for window.innerWidth/innerHeight
Page-->>V3: { w: 384, h: 696 } (actual CSS viewport)
alt Valid dimensions returned
V3->>Google: setViewport(384, 696)
Google-->>V3: viewport updated
else w or h is 0/undefined
V3->>V3: skip update (empty catch block)
end
end
Note over V3,Test: Key behavior: coordinates now match actual rendered viewport instead of hard-coded 1288x711 (old Verified mode)
alt Regression test: Google CUA with mobile viewport mismatch
Test->>V3: create handler with isVerified=true, configuredViewport=430x932
Test->>Test: spy on GoogleCUAClient.setViewport()
V3->>Page: awaitActivePage()
Page-->>V3: page with 384x696 CSS viewport
V3->>Google: setViewport(384, 696)
Google-->>V3: viewport set
Test->>Test: expect(setViewport).toHaveBeenCalledWith(384, 696)
Note over Test: Verifies actual mobile viewport (384x696) overrides<br/>configured (430x932) and old 1288x711 fallback
end
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
miguelg719
force-pushed
the
fix/v3-mobile-cua-viewport
branch
3 times, most recently
from
August 17, 2026 22:04
41b0675 to
5f78422
Compare
miguelg719
force-pushed
the
fix/v3-mobile-cua-viewport
branch
from
August 17, 2026 22:19
5f78422 to
70359ca
Compare
akeimach
approved these changes
Aug 18, 2026
Merged
miguelg719
pushed a commit
that referenced
this pull request
Aug 20, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to v3, this PR will be updated. # Releases ## @browserbasehq/stagehand@3.7.2 ### Patch Changes - [#2775](#2775) [`b954a46`](b954a46) Thanks [@miguelg719](https://github.com/miguelg719)! - Fix Anthropic structured output options for provider-prefixed models - [#2767](#2767) [`98fa7a4`](98fa7a4) Thanks [@miguelg719](https://github.com/miguelg719)! - Fix: Normalize CUA coordinates to actual viewport - [#2385](#2385) [`7566804`](7566804) Thanks [@miguelg719](https://github.com/miguelg719)! - Add `useTouch` option to actuate agent clicks as trusted touch ## @browserbasehq/stagehand-evals@2.1.1 ### Patch Changes - Updated dependencies \[[`b954a46`](b954a46), [`98fa7a4`](98fa7a4), [`7566804`](7566804)]: - @browserbasehq/stagehand@3.7.2 ## @browserbasehq/stagehand-server-v3@3.7.4 ### Patch Changes - Updated dependencies \[[`b954a46`](b954a46), [`98fa7a4`](98fa7a4), [`7566804`](7566804)]: - @browserbasehq/stagehand@3.7.2 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
why
Verified Browserbase mobile sessions can expose a CSS viewport such as 384x696 even when the requested viewport differs. Google CUA was instead normalizing model coordinates against a hard-coded 1288x711 viewport, which converted valid taps into off-screen mouse coordinates and prevented touch-only controls from working.
what changed
test plan