Skip to content

The agent that grows with you

fix(web): ladder-derived firecrawl no longer forces the direct-only route

teknium1816cb37963ee
diff --git a/plugins/web/firecrawl/provider.py b/plugins/web/firecrawl/provider.py
index b1d911f7987..7d4f060ef9e 100644
--- a/plugins/web/firecrawl/provider.py
+++ b/plugins/web/firecrawl/provider.py
@@ -146,7 +146,7 @@ def _get_firecrawl_client() -> Any:
managed fallback billed to Nous); never-configured → direct when present, else managed. Raises ValueError
when the resolved path is unusable."""
wt = _wt()
- from tools.tool_backend_helpers import NOUS_MANAGED_PROVIDER, read_selection, selection_error, selection_exists
+ from tools.tool_backend_helpers import NOUS_MANAGED_PROVIDER, read_selection, selection_error
selected = read_selection("web")
direct_config = _get_direct_firecrawl_config()
@@ -166,8 +166,11 @@ def _get_firecrawl_client() -> Any:
if selected == NOUS_MANAGED_PROVIDER:
resolved, log, message = _managed(), "the Nous Subscription web selection is stored but the tool gateway is unavailable.", lambda: selection_error(
"web", NOUS_MANAGED_PROVIDER, "the Nous Tool Gateway is not available (not entitled or unreachable)")
- elif selected is not None or selection_exists("web"):
- # Stored vendor selection: direct only (no credentials → explicit selection unlocks keyless cloud mode).
+ elif selected is not None or _is_explicit_firecrawl_selection():
+ # Stored vendor selection (shared name, or a per-capability key naming firecrawl): direct only (no
+ # credentials → explicit selection unlocks keyless cloud mode). A per-capability key naming ANOTHER
+ # vendor is not a firecrawl selection: the other capability's ladder reached firecrawl on its own,
+ # so it resolves exactly like a never-configured install (#113017).
resolved, log, message = direct_config, "direct Firecrawl selected but FIRECRAWL_API_KEY/FIRECRAWL_API_URL is not set.", lambda: selection_error(
"web", selected or "firecrawl", "neither FIRECRAWL_API_KEY nor FIRECRAWL_API_URL is set")
elif direct_config is not None:
diff --git a/tests/tools/test_web_backend_capability_isolation.py b/tests/tools/test_web_backend_capability_isolation.py
index fc7927456aa..e9edb6d536e 100644
--- a/tests/tools/test_web_backend_capability_isolation.py
+++ b/tests/tools/test_web_backend_capability_isolation.py
@@ -44,3 +44,22 @@ def test_managed_use_gateway_still_resolves_firecrawl(monkeypatch):
_ladder_env(monkeypatch, {"use_gateway": True})
# Ladder would find ddgs if it ran — the managed selection must not reach it.
assert web_tools._get_backend() == "firecrawl"
+
+
+def test_ladder_derived_firecrawl_takes_managed_path_on_gateway_ready_install(monkeypatch):
+ """A lone per-capability key naming ANOTHER vendor must not force the direct-only firecrawl
+ branch: when the other capability's ladder lands on firecrawl via the managed slot, the client
+ resolves through the Tool Gateway exactly like a never-configured install."""
+ from types import SimpleNamespace
+
+ import plugins.web.firecrawl.provider as prov
+
+ _ladder_env(monkeypatch, {"extract_backend": "keenable"})
+ gw = SimpleNamespace(nous_user_token="tok", gateway_origin="https://gw.example")
+ monkeypatch.setattr(prov._gateway, "resolve_managed_tool_gateway", lambda *a, **k: gw)
+ monkeypatch.setattr(prov, "_wt", lambda: SimpleNamespace())
+ monkeypatch.setattr(prov, "Firecrawl", lambda **kwargs: SimpleNamespace(kwargs=kwargs), raising=False)
+
+ assert prov.check_firecrawl_api_key() is True
+ # Broken before the fix: ValueError "web is configured to use firecrawl (set via hermes tools)".
+ prov._get_firecrawl_client()