Skip to content

The agent that grows with you

fix(browser): don't migrate Camofox users to Browser Use CLI mode

Tekniumf21d9714e872
diff --git a/tests/tools/test_browser_use_cli.py b/tests/tools/test_browser_use_cli.py
index a0167f3b74b..66af3008a6a 100644
--- a/tests/tools/test_browser_use_cli.py
+++ b/tests/tools/test_browser_use_cli.py
@@ -162,6 +162,18 @@ class TestLegacyCloudMigration:
monkeypatch.setattr("hermes_cli.config.read_raw_config", lambda: self._LEGACY)
assert bu_cli.is_browser_use_cli_mode() is False
+ def test_camofox_user_does_not_migrate(self, monkeypatch):
+ """A Camofox user (env-var selected, cloud_provider unset) with a
+ stray BROWSER_USE_API_KEY keeps Camofox — no silent mode flip."""
+ monkeypatch.setattr(
+ "hermes_cli.config.read_raw_config", lambda: {"browser": {}}
+ )
+ monkeypatch.setenv("BROWSER_USE_API_KEY", "bu-key")
+ import tools.browser_camofox as camofox
+
+ monkeypatch.setattr(camofox, "is_camofox_mode", lambda: True)
+ assert bu_cli.is_browser_use_cli_mode() is False
+
def test_explicit_other_backend_wins(self, monkeypatch):
monkeypatch.setattr(
"hermes_cli.config.read_raw_config",
diff --git a/tools/browser_use_cli.py b/tools/browser_use_cli.py
index ddc241f222c..5dab679ccaf 100644
--- a/tools/browser_use_cli.py
+++ b/tools/browser_use_cli.py
@@ -83,6 +83,15 @@ def is_legacy_browser_use_cloud_config(browser_cfg: dict) -> bool:
return False # explicit local/Browserbase/… choices win
if is_truthy_value(browser_cfg.get("use_gateway"), default=False):
return False
+ # Camofox is selected via env var, not cloud_provider — a Camofox user
+ # with a stray BROWSER_USE_API_KEY must keep their explicit choice.
+ try:
+ from tools.browser_camofox import is_camofox_mode
+
+ if is_camofox_mode():
+ return False
+ except Exception as e:
+ logger.debug("Camofox activity check failed during migration: %s", e)
return bool(os.getenv("BROWSER_USE_API_KEY"))