Skip to content

The agent that grows with you

fix(providers): ProviderProfile seam fields are keyword-only

Teknium7b044f819ece
diff --git a/providers/base.py b/providers/base.py
index 4f8abd00463..3610e20af59 100644
--- a/providers/base.py
+++ b/providers/base.py
@@ -13,7 +13,7 @@ from __future__ import annotations
import logging
import threading
-from dataclasses import dataclass, field
+from dataclasses import KW_ONLY, dataclass, field
from typing import TYPE_CHECKING, Any, Callable
if TYPE_CHECKING:
@@ -252,6 +252,10 @@ class ProviderProfile:
# patch catalog metadata; explicit user overrides still win. Exact model IDs.
model_capabilities: dict[str, dict[str, Any]] = field(default_factory=dict)
+ # Every field below was added after the released positional layout above: keyword-only, so a
+ # plugin subclass's own positional options keep their constructor slots.
+ _: KW_ONLY
+
# ── L6: provider-owned setup + sign-in surfaces (all optional; None/empty = core's generic path) ──
# ``account_card``: Accounts-tab card overrides ``{name, flow, cli_command, docs_url}`` for the
# Desktop/dashboard (``/api/providers/oauth``); non-empty also lists a Keys-tab profile there.
diff --git a/tests/agent/test_external_process_streaming.py b/tests/agent/test_external_process_streaming.py
index 4825e932ad1..761db192756 100644
--- a/tests/agent/test_external_process_streaming.py
+++ b/tests/agent/test_external_process_streaming.py
@@ -8,6 +8,21 @@ from agent.turn_api_call import _should_stream
from providers.base import ProviderProfile
+# ProviderProfile's positional constructor slots as released (main before the provider seams).
+# Frozen here on purpose: a field added later must be keyword-only, or a plugin subclass's own
+# positional option silently lands in the new field.
+RELEASED_POSITIONAL_FIELDS = (
+ "name", "api_mode", "aliases", "display_name", "description", "signup_url", "hidden",
+ "env_vars", "base_url", "models_url", "auth_type", "supports_health_check",
+ "supports_model_listing", "auth_handler", "refresh_credential", "classify_api_error",
+ "supports_vision", "supports_vision_tool_messages", "supports_prompt_cache_key",
+ "native_reasoning_details_type", "process_command", "process_args",
+ "process_command_env_vars", "process_args_env_var", "fallback_models", "model_aliases",
+ "hostname", "default_headers", "fixed_temperature", "default_max_tokens",
+ "unsupported_response_formats", "default_aux_model", "model_capabilities",
+)
+
+
def test_streaming_capability_preserves_positional_plugin_construction():
from dataclasses import dataclass, fields
from typing import Any
@@ -16,13 +31,14 @@ def test_streaming_capability_preserves_positional_plugin_construction():
class PluginProfile(ProviderProfile):
plugin_option: str = "default"
- # All pre-existing base and subclass fields retain their positional slots; fields added since
- # (supports_streaming and the provider seams) are keyword-only, so they take none.
- legacy_fields = [f for f in fields(PluginProfile) if not f.kw_only]
- values: list[Any] = [object() for _ in legacy_fields]
+ # Every released base field and the subclass's own option keep their positional slots;
+ # fields added since (supports_streaming and the provider seams) are keyword-only.
+ slots = RELEASED_POSITIONAL_FIELDS + ("plugin_option",)
+ assert tuple(f.name for f in fields(PluginProfile) if not f.kw_only) == slots
+ values: list[Any] = [object() for _ in slots]
profile = PluginProfile(*values, supports_streaming=True)
- for field, value in zip(legacy_fields, values):
- assert getattr(profile, field.name) is value
+ for name, value in zip(slots, values):
+ assert getattr(profile, name) is value
assert profile.supports_streaming is True