Bug Description
The auxiliary compression model fails to read context_length from the providers / custom_providers config section, causing it to fallback to endpoint-reported values (e.g. 128K) instead of the user-configured value.
Repro Steps
- Configure a custom provider with per-model
context_length in config.yaml:
providers:
local-kimi:
base_url: http://127.0.0.1:8080/v1
model: kimi-code/kimi-code
models:
kimi-code/kimi-code:
context_length: 262141
auxiliary:
compression:
provider: custom
model: kimi-code/kimi-code
base_url: http://127.0.0.1:8080/v1
- Start a session.
- Observe the warning:
⚠ Compression model (kimi-code/kimi-code) context is 128,000 tokens, but the main model's compression threshold was 209,712 tokens. Auto-lowered this session's threshold to 128,000 tokens so compression can run.
Expected Behavior
The compression model should resolve context_length: 262141 from providers.local-kimi.models.kimi-code/kimi-code, matching how the main model already does.
Actual Behavior
get_model_context_length() for the compression model only checks:
auxiliary.compression.context_length direct override
- Endpoint auto-detection (which returns 128K for this local endpoint)
It never looks up providers / custom_providers per-model config, unlike the main model which does (see run_agent.py:1587-1623).
Root Cause
In run_agent.py, _aux_compression_context_length_config is only populated from auxiliary.compression.context_length. The same providers lookup that exists for the main model is missing for the auxiliary model.
Suggested Fix
Add the same providers / custom_providers per-model context_length lookup for the auxiliary compression model before falling back to endpoint detection.
Labels: bug, context-compression
Bug Description
The auxiliary compression model fails to read
context_lengthfrom theproviders/custom_providersconfig section, causing it to fallback to endpoint-reported values (e.g. 128K) instead of the user-configured value.Repro Steps
context_lengthinconfig.yaml:Expected Behavior
The compression model should resolve
context_length: 262141fromproviders.local-kimi.models.kimi-code/kimi-code, matching how the main model already does.Actual Behavior
get_model_context_length()for the compression model only checks:auxiliary.compression.context_lengthdirect overrideIt never looks up
providers/custom_providersper-model config, unlike the main model which does (seerun_agent.py:1587-1623).Root Cause
In
run_agent.py,_aux_compression_context_length_configis only populated fromauxiliary.compression.context_length. The sameproviderslookup that exists for the main model is missing for the auxiliary model.Suggested Fix
Add the same
providers/custom_providersper-modelcontext_lengthlookup for the auxiliary compression model before falling back to endpoint detection.Labels: bug, context-compression