fix(auxiliary): forward custom_providers to compression model context-length detection

When auxiliary.compression.provider is "auto", the compression model
reuses the main model's provider and base_url.  The main model's
context_length was correctly picking up custom_providers per-model
overrides (via _custom_providers stored during __init__), but the
auxiliary compression model's context-length detection path in
_check_compression_model_feasibility was not passing custom_providers,
causing it to skip step 0b and fall through to models.dev.

This meant that for providers like NVIDIA NIM where the user has a
per-model context_length in custom_providers (e.g. 196608 for
minimax-m2.7), the auxiliary model would use the models.dev value
(204800) instead of the user-configured one — a subtle discrepancy
that could lead to silent compression issues when the auxiliary model
doesn't actually support the detected context length.

Fix: pass self._custom_providers (already stored as an instance attr
during __init__) to the get_model_context_length() call for the
auxiliary compression model.
This commit is contained in:
PaTTeeL 2026-05-13 23:13:45 -07:00 committed by Teknium
parent 8199ec3803
commit 7becb19ea0

View file

@ -2204,6 +2204,10 @@ class AIAgent:
if not isinstance(_custom_providers, list):
_custom_providers = []
# Store for reuse by _check_compression_model_feasibility (auxiliary
# compression model context-length detection needs the same list).
self._custom_providers = _custom_providers
# Check custom_providers per-model context_length
if _config_context_length is None and _custom_providers:
try:
@ -3246,6 +3250,7 @@ class AIAgent:
# provider-specific paths (e.g. Bedrock static table, OpenRouter API)
# are invoked for the correct client, not inherited from the main model.
provider=(_aux_cfg_provider if _aux_cfg_provider and _aux_cfg_provider != "auto" else getattr(self, "provider", "")),
custom_providers=self._custom_providers,
)
# Hard floor: the auxiliary compression model must have at least