mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-29 06:31:32 +00:00
fix(tools): run post_setup in _reconfigure_provider() for env-var providers
_configure_provider() calls _run_post_setup() after collecting env vars (line 2286). _reconfigure_provider() did not — providers with both env_vars and post_setup (Browserbase, Browser Use, Firecrawl, Camofox) skipped the installation step on reconfiguration. Fix: mirror the _configure_provider() call. post_setup hooks are idempotent (check before installing), so no behaviour change for users who already have the dependencies installed.
This commit is contained in:
parent
ad1aa1a037
commit
a9ba636d53
2 changed files with 30 additions and 0 deletions
|
|
@ -2599,6 +2599,9 @@ def _reconfigure_provider(provider: dict, config: dict):
|
|||
else:
|
||||
_print_info(" Kept current")
|
||||
|
||||
if provider.get("post_setup"):
|
||||
_run_post_setup(provider["post_setup"])
|
||||
|
||||
# Imagegen backends prompt for model selection on reconfig too.
|
||||
plugin_name = provider.get("image_gen_plugin_name")
|
||||
if plugin_name:
|
||||
|
|
|
|||
|
|
@ -1045,3 +1045,30 @@ def test_reconfigure_browser_provider_overwrites_stale_use_gateway():
|
|||
provider = {"name": "Browserbase", "browser_provider": "browserbase", "env_vars": []}
|
||||
_reconfigure_provider(provider, config)
|
||||
assert config["browser"]["use_gateway"] is False
|
||||
|
||||
|
||||
@pytest.mark.parametrize("provider_name,post_setup_key", [
|
||||
("Browserbase", "agent_browser"),
|
||||
("Browser Use", "agent_browser"),
|
||||
("Firecrawl", "agent_browser"),
|
||||
("Camofox", "camofox"),
|
||||
])
|
||||
def test_reconfigure_provider_runs_post_setup_for_env_var_providers(
|
||||
monkeypatch, provider_name, post_setup_key
|
||||
):
|
||||
"""_reconfigure_provider() must call _run_post_setup() for providers that have
|
||||
both env_vars and post_setup — parity with _configure_provider() line 2286."""
|
||||
called = []
|
||||
monkeypatch.setattr("hermes_cli.tools_config._run_post_setup", lambda key: called.append(key))
|
||||
monkeypatch.setattr("hermes_cli.tools_config.get_env_value", lambda k: None)
|
||||
monkeypatch.setattr("hermes_cli.tools_config._prompt", lambda *a, **kw: "")
|
||||
monkeypatch.setattr("hermes_cli.tools_config.save_env_value", lambda k, v: None)
|
||||
|
||||
provider = next(
|
||||
p
|
||||
for p in TOOL_CATEGORIES["browser"]["providers"]
|
||||
if p["name"] == provider_name
|
||||
)
|
||||
_reconfigure_provider(provider, {})
|
||||
|
||||
assert called == [post_setup_key]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue