Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.

Fix Gemini 3.5 Flash Computer Use: real scroll/keys + one-tap Phone CU mode - #1

Closed
jackspiece wants to merge 1 commit into
mainfrom
viktor/cu-hardening
Closed

jackspiece wants to merge 1 commit into
mainfrom
viktor/cu-hardening

Conversation

@jackspiece

Copy link
Copy Markdown
Owner

What & why

The phone/browser agent felt "dumb" and couldn't scroll at all. Root cause: the Computer Use handlers were written for the legacy Gemini 2.5 action names, but the app runs Gemini 3.5 Flash, whose mobile/browser environments emit a different action set. The real actions (scroll, press_key, etc.) fell through to the "unsupported action" branch and were silently no-op'd.

Engine fixes (Kotlin)

  • scroll handler added (params y, x, direction, magnitude_in_pixels) — this is the core scroll fix.
  • press_key + merged key_combination/hotkey (keys as List or String) + normalizeHotKey().
  • list_apps handler (returns installed apps to the model).
  • drag_and_drop now reads start_x/start_y/end_x/end_y (legacy x/destination_* fallback).
  • open_app resolves app name to package via resolvePackageName.
  • ScrollAction duration 1.5s -> 0.3s (1.5s slow drag was read as long-press drag, not a fling -> "barely scrolls"); drag keeps 1.0s.
  • Rewrote the mobile system prompt (0-999 grid, verify screen changed, scroll to reveal content, prefer open_app/list_apps, tap before type, stop when done).
  • GEMINI_COMPUTER_USE_MAX_STEPS 30 -> 60.
  • Same scroll/press_key fixes mirrored in BrowserToolHandler.

UI (Flutter)

  • One-tap "Phone Computer Use" card in Scene Model settings: binds Operation + Agent scenes to gemini-3.5-flash on a Gemini provider profile (auto-enables native Computer Use + high reasoning), with an Active/Off indicator and a guard dialog if no Gemini key is set.

Testing

  • Static review + brace/paren balance pass. Needs an on-device smoke test (flash debug APK, run a scroll/tap task).

…U mode

The mobile & browser Computer Use handlers were coded for the LEGACY
Gemini 2.5 action names. Gemini 3.5 Flash's mobile/browser environments
emit a different, streamlined action set, so the actual actions the model
sent fell through to the "unsupported action" branch and were silently
no-op'd. That is why the agent literally could not scroll and keypresses
did nothing.

Engine (Kotlin):
- VLMOperationService: add `scroll` (y,x,direction,magnitude_in_pixels),
  `press_key` (key), `list_apps`, and fix `drag_and_drop` to read
  start_x/start_y/end_x/end_y (with legacy x/destination_* fallback).
  Merge key_combination/hotkey (keys may be List or String) and add a
  normalizeHotKey() mapper. open_app now resolves app name -> package.
- BrowserToolHandler: add `scroll` + left/right directions + press_key/
  hotkey alongside the legacy names.
- ScrollAction default duration 1.5s -> 0.3s (1.5s slow drag was read as a
  long-press drag, not a fling -> "barely scrolls"); VLMClient fallback too.
  drag_and_drop keeps an explicit 1.0s.
- Rewrote the mobile system prompt (0-999 grid, verify screen changed,
  scroll to reveal content, prefer open_app/list_apps, tap field before
  type, be decisive, stop when done).
- GEMINI_COMPUTER_USE_MAX_STEPS 30 -> 60 for longer tasks.

UI (Flutter):
- Scene model settings: one-tap "Phone Computer Use" card that binds the
  Operation + Agent scenes to gemini-3.5-flash on a Gemini provider
  profile (auto-enabling native Computer Use + high-reasoning), with an
  Active/Off status indicator and a guard dialog if no Gemini key is set.
@jackspiece

Copy link
Copy Markdown
Owner Author

Closing this inactive experiment because I am narrowing my public contribution work to maintained upstream areas. The branch remains available.

@jackspiece jackspiece closed this Jul 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant