Avoid indexing response.choices[0] when proxies return choices=null/empty; raise a clear ModelProviderError (with base_url hint) and use the validated first choice for content/finish_reason
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds a menu-aware retry to agent reruns: if a menu item can’t be
matched, the agent re-opens the dropdown and retries quickly. This
reduces flaky failures in multi-level dropdown flows.
- **Bug Fixes**
- Detects menu openers (aria-haspopup, toggleSubMenu, expand-button,
role with aria-expanded).
- Detects menu items (menuitem roles, gw-action--inner, menu-related
classes, stable ax_name).
- Re-executes the opener step with a short delay and retries without
consuming a retry attempt.
- Improves logging and preserves existing backoff behavior.
- Adds unit tests for opener/item detection.
<sup>Written for commit 147db04c1c.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Added an Environment Variables section to the Agent parameters docs that
lists all timeout env vars with defaults and clear descriptions, plus
example usage. This lets users tune agent and browser behavior and
troubleshoot slow networks or complex pages without code changes.
<sup>Written for commit b71894b97b.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Made the Agent event bus stop timeout configurable via the
TIMEOUT_AgentEventBusStop env var (default 3s) to let tests and
deployments tune shutdown wait time. This connects to Linear 3076 by
allowing environments to adjust the idle wait instead of using a fixed
value.
<sup>Written for commit 9c042d7d98.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
Auto-generated PR for branch: fix-scroll-action
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Unifies scrolling terminology and simplifies guidance to reduce
over-scrolling and clarify browser state output.
>
> - Rename `SCROLL`/"scroll containers" to `scroll element` across DOM
serialization (`serializer.py`), system/code prompts, and `ScrollAction`
docs/descriptions (`service.py`, `views.py`)
> - Simplify page info in `prompts.py`: output `<page_info>` as `X
above, Y below`; drop total pages; prepend `[Start of page]` only when
no content above
> - Streamline `<page_stats>`: remove scroll container count from
summary text; minor formatting/whitespace fixes across prompts
> - Update code-use/system prompts to reflect new marker `|scroll
element|` and tidy guidance/examples
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
6bccc224ca. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Standardize “scroll element” terminology and reduce over-priming about
scrolling to prevent unnecessary scroll actions and improve clarity in
browser state output.
- **Refactors**
- Renamed “SCROLL”/“scroll containers” to “scroll element” in DOM
serialization, tool docs, and code-use prompt.
- Trimmed scrolling guidance in system prompts (removed offscreen scroll
advice and pages=10 chaining examples).
- Simplified browser state: removed scroll_containers from stats; page
info now “X above, Y below”; only add “[Start of page]” when there’s no
content above.
- Minor phrasing and whitespace fixes across prompts.
<sup>Written for commit 6bccc224ca.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
This PR upgrades the Recording Watchdog to listen for
`AgentFocusChangedEvent`. This change ensures that when the agent
switches tabs, the video recording follows the agent's view, thus
supporting multi-tab tasks. Additionally, the video recorder currently
spawns a new ffmpeg subprocess for every single frame, which creates
massive overhead due to process initialization and I/O piping. This was
an attempt to avoid using the PIL dependency, but ended up not being
worth it. This PR fixes that by using Pillow to handle resizing and
padding in-memory before passing the numpy array to the video writer,
which is significantly faster and CPU-friendly.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Enable multi-tab video recording by switching the screencast to the
focused tab. Speed up frame processing by using Pillow for in-memory
resize and padding instead of spawning ffmpeg per frame.
- **New Features**
- Listen for AgentFocusChangedEvent and switch screencast to the focused
target/session.
- Stop screencast on the previous session and ignore stale frames to
avoid race conditions.
- **Performance**
- Replace per-frame ffmpeg subprocess with PIL-based resize/padding and
direct numpy writes via imageio.
- Reduce CPU overhead and I/O; use BICUBIC resize and apply black
padding only when needed.
<sup>Written for commit d9943a0246.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Enables recording to follow the focused tab and streamlines frame
processing for better performance and reliability.
>
> - **Multi-tab recording**: Listen to `AgentFocusChangedEvent`, switch
screencast to the focused session via `_start_screencast`, stop previous
session, and ignore stale frames in `on_screencastFrame`.
> - **Session management**: Track `_current_session_id` and cache
`_screencast_params`; reset state on stop.
> - **Performance**: In `video_recorder.py`, replace per-frame `ffmpeg`
subprocess with Pillow-based in-memory resize/padding and direct NumPy
writes to `imageio`; remove `imageio_ffmpeg`/`subprocess` usage.
> - **Compatibility**: Pre-pad to macro-block size and set writer
`pixelformat='yuv420p'` with `macro_block_size=None`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
d9943a0246. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds AX_NAME (accessible name) fallback to history rerun element
matching to reduce failures on dynamic pages. Improves reliability when
hashes or XPath change, especially in SPAs and menu UIs.
- **New Features**
- Added Level 4 AX_NAME matching before ATTRIBUTE in the fallback order:
EXACT → STABLE → XPATH → AX_NAME → ATTRIBUTE.
- AX_NAME matching requires the same node type; logs available ax_names
when no match is found.
- Updated MatchLevel enum to include AX_NAME=4 and ATTRIBUTE=5.
- Added CI tests covering success cases, node-type constraints, and
matching order.
- Tweaked example rerun timing (max_step_interval=20,
delay_between_actions=1).
- **Bug Fixes**
- Corrected match-level reporting to use ATTRIBUTE for attribute-based
matches.
<sup>Written for commit 2c06eabf5f.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Add a warning to the Browser recording docs that video capture requires
optional dependencies, with install commands: pip install
"browser-use[video]" or pip install imageio[ffmpeg] numpy. Addresses
Linear 3803 by adding the missing dependency install alert to the
recording section.
<sup>Written for commit 4c151c214c.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Fixed broken links in the docs to restore navigation and remove 404s.
Addresses Linear 3836.
- **Bug Fixes**
- Agent basics: updated Supported Models link to /supported-models.
- CodeAgent basics: linked ChatBrowserUse to /supported-models and
updated API key URL to https://cloud.browser-use.com/new-api-key.
- MCP server: replaced v2 API Reference link with
https://docs.cloud.browser-use.com.
<sup>Written for commit 75b5a0dffd.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
## Background
The page.py file in the browser_use/actor directory was using a print
statement for debugging purposes, which is inconsistent with the
project's logging strategy. The project already has a centralized
logging system using Python's logging module, configured through
browser_use/logging_config.py .
## Changes
1. File Modified : browser_use/actor/page.py
2. Change : Replaced the debug print statement on line 134 with a
logger.debug call
3. Logger Used : The existing logger imported from browser_use
4. Log Level : debug (matching the original debug print intent)
## Benefits
- Unified Logging : Aligns with the project's existing logging system
- Flexible Configuration : Debug logs can be easily enabled/disabled via
environment variables or code configuration
- Better Context : Logs include component name and timestamp when
configured
- Structured Output : Consistent log format across the project
- Reduced Console Clutter : Users can control log verbosity based on
their needs
- Improved Debugging : Better integration with logging tools and
services
## Impact
- No Breaking Changes : This is a refactoring change that preserves
functionality
- Minimal Scope : Only affects one debug statement in a single file
- Backward Compatible : Existing functionality remains unchanged
## Testing
- ✅ Python syntax check passed ( python -m py_compile
browser_use/actor/page.py )
- ✅ No other print statements left in the file (verified via grep )
- ✅ Uses existing project logger (no new dependencies)
- ✅ Log level appropriately set to debug for debugging purposes
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Switched the debug print in browser_use/actor/page.py to logger.debug to
align with the project’s logging system. This keeps behavior the same
while providing structured logs and configurable verbosity.
<sup>Written for commit 6b77410683.
Summary will update automatically on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds exponential backoff retries to rerun_history and an opt-in wait for
a minimum number of DOM elements before actions that need element
matching. This improves reliability on dynamic/SPAs and avoids tight
retry loops.
- **New Features**
- Exponential backoff for step retries: 5s base, doubles each retry,
capped at 30s.
- Optional wait_for_elements: waits for a minimum element count before
click/input/hover/select/drag; count inferred from action indices
(capped at 50), with polling and timeout.
- Continues with the last known state if the minimum isn’t reached
within the timeout.
<sup>Written for commit 1073fc9e7a.
Summary will update automatically on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Add Azure OpenAI Responses API support with auto-detection and
structured output, so Codex and computer-use-preview models work with
api_version 2025-03-01-preview. Addresses Linear 3771.
- **New Features**
- Route ainvoke to Responses API when use_responses_api is True or
'auto' for supported models; fallback to Chat Completions otherwise.
- Added ResponsesAPIMessageSerializer to convert existing message types
(text, images, assistant) to Responses API input.
- Structured output via text.format + JSON schema, with optional schema
injection into the system prompt and support for
dont_force_structured_output.
- Usage mapping and robust error handling (rate limits,
connection/status errors). Updated docs, example, and tests.
- **Migration**
- For Codex/computer-use models, set api_version to 2025-03-01-preview;
'auto' will use Responses API.
- Override behavior with use_responses_api = True/False/'auto`.
<sup>Written for commit 2f6a18a64e.
Summary will update automatically on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Skips redundant retry steps during history reruns when the previous step
already succeeded on the same element and action. This avoids replay
failures after navigation and speeds up reruns.
- **New Features**
- Detect redundant retries by matching element (hash/stable_hash/xpath)
and action type.
- Track previous step success and skip the duplicate, adding a “Skipped
- redundant retry of previous step” result.
- Added tests for rerun behavior and the detection helper.
<sup>Written for commit bb13679f85.
Summary will update automatically on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
Fixes#3786.
When using the Gemini API (via LiteLLM or directly), the request fails
with a `BadRequestError`. This is because Gemini's API strictly enforces
that any parameter defined as `type: OBJECT` in the `response_schema`
must have a non-empty `properties` map.
The `go_back` action (and others using `NoParamsAction`) previously
generated an empty object schema (`{"type": "object", "properties":
{}}`), causing this validation failure.
**Error Message:**
> `GeminiException BadRequestError - *
GenerateContentRequest.generation_config.response_schema.properties["action"].items.any_of[3].properties["go_back"].properties:
should be non-empty for OBJECT type`
## Changes
- Modified `NoParamsAction` in `browser_use/tools/service.py` to include
an optional `description` field.
- This ensures Pydantic generates a valid schema (e.g., `{"properties":
{"description": {"type": "string"}}}`) instead of an empty one.
- The new field is optional (`None` by default) and is explicitly
ignored by the action logic (`_`), ensuring no side effects on existing
functionality.
- Verified that `NoParamsAction.model_json_schema()` now produces a
schema with properties, satisfying the Gemini API requirement.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Prevent Gemini BadRequestError by ensuring actions with no params
produce a non-empty object schema. Adds an optional description field to
NoParamsAction so Pydantic includes properties in the response_schema.
- **Bug Fixes**
- Added description: str | None = Field(None, ...) to NoParamsAction in
browser_use/tools/views.py to satisfy Gemini’s OBJECT-type schema
requirement.
- Field is optional and ignored by action logic, so behavior remains
unchanged.
<sup>Written for commit bd6c1d76e2.
Summary will update automatically on new commits.</sup>
<!-- End of auto-generated description by cubic. -->