refactor(commandcode): resolve the native DeepSeek profile through the registry

The delegation imported ``plugins.model_providers.deepseek`` — the only cross-plugin
module import in the tree, and one that resolves solely through the loader's
sys.modules shim (popped again if the deepseek plugin fails to load). Look the
profile up with get_provider_profile("deepseek") instead: already imported from
``providers``, honours a user override of the profile, degrades to the base no-op
without a try/except.

Drop the ``len(m) <= len("deepseek/")`` guard — the native profile returns
({}, {}) for an empty id anyway. Bind the expected value in the parity test and
assert it is non-empty so the equality cannot pass as ({}, {}) == ({}, {}).
This commit is contained in:
kshitijk4poor
2026-09-13 19:27:28 +05:30
committed by kshitij
parent 5dd8fa1daa
commit ef754d75ba
2 changed files with 11 additions and 6 deletions
@@ -7,7 +7,7 @@ import logging
import urllib.request
from hermes_cli.urllib_security import open_credentialed_url
from providers import register_provider
from providers import get_provider_profile, register_provider
from providers.base import ProviderProfile, _profile_user_agent
logger = logging.getLogger(__name__)
@@ -47,11 +47,14 @@ class CommandCodeProfile(ProviderProfile):
without them ``/reasoning`` never reaches the request (#95232). Other model
families stay a no-op — CommandCode declares no reasoning vocabulary for them."""
m = (model or "").strip()
if not m.lower().startswith("deepseek/") or len(m) <= len("deepseek/"):
if not m.lower().startswith("deepseek/"):
return {}, {}
from plugins.model_providers.deepseek import deepseek as _deepseek_profile
return _deepseek_profile.build_api_kwargs_extras(
# Registry lookup, not a module import: the deepseek shim is only a loader-injected
# sys.modules entry, and the registry honours a user override of the profile.
native = get_provider_profile("deepseek")
if native is None:
return {}, {}
return native.build_api_kwargs_extras(
reasoning_config=reasoning_config, model=m.split("/", 1)[1], **context,
)