fix(browser): keep local Chromium headless on Windows Desktop (#64867) - #66523
fix(browser): keep local Chromium headless on Windows Desktop (#64867)#66523stantheman0128 wants to merge 2 commits into
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating both the local Chromium and Desktop title-resolution paths. The title-window hardening targets a current-main path: apps/desktop/electron/link-title-window.ts:6-20 still creates a 1280x800 hidden window with no off-screen or focus/taskbar guards.
Problems
tools/browser_tool.py:146in this PR conflicts with current main's headed-browser contract. Commit29899c2aaadded_is_headed_mode()(tools/browser_tool.py:892-919) and appends--headedfor localbrowser.headed: truesessions (tools/browser_tool.py:2384-2387). The new guard only examinesbrowser_env, so config-driven headed mode is not recognized and the PR adds a contradictory--headed false.
Suggested changes
- Use
_is_headed_mode()as the authoritative opt-out before injecting headless flags, and add a regression test coveringbrowser.headed: truewith no forced false flag. Current coverage for that contract is intests/tools/test_browser_headed_mode.py:40-64and:195-224.
Automated hermes-sweeper review.
| 1. ``~/.agent-browser/config.json`` (or ``AGENT_BROWSER_HEADED``) enables | ||
| headed mode without Hermes knowing about it, or | ||
| 2. Chrome's ``--headless=new`` paints a ghost HWND on some Windows hosts. | ||
|
|
There was a problem hiding this comment.
Current main now supports browser.headed: true through _is_headed_mode() and adds --headed before this point (commit 29899c2aa). That config value is not represented in browser_env, so this branch adds a contradictory --headed false. Consult _is_headed_mode() here and preserve explicit config-driven headed mode.
1e52608 to
cfc5004
Compare
|
Thanks for the catch on the headed-mode contract. Pushed a follow-up on this branch (rebased onto current main):
Evidence: Commit: cfc5004a1 |
Force --headed false for local agent-browser sessions and park any Windows --headless=new ghost HWND off-screen. Also harden the Desktop link-title BrowserWindow so bot-walled URLs cannot flash a blank frame over chat during browser tool turns (NousResearch#64867). Co-authored-by: Cursor <cursoragent@cursor.com>
Use the shared headed-mode resolver (config browser.headed / AGENT_BROWSER_HEADED) as the opt-out before injecting --headed false, so config-driven headed sessions are not contradicted. Add regression coverage for headed:true without a forced false. Co-authored-by: Cursor <cursoragent@cursor.com>
3c08910 to
cfc5004
Compare
SummaryOne PR addresses #64867. Its diff covers both proposed window paths by forcing local Chromium headless unless headed mode is explicitly enabled, parking possible Windows ghost windows off-screen, and hardening Desktop’s hidden link-title BrowserWindow; the supplied evidence does not determine which path produced the reported window. Related pull requests
Suggested consolidationKeep #66523 open with a salvage path: retain the current-main link-title-window hardening and the revised browser guards that preserve explicit headed mode, then verify the current PR head and test the original Windows Desktop reproduction to determine whether both guarded paths are needed. There are no duplicate PRs to close. Complex graphflowchart LR
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
I64867(["issue #64867 (open)"])
P66523["PR #66523 (open)"]
P66523 -->|best fix| I64867
class I64867 open
class P66523 open
class P66523 best
class P66523 target
click I64867 "https://github.com/NousResearch/hermes-agent/issues/64867"
click P66523 "https://github.com/NousResearch/hermes-agent/pull/66523"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label). Cross-PR triage: Reviewed 1 pull request and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 18 kB of PR diffs, 7 kB of issue/PR text, 2 kB of discussion (2 comments), 2 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
Supplementary reproduction (Windows 11, hermes.exe launcher + browser-use CLI via uvx)We fully reproduced the "local mode auto-launch of the browser fails" problem on Windows 11 (build 10.0.26200), and located the behaviour. Posting for upstream reference.
SymptomAfter the PYTHONPATH crash was fixed, Current behaviour (verified against current source)
Meanwhile
What we actually observed on Windows 11
Workaround we use (verified)Configure Suggestions for upstream
Our local code changes (for reference only, not a PR)In
These are only a fallback for local mode; what actually bypassed the launch defect for us was the |
fix(browser): keep local Chromium headless on Windows Desktop (#64867) Force
|
What does this PR do?
Local browser automation is documented as headless Chromium via agent-browser, but on Windows Desktop a large blank top-level window can still appear while
browser_navigateruns (and sometimes around nearby tool activity). Automation still succeeds; the window just obscures the chat.Two cooperating causes:
agent-browsercan inherit headed mode from user/project config (AGENT_BROWSER_HEADED/agent-browser.json), and Chrome's--headless=newhas historically painted a blank HWND on some Windows hosts.BrowserWindowwhen curl cannot read a title (common for bot-walled sites like GitHub, the issue's repro URL). Ashow: falseleak there looks like a blank framed window over the chat.This PR forces local sessions to
--headed false(unless the operator explicitly setsAGENT_BROWSER_HEADED), parks any Windows ghost HWND off-screen viaAGENT_BROWSER_ARGS, and hardens the link-title window (off-screen bounds,skipTaskbar,focusable: false, hide + opacity 0).Related Issue
Fixes #64867
Type of Change
Changes Made
tools/browser_tool.py:_apply_local_browser_visibility_guardsfor local Chromium; insert--headed false; on Windows append--window-position=-2400,-2400apps/desktop/electron/link-title-window.ts: off-screen + non-focusable hidden title-fetch windowtests/tools/test_browser_windows_blank_window.py: unit coverage for the guards and Popen argvapps/desktop/electron/link-title-window.test.ts: options + hide/opacity regression coverageHow to Test
browser_navigatetohttps://github.com/NousResearch/hermes-agent.AGENT_BROWSER_HEADED=1, headed mode still works (guards skip).Checklist
Code
Documentation & Housekeeping
AI assistance
Drafted with Cursor/Grok assistance. Human author: Stan Shih (stantheman0128). Reviewed and verified on Windows before opening.
Evidence
scripts/run_tests.shwas also attempted; on this Windows host the stockenv -ipath dropsUSERPROFILE, which breaksPath.home()during hermes imports. Targeted pytest above uses the same test file the runner would execute.