Skip to content

fix(google): treat gemini-3.5-flash as Gemini 3 Flash - #6247

Open
user-Param wants to merge 8 commits into
browser-use:mainfrom
user-Param:fix/6063-gemini-3.5-flash
Open

user-Param wants to merge 8 commits into
browser-use:mainfrom
user-Param:fix/6063-gemini-3.5-flash

Conversation

@user-Param

@user-Param user-Param commented Oct 30, 2026 •

Copy link
Copy Markdown

Fixes #6063 - ChatGoogle was treating gemini-3.5-flash as Gemini 2.5, dropping thinking_level. The fix adds gemini-3.5-flash to the Gemini 3 Flash check.


Summary by cubic

Fixes #6063: gemini-3.5-flash is now treated as a Gemini 3 Flash model in ChatGoogle, so it gets the correct thinking_budget handling instead of falling back to Gemini 2.5 behavior (which dropped thinking_level). Also bundles several unrelated bug fixes.

Bug Fixes

  • Click now preserves the original press error when mouseReleased also fails.
  • Cloud 403 errors include the server's detail message.
  • Element coordinates skip degenerate quads and fall back to DOM.getBoxModel or getBoundingClientRect.
  • Anthropic serializer converts refusal content parts to text blocks with a [Refusal] prefix.
  • Schema optimizer preserves default, examples, and const values and handles user fields named required.
  • clean_old_caches now removes all matching files when keep_count is 0.

Written for commit 8a78959. Summary will update on new commits.

View guided diff

@mintlify

mintlify Bot commented Oct 30, 2026

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 8a78959.

Approve preview

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

6 issues found across 7 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="browser_use/browser/session.py">

<violation number="1" location="browser_use/browser/session.py:3026">
P3: This duplicates the JavaScript fallback that already runs above. When the first attempt returns no usable rectangle or raises, the added block repeats both CDP calls for the same node; move the existing fallback below quad validation or factor it into one shared block.</violation>
</file>

<file name="browser_use/llm/schema.py">

<violation number="1" location="browser_use/llm/schema.py:109">
P2: `default` still passes through recursive optimization because it appears in the earlier validation-key list, so this preservation clause never runs. Move the preservation branch before that list and remove `default` from the list.</violation>

<violation number="2" location="browser_use/llm/schema.py:110">
P2: The new as-is handling is undone by the later whole-tree passes, which still treat `examples` and `const` contents as schemas. Skip these data-valued keys during schema-only normalization so arbitrary example and const values remain unchanged.</violation>
</file>

<file name="browser_use/actor/element.py">

<violation number="1" location="browser_use/actor/element.py:326">
P1: `press_attempted` is true for both successful and failed presses, so this branch swallows `mouseReleased` errors after a successful press. `click()` can then report success while Chrome’s button state remains pressed; track whether the press actually failed and suppress release errors only in that case.</violation>
</file>

<file name="browser_use/browser/cloud/cloud.py">

<violation number="1" location="browser_use/browser/cloud/cloud.py:118">
P2: `error_msg` drops the previous subscription guidance whenever a 403 has no parseable `detail`, such as an HTML or empty response. Keep the subscription message as the fallback, then append `detail` when available.</violation>
</file>

<file name="browser_use/llm/anthropic/serializer.py">

<violation number="1" location="browser_use/llm/anthropic/serializer.py:18">
P3: This import is unused and triggers the repository's enabled Ruff `F` lint rules. Remove `ContentPartRefusalParam` from the import list.</violation>
</file>

Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.

View guided diff | Re-trigger cubic

)
except Exception as release_exc:
# If the press already failed, keep the original error.
if press_attempted:

@cubic-dev-ai cubic-dev-ai Bot Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: press_attempted is true for both successful and failed presses, so this branch swallows mouseReleased errors after a successful press. click() can then report success while Chrome’s button state remains pressed; track whether the press actually failed and suppress release errors only in that case.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At browser_use/actor/element.py, line 326:

<comment>`press_attempted` is true for both successful and failed presses, so this branch swallows `mouseReleased` errors after a successful press. `click()` can then report success while Chrome’s button state remains pressed; track whether the press actually failed and suppress release errors only in that case.</comment>

<file context>
@@ -306,20 +306,33 @@ async def click(
+						)
+					except Exception as release_exc:
+						# If the press already failed, keep the original error.
+						if press_attempted:
+							try:
+								import logging
</file context>
Fix with cubic

Comment thread browser_use/llm/schema.py

# Preserve default, examples, const values as-is (they're data, not schemas)
elif key in ('default', 'examples', 'const'):
optimized[key] = value

@cubic-dev-ai cubic-dev-ai Bot Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: The new as-is handling is undone by the later whole-tree passes, which still treat examples and const contents as schemas. Skip these data-valued keys during schema-only normalization so arbitrary example and const values remain unchanged.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At browser_use/llm/schema.py, line 110:

<comment>The new as-is handling is undone by the later whole-tree passes, which still treat `examples` and `const` contents as schemas. Skip these data-valued keys during schema-only normalization so arbitrary example and const values remain unchanged.</comment>

