Skip to content

Automate browser based workflows with AI

Skip the OpenRouter provider that returns action-less extract responses (SKY-16508) (#8610)

pedrohsdb2c9eb72f18dc
diff --git a/skyvern/forge/sdk/api/llm/config_registry.py b/skyvern/forge/sdk/api/llm/config_registry.py
index 29a24b329..576999ce6 100644
--- a/skyvern/forge/sdk/api/llm/config_registry.py
+++ b/skyvern/forge/sdk/api/llm/config_registry.py
@@ -19,6 +19,11 @@ XAI_GROK_4_5_CONTEXT_WINDOW = 500_000
# xAI publishes no output cap for grok-4.5; match the bound used by the other large reasoning
# models here so LiteLLM's context bookkeeping never assumes 500k of output.
XAI_GROK_4_5_MAX_OUTPUT_TOKENS = 128_000
+# Extract-actions responses routed to this OpenRouter upstream came back without the `actions`
+# key, identically on every step retry, so the route skips it (SKY-16508). The value is
+# OpenRouter's own provider slug (https://openrouter.ai/api/v1/providers) - a name it does not
+# recognize in `ignore` is skipped silently rather than rejected.
+OPENINFERENCE_PROVIDER_SLUG = "open-inference"
@dataclass(frozen=True)
@@ -2334,6 +2339,7 @@ if settings.ENABLE_OPENROUTER:
api_base=settings.OPENROUTER_API_BASE,
api_version=None,
model_info={"model_name": "openrouter/deepseek/deepseek-v4-flash"},
+ extra_body={"provider": {"ignore": [OPENINFERENCE_PROVIDER_SLUG]}},
),
),
)
diff --git a/tests/unit/test_config_registry.py b/tests/unit/test_config_registry.py
index 237c6b32b..5b7b1345f 100644
--- a/tests/unit/test_config_registry.py
+++ b/tests/unit/test_config_registry.py
@@ -1,4 +1,7 @@
+import json
import runpy
+import threading
+from http.server import BaseHTTPRequestHandler, HTTPServer
from pathlib import Path
from typing import Any
@@ -54,3 +57,78 @@ def test_openrouter_deepseek_v4_flash_0731_registry_config(monkeypatch: pytest.M
"quantizations": ["fp8"],
},
}
+
+
+def _openrouter_capture_server(captured: dict[str, Any]) -> HTTPServer:
+ class _Handler(BaseHTTPRequestHandler):
+ def do_POST(self) -> None:
+ captured["body"] = json.loads(self.rfile.read(int(self.headers.get("Content-Length", 0))))
+ payload = json.dumps(
+ {
+ "id": "chatcmpl-test",
+ "object": "chat.completion",
+ "created": 0,
+ "model": "deepseek/deepseek-v4-flash",
+ "choices": [
+ {
+ "index": 0,
+ "message": {"role": "assistant", "content": '{"actions": []}'},
+ "finish_reason": "stop",
+ }
+ ],
+ "usage": {"prompt_tokens": 1, "completion_tokens": 1, "total_tokens": 2},
+ }
+ ).encode()
+ self.send_response(200)
+ self.send_header("Content-Type", "application/json")
+ self.send_header("Content-Length", str(len(payload)))
+ self.end_headers()
+ self.wfile.write(payload)
+
+ def log_message(self, *args: object) -> None:
+ pass
+
+ return HTTPServer(("127.0.0.1", 0), _Handler)
+
+
+async def test_openrouter_deepseek_v4_flash_sends_provider_ignore_on_the_wire(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """OpenRouter skips an unrecognized slug in `ignore` silently instead of rejecting it, so a
+ typo would leave the route on the defective provider while the config still looked right."""
+ captured: dict[str, Any] = {}
+ real_get_config = config_registry.LLMConfigRegistry.get_config
+
+ with _openrouter_capture_server(captured) as server:
+ thread = threading.Thread(target=server.serve_forever, daemon=True)
+ thread.start()
+ try:
+ monkeypatch.setattr(config_registry.settings, "ENABLE_OPENROUTER", True)
+ monkeypatch.setattr(config_registry.settings, "OPENROUTER_API_KEY", "test-key")
+ monkeypatch.setattr(
+ config_registry.settings, "OPENROUTER_API_BASE", f"http://127.0.0.1:{server.server_port}"
+ )
+ monkeypatch.setattr(llm_schemas, "_settings", lambda: config_registry.settings)
+ assert config_registry.__file__ is not None
+
+ registry_namespace = runpy.run_path(str(Path(config_registry.__file__)))
+ llm_config = registry_namespace["LLMConfigRegistry"].get_config("OPENROUTER_DEEPSEEK_V4_FLASH")
+ assert llm_config.litellm_params is not None
+ assert llm_config.litellm_params["extra_body"] == {"provider": {"ignore": ["open-inference"]}}
+
+ # The process-wide registry may hold a config issue for this key (no OpenRouter key in
+ # the environment), which would hand back the dummy handler instead of calling out.
+ monkeypatch.setattr(config_registry.LLMConfigRegistry, "get_config_issue", lambda _: None)
+ monkeypatch.setattr(
+ config_registry.LLMConfigRegistry,
+ "get_config",
+ lambda key: llm_config if key == "OPENROUTER_DEEPSEEK_V4_FLASH" else real_get_config(key),
+ )
+ monkeypatch.setattr(LLMAPIHandlerFactory, "_handler_cache", {})
+ await LLMAPIHandlerFactory.get_llm_api_handler("OPENROUTER_DEEPSEEK_V4_FLASH")(prompt="hello")
+ finally:
+ server.shutdown()
+ thread.join(timeout=5)
+
+ assert captured["body"]["provider"] == {"ignore": ["open-inference"]}