{{ message }}
Fix page crash auto-recovery: detect tab crashes via CDP, reload page, inform LLM#5068
Open
Sarthak816 wants to merge 19 commits into
Open
Fix page crash auto-recovery: detect tab crashes via CDP, reload page, inform LLM#5068Sarthak816 wants to merge 19 commits into
Sarthak816 wants to merge 19 commits into
Conversation
…dling Filter out top-level Ollama API parameters (format, stream) from ollama_options since they should be passed as top-level arguments to client.chat(), not as model options. This fixes cases where users pass format in ollama_options which is silently ignored. Add _clean_options() method to strip these params and log a warning. Handle pydantic ValidationError separately with a clearer message that hints at truncated JSON issues with vision models. Fixes browser-use#5017
Add a warning when the beta Agent SDK agent completes without producing a result and without an error. This helps users debug issues where the LLM failed to respond (e.g., missing or invalid BROWSER_USE_API_KEY, unsupported model name, or network errors). Previously the agent silently returned None with no indication of what went wrong, making it very difficult to diagnose initial setup failures. Fixes browser-use#5025
Instead of adding the entire virtualenv bin directory ($HOME/.browser-use-env/bin) to the user's PATH, create individual wrapper scripts in ~/.local/bin for each CLI command (browser-use, bu, browseruse, browser, browser-use-tui). This prevents the venv's Python and other executables from shadowing the user's system Python, while still making the CLI commands available. Fixes browser-use#5033
Contributor
There was a problem hiding this comment.
5 issues found across 8 files
Tip: instead of fixing issues one by one fix them all with cubic
Re-trigger cubic
…ery returns False for unknown URLs, Ollama format/stream forwarding, .exe wrapper mismatch, grep -qF for literal path matching
Contributor
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
…aming responses, forward stream param in output_format branch
… targetCrashed callback
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
Fixes issue #5067 — when a browser page/tab crashes (e.g., due to memory exhaustion, WebGL context loss, or renderer process crash), the agent now automatically detects the crash, reloads the page, and informs the LLM about the recovery.
Fix: Page crash detection and auto-recovery via CDP
Problem: When a page tab crashed, no CDP crash handler was registered. The SessionManager handled the resulting
detachedFromTargetevent and recovered focus to another/new tab, but the agent got a blank page with no explanation — leading to confusing "element not found" errors and eventual timeout.Fix: Three-layer solution:
Crash Detection (
session.py): Registered aTarget.targetCrashedCDP event handler on the root client. When the agent's focus tab crashes, the target ID and URL are captured before SessionManager clears focus.Auto-Recovery (
session.py): Addedcheck_and_recover_from_crash()method that waits for SessionManager to finish focus recovery, then navigates back to the crashed page's previous URL if the recovered tab is a blank/new-tab page.LLM Context (
agent/service.py): Injected anActionResultwithlong_term_memorybefore each step's context preparation, so the LLM sees "The previous page tab crashed and has been auto-recovered. The page has been reloaded." instead of confusing silent failures.Changes
browser_use/browser/session.py_crashed_target_ids,_crashed_target_urlprivate attrs; registeredtargetCrashedCDP handler; addedcheck_and_recover_from_crash()methodbrowser_use/agent/service.pystep()after captcha handling, injects crash context into LLM messagesSummary by cubic
Detects browser tab crashes via CDP, auto-reloads the previous URL, and tells the LLM about the recovery to avoid confusing failures. Also improves Windows startup stability,
ollamastream/format handling with clearer JSON errors, and installer behavior to avoid PATH shadowing.Bug Fixes
TargetCrashedEventto fix typing.Stability
httpxversion fetch, prevent proxy leakage inaiohttppolling, fixTCPConnectorreuse, and disable GPU in Windows headless to avoid renderer crashes.ollama: strip and forward top-level params (format,stream) correctly, supportstream=Trueasync generator responses and forwardstreamwhen usingoutput_format, allow overriding schema withChatOllama.format, and provide clearer JSON validation errors.~/.local/bin(and.cmdon Windows); fix Windows.exedetection,.cmdpath separators, heredoc$@, and literal PATH checks.BROWSER_USE_API_KEYor invalid model names).Written for commit 24fd671. Summary will update on new commits.