Skip to content

The agent that grows with you

fix(migration): a Camofox home that disabled browsing keeps it off after the conversion

Tekniumc21711f9a346
diff --git a/hermes_cli/left_core_migration.py b/hermes_cli/left_core_migration.py
index 81a03f3b888..13e1a7b3984 100644
--- a/hermes_cli/left_core_migration.py
+++ b/hermes_cli/left_core_migration.py
@@ -482,7 +482,8 @@ def _mark(config: dict, key: str, feature: LeftCoreFeature) -> None:
def _turn_off_replaced(config: dict, feature: LeftCoreFeature) -> None:
"""Turn *feature*'s ``replaces_toolsets`` off in *config*: every saved platform list naming one names
the plugin's toolsets instead (so turning core's toolset back on later stays that platform's choice),
- and ``agent.disabled_toolsets`` takes them, which also covers platforms on a default composite."""
+ and ``agent.disabled_toolsets`` takes them, which also covers platforms on a default composite. One the
+ user had already disabled there disables the plugin's toolsets too (they are on by default)."""
from agent.skill_utils import parse_config_string_list
from hermes_cli.toolset_validation import parse_platform_toolsets_value
replaced = set(feature.replaces_toolsets)
@@ -494,7 +495,8 @@ def _turn_off_replaced(config: dict, feature: LeftCoreFeature) -> None:
saved[platform] = kept + [ts for ts in feature.toolsets if ts not in map(str, kept)]
agent = config.get("agent") if isinstance(config.get("agent"), dict) else {}
disabled = parse_config_string_list(agent.get("disabled_toolsets")) if agent.get("disabled_toolsets") else []
- agent["disabled_toolsets"] = [*disabled, *sorted(replaced - set(disabled))]
+ turned_off = replaced if replaced.isdisjoint(disabled) else replaced | set(feature.toolsets)
+ agent["disabled_toolsets"] = [*disabled, *sorted(turned_off - set(disabled))]
config["agent"] = agent
diff --git a/tests/hermes_cli/test_left_core_camofox.py b/tests/hermes_cli/test_left_core_camofox.py
index 8be28194fa1..7c057b9b8da 100644
--- a/tests/hermes_cli/test_left_core_camofox.py
+++ b/tests/hermes_cli/test_left_core_camofox.py
@@ -153,6 +153,23 @@ def test_browser_becomes_camofox_where_core_carried_it(tmp_path, monkeypatch):
assert "camofox" not in enabled and "browser" not in enabled, platform
+def test_globally_disabled_browsing_stays_off_after_the_conversion(tmp_path, monkeypatch):
+ """A Camofox home that had turned browsing off everywhere (``agent.disabled_toolsets: [browser]``): its
+ saved lists still become ``camofox``, but the plugin's toolset is disabled too, so browsing stays off."""
+ home = _home(tmp_path, env="CAMOFOX_URL=http://localhost:9377\n", config={
+ "_config_version": 51,
+ "platform_toolsets": {"cli": ["terminal", "browser", "file"]},
+ "agent": {"disabled_toolsets": ["browser"]},
+ })
+ assert lcm.migrate_home(home, install=_installer(home, []), say=lambda _m: None) == ["camofox"]
+ config = _config(home)
+ assert config["platform_toolsets"]["cli"] == ["terminal", "file", "camofox"]
+ assert set(config["agent"]["disabled_toolsets"]) == {"browser", "camofox"}
+ for platform in ("cli", "telegram"):
+ enabled = _resolved(home, platform, monkeypatch)
+ assert "camofox" not in enabled and "browser" not in enabled, platform
+
+
def test_conversion_is_never_undone(tmp_path):
home = _home(tmp_path, env="CAMOFOX_URL=http://localhost:9377\n",
config={"_config_version": 51, "platform_toolsets": {"cli": ["terminal", "browser"]}})
diff --git a/website/docs/user-guide/features/browser.md b/website/docs/user-guide/features/browser.md
index d2817915b0a..ca49958e731 100644
--- a/website/docs/user-guide/features/browser.md
+++ b/website/docs/user-guide/features/browser.md
@@ -603,7 +603,9 @@ hermes tools disable browser --platform telegram # one gateway platform
Camofox moved to a plugin: `hermes plugins install camofox`. Existing Camofox
setups (`CAMOFOX_URL` set, or `browser.cloud_provider: camofox`) are migrated automatically on
-update: the plugin is installed and the core `browser` toolset is turned off in that profile.
+update: the plugin is installed and the core `browser` toolset is turned off in that profile. A
+profile that had disabled `browser` everywhere (`agent.disabled_toolsets`) gets `camofox` disabled
+too, so browsing stays off.
A `browser.camofox` block with no `CAMOFOX_URL` is not a Camofox setup. A profile that sets up the
plugin after the update keeps `browser_exec` alongside it.