…ates natively
Hermes' _OWN_TAB_PREAMBLE (NousResearch#86924) pinned named browser_exec sessions to
their own tab because the stock harness attached named daemons to the
first shared page. One day later, browser-harness 0.1.9 shipped native
named-daemon tab isolation (browser-use/browser-harness#618), so with
current releases both layers run: the harness creates its dedicated tab
and the preamble creates a second target — a redundant Chrome renderer
(~8-11 cgroup tasks) per named session, accelerating PID-cgroup
exhaustion under parallel sessions (NousResearch#91522).
Detect harness >= 0.1.9 inside the preamble (leading-numeric version
parse of importlib.metadata) and return before creating any target.
Pre-0.1.9 harnesses keep the compatibility pin; unresolvable versions
fall back to the pin; private provider browsers keep skipping the
preamble entirely.
What does this PR do?
Stops
browser_execfrom creating a redundant second tab for every named session on currentbrowser-harnessreleases. Hermes'_OWN_TAB_PREAMBLE(#86924) pinned named sessions to their own tab because the stock harness attached named daemons to the first shared page; one day later browser-harness 0.1.9 shipped native named-daemon tab isolation (browser-use/browser-harness#618). With both layers active, the harness creates its dedicated tab AND the preamble creates a second target — one extra Chrome renderer (~8-11 Linux cgroup tasks) per named session, materially accelerating PID-cgroup exhaustion under parallel sessions (#91522).The fix detects harness ≥ 0.1.9 inside the preamble itself (leading-numeric parse of
importlib.metadata.version("browser-harness")) and returns before creating any target. The check lives in the preamble rather than in Hermes because the browser-harness package is installed in the CLI's environment, not necessarily in the gateway process. Pre-0.1.9 harnesses keep the compatibility pin; an unresolvable version falls back to the pin (pre-fix behavior is safe); private provider browsers keep skipping the preamble entirely, as before.Related Issue
Fixes #91522
Type of Change
Changes Made
tools/browser_use_cli.py: Add_NATIVE_TAB_ISOLATION_SINCE = (0, 1, 9)(with a comment tying it to the embedded gate) and the_parse_version_prefixhelper documenting the leading-numeric parse algorithm. Embed the version gate at the top of_OWN_TAB_PREAMBLE::_hermes_ensure_own_tab: on harness ≥ 0.1.9, return before anyTarget.createTarget; on parse failure, fall through to the pin.tests/tools/test_browser_use_cli.py: InTestOwnTabPreamble, addtest_preamble_stands_down_on_native_tab_isolation(AST structural assertion: the gate's return precedes the createTarget call, and the embedded threshold matches the module constant) andtest_version_prefix_parser(pure parser coverage:0.1.9rc1→ gate,0.1.8→ no gate, short/pre-release forms).How to Test
browser_execsession against a shared CDP Chrome and diffhttp://127.0.0.1:9222/json/listbefore/aftertest_version_prefix_parserasserts0.1.8 < threshold)scripts/run_tests.sh tests/tools/test_browser_use_cli.py -q→ should pass except the pre-existing environment-dependent timeout test (Observed result: 93 passed, 1 failed —test_timeout_returns_actionable_errorfails identically on unpatched main)Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass