Skip to content

Self-improving AI Employees for everyone

refactor: remove dead code across execution, llm, and event layers

trohitgdbd8a2e27880
diff --git a/client/package.json b/client/package.json
index d8d4e703..99b1d1aa 100644
--- a/client/package.json
+++ b/client/package.json
@@ -47,7 +47,6 @@
"globals": "^16.5.0",
"idb-keyval": "^6.2.2",
"lucide-react": "^1.14.0",
- "next-themes": "^0.4.6",
"partysocket": "1.1.18",
"postcss": "^8.5.14",
"prismjs": "^1.30.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 407023f2..0fb1ed66 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -137,9 +137,6 @@ importers:
lucide-react:
specifier: ^1.14.0
version: 1.14.0([email protected])
- next-themes:
- specifier: ^0.4.6
partysocket:
specifier: 1.1.18
version: 1.1.18([email protected])
@@ -4685,12 +4682,6 @@ packages:
resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==}
engines: {node: '>= 0.6'}
- resolution: {integrity: sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA==}
- peerDependencies:
- react: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc
- react-dom: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc
-
resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}
engines: {node: '>=10.5.0'}
@@ -11535,11 +11526,6 @@ snapshots:
- dependencies:
- react: 19.2.6
- react-dom: 19.2.6([email protected])
-
diff --git a/server/constants.py b/server/constants.py
index 9d3fc7c1..d25f8faf 100644
--- a/server/constants.py
+++ b/server/constants.py
@@ -77,11 +77,6 @@ SKILL_NODE_TYPES: FrozenSet[str] = frozenset(
]
)
-# Toolkit node types (aggregate sub-nodes, n8n Sub-Node pattern)
-# Sub-nodes connected to toolkits should not execute independently -
-# they only execute when called via the toolkit's tool interface
-TOOLKIT_NODE_TYPES: FrozenSet[str] = frozenset()
-
# All AI-related node types (for API key injection)
AI_MODEL_TYPES: FrozenSet[str] = AI_AGENT_TYPES | AI_CHAT_MODEL_TYPES
diff --git a/server/services/ai.py b/server/services/ai.py
index 7af5c624..274ce549 100644
--- a/server/services/ai.py
+++ b/server/services/ai.py
@@ -134,11 +134,9 @@ logger = get_logger(__name__)
# ---------------------------------------------------------------------------
# Native LLM provider imports (dual-path: native for chat, LangChain for agents)
# ---------------------------------------------------------------------------
-# ``create_provider`` / ``is_native_provider`` are no longer called from
-# this module — ``ChatUnifier`` (injected via DI) owns provider
-# dispatch. The imports stay deleted; Phase D removes the legacy
-# factory functions entirely once the LangChain fallback for
-# groq/cerebras lands behind the unifier.
+# ``ChatUnifier`` (injected via DI) owns provider dispatch. The legacy
+# ``services.llm.factory`` module (``create_provider`` /
+# ``is_native_provider``) was removed after the unifier cutover.
from services.llm.protocol import (
Message as NativeMessage,
ThinkingConfig as NativeThinkingConfig,
diff --git a/server/services/deployment/manager.py b/server/services/deployment/manager.py
index 7b3e53e7..0df370fd 100644
--- a/server/services/deployment/manager.py
+++ b/server/services/deployment/manager.py
@@ -14,7 +14,7 @@ from datetime import datetime
from typing import Dict, Any, List, Optional, Callable, TYPE_CHECKING
from core.logging import get_logger
-from constants import POLLING_TRIGGER_TYPES, TOOLKIT_NODE_TYPES, WORKFLOW_TRIGGER_TYPES
+from constants import POLLING_TRIGGER_TYPES, WORKFLOW_TRIGGER_TYPES
from services import event_waiter
from services.events.envelope import equivalent_event_types
from .state import DeploymentState, TriggerInfo
@@ -1201,20 +1201,6 @@ class DeploymentManager:
continue
downstream_ids.add(source)
- # Include sub-nodes connected to toolkit nodes (n8n Sub-Node pattern).
- # Service nodes connect to a toolkit's input-main (not a config
- # handle) and need to be included so the toolkit can discover
- # them. ``TOOLKIT_NODE_TYPES`` is the canonical set; today only
- # toolkit node types are in it.
- toolkit_node_ids = {n["id"] for n in nodes if n.get("type") in TOOLKIT_NODE_TYPES and n["id"] in downstream_ids}
- for edge in edges:
- target = edge.get("target")
- source = edge.get("source")
- # Include nodes that connect to toolkit nodes
- if target in toolkit_node_ids and source not in downstream_ids:
- downstream_ids.add(source)
- logger.debug(f"[Deployment] Including sub-node {source} connected to toolkit {target}")
-
# Include tool nodes connected to AI Agent nodes (for capability discovery)
# When a child agent is included, we need its connected tools so the parent
# can discover what capabilities the child has
diff --git a/server/services/event_waiter.py b/server/services/event_waiter.py
index 931050d2..c03e2fa5 100644
--- a/server/services/event_waiter.py
+++ b/server/services/event_waiter.py
@@ -363,19 +363,14 @@ async def run_trigger_precheck(node_type: str, parameters: Dict) -> Any:
@dataclass
class Waiter:
- """Single event waiter.
-
- In memory mode: uses asyncio.Future
- In Redis mode: uses stream polling with stored metadata
- """
+ """Single event waiter, resolved via asyncio.Future."""
id: str = field(default_factory=lambda: str(uuid.uuid4()))
node_id: str = ""
node_type: str = ""
event_type: str = ""
- params: Dict = field(default_factory=dict) # Store params for Redis mode filter rebuild
filter_fn: Callable[[Dict], bool] = field(default_factory=lambda: lambda x: True)
- future: Optional[asyncio.Future] = None # Only used in memory mode
+ future: Optional[asyncio.Future] = None
cancelled: bool = False
created_at: float = field(default_factory=time.time)
@@ -409,7 +404,6 @@ async def register(node_type: str, node_id: str, params: Dict) -> Waiter:
node_id=node_id,
node_type=node_type,
event_type=config.event_type,
- params=params,
filter_fn=build_filter(node_type, params),
)
@@ -605,5 +599,8 @@ def clear_all() -> int:
def get_backend_mode() -> str:
- """Get current backend mode for debugging."""
+ """Get current backend mode for debugging.
+
+ Always "memory" — the Redis-Streams backend was retired in Wave 15.3.
+ """
return "memory"
diff --git a/server/services/execution/executor.py b/server/services/execution/executor.py
index bcd3e4a5..f135f515 100644
--- a/server/services/execution/executor.py
+++ b/server/services/execution/executor.py
@@ -455,151 +455,6 @@ class WorkflowExecutor:
ctx.status = WorkflowStatus.FAILED
- # =========================================================================
- # PARALLEL EXECUTION (Legacy - Fork/Join with FIRST_COMPLETED pattern)
- # =========================================================================
-
- async def _execute_parallel_nodes(self, ctx: ExecutionContext, nodes: List[NodeExecution], enable_caching: bool) -> None:
- """Execute multiple nodes in parallel using asyncio.wait with FIRST_COMPLETED.
-
- Uses the standard asyncio pattern for mixed task types:
- - Regular nodes complete quickly
- - Trigger nodes wait indefinitely for external events
- - If a regular node fails, cancel remaining trigger nodes immediately
-
- This follows Python asyncio best practices:
- https://docs.python.org/3/library/asyncio-task.html#asyncio.wait
-
- Args:
- ctx: ExecutionContext
- nodes: List of NodeExecution to run in parallel
- enable_caching: Whether to use result caching
- """
- # Mark all as scheduled
- for node in nodes:
- node.status = TaskStatus.SCHEDULED
- await self._notify_status(node.node_id, "scheduled", {})
-
- # Create named tasks for parallel execution
- # Using dict to track node -> task mapping for proper result handling
- node_to_task: Dict[str, asyncio.Task] = {}
- task_to_node: Dict[asyncio.Task, NodeExecution] = {}
-
- for node in nodes:
- task = asyncio.create_task(self._execute_node_with_retry(ctx, node, enable_caching), name=f"node_{node.node_id}")
- node_to_task[node.node_id] = task
- task_to_node[task] = node
-
- pending: Set[asyncio.Task] = set(node_to_task.values())
- workflow_failed = False
-
- # Process tasks as they complete using FIRST_COMPLETED pattern
- while pending:
- # Wait for any task to complete
- done, pending = await asyncio.wait(pending, return_when=asyncio.FIRST_COMPLETED)
-
- # Process completed tasks
- for task in done:
- node = task_to_node[task]
-
- try:
- result = task.result()
-
- if isinstance(result, Exception):
- # Task raised exception
- node.status = TaskStatus.FAILED
- node.error = str(result)
- node.completed_at = time.time()
- ctx.errors.append(
- {
- "node_id": node.node_id,
- "error": str(result),
- "timestamp": time.time(),
- }
- )
- await self._notify_status(node.node_id, "error", {"error": str(result)})
- logger.error("Parallel node failed", node_id=node.node_id, error=str(result))
- workflow_failed = True
-
- elif result.get("retries_exhausted"):
- # Node failed after all retries - already in DLQ
- node.status = TaskStatus.FAILED
- node.error = result.get("error", "Unknown error")
- node.completed_at = time.time()
- ctx.errors.append(
- {
- "node_id": node.node_id,
- "error": node.error,
- "retries_exhausted": True,
- "timestamp": time.time(),
- }
- )
- workflow_failed = True
-
- elif not result.get("success"):
- # Node returned failure without exhausting retries
- node.status = TaskStatus.FAILED
- node.error = result.get("error", "Unknown error")
- node.completed_at = time.time()
- ctx.errors.append(
- {
- "node_id": node.node_id,
- "error": node.error,
- "timestamp": time.time(),
- }
- )
- await self._notify_status(node.node_id, "error", {"error": node.error})
- logger.error("Parallel node failed", node_id=node.node_id, error=node.error)
- workflow_failed = True
-
- except asyncio.CancelledError:
- # Task was cancelled (by us or externally)
- node.status = TaskStatus.CANCELLED
- node.completed_at = time.time()
- logger.info("Parallel node cancelled", node_id=node.node_id)
-
- except Exception as e:
- # Unexpected exception from task.result()
- node.status = TaskStatus.FAILED
- node.error = str(e)
- node.completed_at = time.time()
- ctx.errors.append(
- {
- "node_id": node.node_id,
- "error": str(e),
- "timestamp": time.time(),
- }
- )
- await self._notify_status(node.node_id, "error", {"error": str(e)})
- logger.error("Parallel node exception", node_id=node.node_id, error=str(e))
- workflow_failed = True
-
- # If workflow failed, cancel remaining pending tasks
- # This prevents trigger nodes from blocking forever when a regular node fails
- if workflow_failed and pending:
- logger.info("Workflow failed, cancelling remaining tasks", pending_count=len(pending))
-
- for task in pending:
- task.cancel()
-
- # Wait for cancelled tasks to finish
- if pending:
- cancelled_done, _ = await asyncio.wait(pending, return_when=asyncio.ALL_COMPLETED)
-
- # Mark cancelled nodes
- for task in cancelled_done:
- node = task_to_node[task]
- if node.status not in (TaskStatus.COMPLETED, TaskStatus.FAILED):
- node.status = TaskStatus.CANCELLED
- node.completed_at = time.time()
- logger.info("Cancelled pending node", node_id=node.node_id)
-
- pending = set() # All done now
-
- # Mark workflow as failed if any node failed
- if workflow_failed:
- ctx.status = WorkflowStatus.FAILED
-
async def _execute_single_node(self, ctx: ExecutionContext, node: NodeExecution, enable_caching: bool) -> None:
"""Execute a single node with retry logic.
@@ -879,7 +734,7 @@ class WorkflowExecutor:
workflow. They listen for specific events/conditions and initiate
the execution of the entire workflow.
- Config nodes and toolkit sub-nodes are excluded from layers since
+ Config nodes and AI-agent sub-nodes are excluded from layers since
they don't execute as independent workflow nodes.
Args:
@@ -889,14 +744,11 @@ class WorkflowExecutor:
Returns:
List of layers, where each layer is a list of node IDs
"""
- from constants import CONFIG_NODE_TYPES, TOOLKIT_NODE_TYPES, AI_AGENT_TYPES
+ from constants import CONFIG_NODE_TYPES, AI_AGENT_TYPES
# Build node type lookup for trigger detection
node_types: Dict[str, str] = {node["id"]: node.get("type", "unknown") for node in nodes}
- # Find toolkit sub-nodes (nodes that connect TO a toolkit)
- toolkit_node_ids = {n.get("id") for n in nodes if n.get("type") in TOOLKIT_NODE_TYPES}
-
# Find AI Agent nodes (all agent types have config handles)
ai_agent_node_ids = {n.get("id") for n in nodes if n.get("type") in AI_AGENT_TYPES}
@@ -906,10 +758,6 @@ class WorkflowExecutor:
target = edge.get("target")
target_handle = edge.get("targetHandle")
- # Any node that connects TO a toolkit is a sub-node
- if target in toolkit_node_ids and source:
- subnode_ids.add(source)
-
# Nodes connected to AI Agent config handles are sub-nodes
# These handles: input-memory, input-tools, input-skill, input-teammates
if target in ai_agent_node_ids and source and target_handle:
diff --git a/server/services/execution/models.py b/server/services/execution/models.py
index c8f0fa58..52139beb 100644
--- a/server/services/execution/models.py
+++ b/server/services/execution/models.py
@@ -315,10 +315,10 @@ class ExecutionContext:
Config nodes (memory, tools, model configs) are excluded from execution
as they provide configuration to other nodes via special handles.
- Toolkit sub-nodes (nodes connected to an aggregator) are also
- excluded - they execute only when called via the toolkit's tool interface.
+ Sub-nodes connected to an AI Agent's config handles are also
+ excluded - they execute only when called via the agent's tool interface.
"""
- from constants import CONFIG_NODE_TYPES, TOOLKIT_NODE_TYPES, AI_AGENT_TYPES
+ from constants import CONFIG_NODE_TYPES, AI_AGENT_TYPES
execution_id = str(uuid.uuid4())
ctx = cls(
@@ -329,10 +329,6 @@ class ExecutionContext:
edges=edges or [],
)
- # Find toolkit sub-nodes (nodes that connect TO a toolkit node)
- # These should only execute when called via the toolkit, not as workflow nodes
- toolkit_node_ids = {n.get("id") for n in (nodes or []) if n.get("type") in TOOLKIT_NODE_TYPES}
-
# Find AI Agent nodes (all agent types have config handles)
ai_agent_node_ids = {n.get("id") for n in (nodes or []) if n.get("type") in AI_AGENT_TYPES}
@@ -342,10 +338,6 @@ class ExecutionContext:
target = edge.get("target")
target_handle = edge.get("targetHandle")
- # Any node that connects TO a toolkit is a sub-node
- if target in toolkit_node_ids and source:
- subnode_ids.add(source)
-
# Nodes connected to AI Agent config handles are sub-nodes
# These handles: input-memory, input-tools, input-skill, input-teammates
if target in ai_agent_node_ids and source and target_handle:
diff --git a/server/services/execution/recovery.py b/server/services/execution/recovery.py
index d679edd9..0d8685a7 100644
--- a/server/services/execution/recovery.py
+++ b/server/services/execution/recovery.py
@@ -194,8 +194,6 @@ class RecoverySweeper:
return needs_recovery
- return cleaned
-
# Global sweeper instance (initialized by main.py)
_sweeper: Optional[RecoverySweeper] = None
diff --git a/server/services/llm/__init__.py b/server/services/llm/__init__.py
index e2331f47..6bcb6a59 100644
--- a/server/services/llm/__init__.py
+++ b/server/services/llm/__init__.py
@@ -1,4 +1,4 @@
-"""LLM service layer -- native provider SDKs, config, protocol types, factory."""
+"""LLM service layer -- native provider SDKs, config, protocol types."""
from services.llm.config import (
ProviderConfig,
@@ -21,7 +21,6 @@ from services.llm.protocol import (
LLMProvider,
)
from services.llm.messages import is_valid_message_content, filter_empty_messages
-from services.llm.factory import create_provider, is_native_provider, NATIVE_PROVIDERS
from services.llm.registry import (
ProviderSpec,
register_provider,
@@ -59,10 +58,6 @@ __all__ = [
# Messages
"is_valid_message_content",
"filter_empty_messages",
- # Factory (legacy — replaced by unifier in Phase A3; kept for back-compat)
- "create_provider",
- "is_native_provider",
- "NATIVE_PROVIDERS",
# Plugin registry + unifier (Phase A — single SERVICE facade)
"ProviderSpec",
"register_provider",
diff --git a/server/services/llm/factory.py b/server/services/llm/factory.py
deleted file mode 100644
index 4440db8c..00000000
--- a/server/services/llm/factory.py
+++ /dev/null
@@ -1,75 +0,0 @@
-"""Provider factory -- lazy-imports native SDK providers."""
-
-from __future__ import annotations
-
-from typing import Optional
-
-from core.logging import get_logger
-from services.llm.protocol import LLMProvider
-
-logger = get_logger(__name__)
-
-# Providers with dedicated SDK implementations
-_DEDICATED_PROVIDERS = frozenset({"anthropic", "openai", "gemini", "openrouter"})
-
-# All providers supported by native SDK path (dedicated + OpenAI-compatible via base_url).
-# Local servers (ollama, lmstudio) expose OpenAI-compatible /v1 endpoints, so they fall
-# through to OpenAIProvider with base_url from llm_defaults.json — same path as deepseek/
-# kimi/mistral. The user's custom URL rides via the existing {provider}_proxy credential.
-NATIVE_PROVIDERS = _DEDICATED_PROVIDERS | frozenset(
- {
- "xai",
- "deepseek",
- "kimi",
- "mistral",
- "ollama",
- "lmstudio",
- }
-)
-
-
-def create_provider(
- provider: str,
- api_key: str,
- *,
- proxy_url: Optional[str] = None,
-) -> LLMProvider:
- """Create a native LLM provider instance.
-
- Dedicated providers (anthropic, gemini, openrouter) use their own classes.
- OpenAI-compatible providers use OpenAIProvider with base_url from config.
- """
- if provider == "anthropic":
- from services.llm.providers.anthropic import AnthropicProvider
-
- return AnthropicProvider(api_key, proxy_url=proxy_url)
-
- if provider == "openai":
- from services.llm.providers.openai import OpenAIProvider
-
- return OpenAIProvider(api_key, proxy_url=proxy_url)
-
- if provider == "gemini":
- from services.llm.providers.gemini import GeminiProvider
-
- return GeminiProvider(api_key, proxy_url=proxy_url)
-
- if provider == "openrouter":
- from services.llm.providers.openrouter import OpenRouterProvider
-
- return OpenRouterProvider(api_key, proxy_url=proxy_url)
-
- # OpenAI-compatible providers: use OpenAIProvider with base_url from config
- from services.llm.config import get_provider_config
-
- config = get_provider_config(provider)
- if config and config.base_url:
- from services.llm.providers.openai import OpenAIProvider
-
- return OpenAIProvider(api_key, base_url=config.base_url, proxy_url=proxy_url)
-
- raise ValueError(f"Unknown provider: {provider}")
-
-
-def is_native_provider(provider: str) -> bool:
- return provider in NATIVE_PROVIDERS
diff --git a/server/services/temporal/trigger_listener_workflow.py b/server/services/temporal/trigger_listener_workflow.py
index ce9a394a..277c41b9 100644
--- a/server/services/temporal/trigger_listener_workflow.py
+++ b/server/services/temporal/trigger_listener_workflow.py
@@ -353,7 +353,6 @@ def _build_run_graph(
"""
from constants import (
AI_AGENT_TYPES,
- TOOLKIT_NODE_TYPES,
WORKFLOW_TRIGGER_TYPES,
)
@@ -388,14 +387,6 @@ def _build_run_graph(
continue
downstream_ids.add(source)
- # Sub-nodes connected to toolkit nodes (n8n Sub-Node pattern).
- toolkit_ids = {n["id"] for n in nodes if n.get("type") in TOOLKIT_NODE_TYPES and n["id"] in downstream_ids}
- for edge in edges:
- target = edge.get("target")
- source = edge.get("source")
- if target in toolkit_ids and source not in downstream_ids:
- downstream_ids.add(source)
-
# Tool nodes connected to AI Agent's input-tools handle.
agent_ids = {n["id"] for n in nodes if n.get("type") in AI_AGENT_TYPES and n["id"] in downstream_ids}
for edge in edges:
diff --git a/server/services/temporal/workflow.py b/server/services/temporal/workflow.py
index 67820502..b759c525 100644
--- a/server/services/temporal/workflow.py
+++ b/server/services/temporal/workflow.py
@@ -69,7 +69,7 @@ AGENT_WORKFLOW_TYPES = frozenset(
[
"aiAgent",
"chatAgent",
- # Specialized agents (12)
+ # Specialized agents (11)
"android_agent",
"coding_agent",
"web_agent",
@@ -578,9 +578,6 @@ class MachinaWorkflow:
return node_id, {"success": False, "error": str(e)}
# Wait for first completion using Temporal's wait
- [h for _, h in items]
-
- # Use asyncio.wait pattern via workflow.wait
await workflow.wait_condition(lambda: any(h.done() for _, h in items))
# Find the completed one
diff --git a/server/tests/llm/test_factory.py b/server/tests/llm/test_factory.py
deleted file mode 100644
index 795e771d..00000000
--- a/server/tests/llm/test_factory.py
+++ /dev/null
@@ -1,79 +0,0 @@
-"""Test create_provider() factory and provider detection."""
-
-from unittest.mock import patch
-
-from services.llm.factory import create_provider, is_native_provider, NATIVE_PROVIDERS
-from services.llm.config import detect_provider_from_model
-from services.llm.protocol import LLMProvider
-
-
-def test_native_providers_set():
- assert NATIVE_PROVIDERS == {
- "anthropic",
- "openai",
- "gemini",
- "openrouter",
- "xai",
- "deepseek",
- "kimi",
- "mistral",
- "ollama",
- "lmstudio",
- }
-
-
-def test_is_native_provider():
- assert is_native_provider("openai") is True
- assert is_native_provider("groq") is False
-
-
-def test_create_anthropic_provider():
- with patch("anthropic.AsyncAnthropic"):
- p = create_provider("anthropic", "sk-test")
- assert p.provider_name == "anthropic"
- assert isinstance(p, LLMProvider)
-
-
-def test_create_openai_provider():
- with patch("openai.AsyncOpenAI"):
- p = create_provider("openai", "sk-test")
- assert p.provider_name == "openai"
- assert isinstance(p, LLMProvider)
-
-
-def test_create_gemini_provider():
- with patch("google.genai.Client"):
- p = create_provider("gemini", "key")
- assert p.provider_name == "gemini"
- assert isinstance(p, LLMProvider)
-
-
-def test_create_openrouter_provider():
- with patch("openai.AsyncOpenAI"):
- p = create_provider("openrouter", "or-key")
- assert p.provider_name == "openrouter"
-
-
-def test_create_xai_uses_openai_with_base_url():
- with patch("openai.AsyncOpenAI") as mock_cls:
- p = create_provider("xai", "xai-key")
- assert p.provider_name == "openai" # reuses OpenAI class
- mock_cls.assert_called_once()
- call_kwargs = mock_cls.call_args[1]
- assert call_kwargs["base_url"] == "https://api.x.ai/v1"
-
-
-def test_create_unknown_raises():
- import pytest
-
- with pytest.raises(ValueError, match="Unknown provider"):
- create_provider("nonexistent", "key")
-
-
-def test_detect_provider_from_model():
- assert detect_provider_from_model("gpt-5.2") == "openai"
- assert detect_provider_from_model("o3-mini") == "openai"
- assert detect_provider_from_model("claude-sonnet-4-6") == "anthropic"
- assert detect_provider_from_model("gemini-2.5-flash") == "gemini"
- assert detect_provider_from_model("grok-3") == "xai"
- assert detect_provider_from_model("unknown-xyz") == "openai" # fallback