Open
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
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.
Description
Two fixes for the BrowserEnv CUA mode and a DX improvement for the DOM example:
Fix screenshot passing in CUA messages: Screenshots attached as
image_urlparts inside tool messages were being dropped by clients. The newenv_responseoverride inBrowserEnvrelocatesimage_urlparts out of tool messages into a trailingUserMessageso they are preserved. Also normalizes empty tool-callargumentsto"{}"to preventjson.loads("")decode failures on zero-arg tools (e.g.screenshot).Make
filter_screenshots_in_messagesrobust to mixed content types: Content parts can be plain dicts or Pydantic objects. Updated type checks inCUAModeto handle bothvia
_get_item_type()helper andgetattrfallback.DX improvement for DOM example: Made
project_idoptional inload_environment()— it now falls back to theBROWSERBASE_PROJECT_IDenv var at runtime. Removed theupfront env-var validation that eagerly errored before the environment was even used.
Type of Change
Testing
uv run pytestlocally.Checklist
Additional Notes
Files changed:
environments/browser_dom_example/browser_dom_example.py— makeproject_idoptional, remove eager env-var checkverifiers/envs/integrations/browser_env/browser_env.py— newenv_responseoverride: sanitize empty tool args + relocate screenshots from tool messages to user messagesverifiers/envs/integrations/browser_env/modes/cua_mode.py— handle dict and Pydantic content parts infilter_screenshots_in_messagesNote
Medium Risk
Touches
BrowserEnv.env_responsemessage post-processing in CUA mode, which can affect how tool outputs and multimodal context are presented to models; changes are targeted and covered by new tests but impact core browser-agent I/O.Overview
Fixes CUA-mode message post-processing so screenshots and tool calls survive provider/adaptor quirks.
BrowserEnv.env_responsenow (1) normalizes emptytool_call.argumentsto{}for zero-arg tools and (2) extractsimage_urlparts fromToolMessagecontent and appends them as a trailingUserMessage, leaving non-image tool content intact.Hardens screenshot filtering and improves example DX.
CUAMode.filter_screenshots_in_messagesnow handles content parts that are dicts or Pydantic objects, and the DOM example’sload_environment()makesproject_idoptional while removing eager env-var validation. New tests cover the CUAenv_responserelocation behavior and the no-images case.Written by Cursor Bugbot for commit fa40f0b. This will update automatically on new commits. Configure here.