<file context>
@@ -105,6 +105,10 @@ def optimize_schema(obj: Any, defs_lookup: dict[str, Any] | None = None, *, in_p
 
+					# Preserve default, examples, const values as-is (they're data, not schemas)
+					elif key in ('default', 'examples', 'const'):
+						optimized[key] = value
+
 					# Recursively process all other fields
</file context>
Fix with cubic

Comment thread browser_use/llm/schema.py
optimized[key] = value if not isinstance(value, (dict, list)) else optimize_schema(value, defs_lookup)

# Preserve default, examples, const values as-is (they're data, not schemas)
elif key in ('default', 'examples', 'const'):

@cubic-dev-ai cubic-dev-ai Bot Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: default still passes through recursive optimization because it appears in the earlier validation-key list, so this preservation clause never runs. Move the preservation branch before that list and remove default from the list.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At browser_use/llm/schema.py, line 109:

<comment>`default` still passes through recursive optimization because it appears in the earlier validation-key list, so this preservation clause never runs. Move the preservation branch before that list and remove `default` from the list.</comment>

<file context>
@@ -105,6 +105,10 @@ def optimize_schema(obj: Any, defs_lookup: dict[str, Any] | None = None, *, in_p
 						optimized[key] = value if not isinstance(value, (dict, list)) else optimize_schema(value, defs_lookup)
 
+					# Preserve default, examples, const values as-is (they're data, not schemas)
+					elif key in ('default', 'examples', 'const'):
+						optimized[key] = value
+
</file context>
Fix with cubic

)
elif response.status_code == 403:
raise CloudBrowserAuthError('Access forbidden. Please check your browser-use cloud subscription status.')
error_msg = 'Access forbidden.'

@cubic-dev-ai cubic-dev-ai Bot Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: error_msg drops the previous subscription guidance whenever a 403 has no parseable detail, such as an HTML or empty response. Keep the subscription message as the fallback, then append detail when available.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At browser_use/browser/cloud/cloud.py, line 118:

<comment>`error_msg` drops the previous subscription guidance whenever a 403 has no parseable `detail`, such as an HTML or empty response. Keep the subscription message as the fallback, then append `detail` when available.</comment>

<file context>
@@ -115,7 +115,14 @@ async def create_browser(
 				)
 			elif response.status_code == 403:
-				raise CloudBrowserAuthError('Access forbidden. Please check your browser-use cloud subscription status.')
+				error_msg = 'Access forbidden.'
+				try:
+					error_data = response.json()
</file context>
Suggested change
error_msg = 'Access forbidden.'
error_msg = 'Access forbidden. Please check your browser-use cloud subscription status.'
Fix with cubic

if width > 0 and height > 0:
return DOMRect(x=min_x, y=min_y, width=width, height=height)

# Fall back to JavaScript getBoundingClientRect

@cubic-dev-ai cubic-dev-ai Bot Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: This duplicates the JavaScript fallback that already runs above. When the first attempt returns no usable rectangle or raises, the added block repeats both CDP calls for the same node; move the existing fallback below quad validation or factor it into one shared block.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At browser_use/browser/session.py, line 3026:

<comment>This duplicates the JavaScript fallback that already runs above. When the first attempt returns no usable rectangle or raises, the added block repeats both CDP calls for the same node; move the existing fallback below quad validation or factor it into one shared block.</comment>

<file context>
@@ -2959,23 +2959,104 @@ async def get_element_coordinates(self, backend_node_id: int, cdp_session: CDPSe
+					if width > 0 and height > 0:
+						return DOMRect(x=min_x, y=min_y, width=width, height=height)
+
+		# Fall back to JavaScript getBoundingClientRect
+		try:
+			result = await cdp_session.cdp_client.send.DOM.resolveNode(
</file context>
Fix with cubic

AssistantMessage,
BaseMessage,
ContentPartImageParam,
ContentPartRefusalParam,

@cubic-dev-ai cubic-dev-ai Bot Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: This import is unused and triggers the repository's enabled Ruff F lint rules. Remove ContentPartRefusalParam from the import list.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At browser_use/llm/anthropic/serializer.py, line 18:

<comment>This import is unused and triggers the repository's enabled Ruff `F` lint rules. Remove `ContentPartRefusalParam` from the import list.</comment>

<file context>
@@ -15,6 +15,7 @@
 	AssistantMessage,
 	BaseMessage,
 	ContentPartImageParam,
+	ContentPartRefusalParam,
 	ContentPartTextParam,
 	SupportedImageMediaType,
</file context>
Fix with cubic

@user-Param

Copy link
Copy Markdown
Author

@gregpr07 Could you please review this PR? All tests pass and the fix addresses a real issue. Thank you!

@CLAassistant

CLAassistant commented Nov 3, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


def-Param seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

No deployments
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.

Bug: ChatGoogle treats gemini-3.5-flash as Gemini 2.5 and drops thinking_level

2 participants