Skip to content

Conversation

@t-anjan
Copy link

@t-anjan t-anjan commented Jan 8, 2026

Why

The GoogleCUAClient was failing to parse scroll actions from Google's CUA model. When Google returned a scroll_at function call with {direction, magnitude} parameters, the client was passing these raw fields to the ScrollAction model, which expects {scroll_x, scroll_y}. This caused Pydantic validation errors and prevented scroll actions from working in the browser automation pipeline.

What Changed

  • Updated GoogleCUAClient._process_provider_response() to properly convert Google's scroll_at format to the expected ScrollAction format
  • Added safe extraction of direction and magnitude with defaults (down, 800)
  • Implemented direction-to-scroll coordinate conversion:
    • down → scroll_y = magnitude
    • up → scroll_y = -magnitude
    • right → scroll_x = magnitude
    • left → scroll_x = -magnitude
  • Added graceful handling of missing or non-numeric magnitude values
  • Removed the unsupported direction error path that was causing failures

Test Plan

  • Created integration test test_scroll_at_parsing.py that:
    • Mocks Google CUA responses with scroll_at function calls
    • Verifies the conversion from direction/magnitude to scroll_x/scroll_y
    • Tests all scroll directions (up, down, left, right)
    • Tests edge cases (missing direction, missing magnitude, invalid magnitude)
    • Executes the parsed ScrollAction in a real browser to confirm scrolling works
  • Ran the test suite and confirmed all scroll parsing tests pass
  • Verified that scroll actions now execute successfully in the browser without validation errors

Summary by cubic

Fixes scroll parsing in GoogleCUAClient by converting Google’s scroll_at {direction, magnitude} to {scroll_x, scroll_y}. This resolves validation errors and makes scroll actions work in the browser.

  • Bug Fixes
    • Convert direction/magnitude to scroll_x/scroll_y with correct sign for up/down/left/right.
    • Default direction to "down" and magnitude to 800; handle missing or non-numeric values.
    • Remove unsupported-direction errors; unknown directions fall back to scrolling down.

Written for commit 59ef7cb. Summary will update on new commits.

…ogleCUAClient

Previously, GoogleCUAClient._process_provider_response was passing the raw direction and magnitude fields from Google CUA's scroll_at function call directly into the ScrollAction payload. This caused Pydantic validation errors because ScrollAction expects scroll_x and scroll_y fields instead.

This change:
- Safely extracts direction and magnitude with defaults (down, 800)
- Converts direction/magnitude to scroll_x/scroll_y values
- Handles all four directions (up, down, left, right) with proper sign
- Gracefully handles missing or non-numeric magnitude values
- Removes the unsupported direction error path

The fix now correctly produces ScrollAction payloads that validate and execute properly when scrolling in the browser.
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant