Bug Description
The compression model's context length is not read from per-model configuration in custom_providers, causing incorrect context length detection even when the user has explicitly configured the correct context length in custom_providers.models[model].context_length.
Root Cause
In _check_compression_model_feasibility() method in run_agent.py, when checking the compression model's context length, it directly calls get_model_context_length() without first checking custom_providers for per-model context length overrides. This is inconsistent with how the main model is handled — the main model correctly reads custom_providers but the compression model didn't.
When a user configures:
custom_providers:
- name: Ark.cn-beijing.volces.com
base_url: https://ark.cn-beijing.volces.com/api/coding/v3
models:
doubao-seed-2.0-pro:
context_length: 256000
The warning still appears:
⚠ Compression model (doubao-seed-2.0-pro) context is 128,000 tokens, but the main model's compression threshold is 204,800 tokens.
Because it still falls back to the default 128K instead of reading the configured 256K from custom_providers.
Fix
This PR:
- Adds the same
custom_providers per-model context length lookup logic for compression models that already exists for the main model
- Adds
doubao-seed-2.0-pro and doubao-seed-2.0-lite to the hardcoded DEFAULT_CONTEXT_LENGTHS in agent/model_metadata.py as fallback
Bug Description
The compression model's context length is not read from per-model configuration in
custom_providers, causing incorrect context length detection even when the user has explicitly configured the correct context length incustom_providers.models[model].context_length.Root Cause
In
_check_compression_model_feasibility()method inrun_agent.py, when checking the compression model's context length, it directly callsget_model_context_length()without first checkingcustom_providersfor per-model context length overrides. This is inconsistent with how the main model is handled — the main model correctly readscustom_providersbut the compression model didn't.When a user configures:
The warning still appears:
Because it still falls back to the default 128K instead of reading the configured 256K from
custom_providers.Fix
This PR:
custom_providersper-model context length lookup logic for compression models that already exists for the main modeldoubao-seed-2.0-proanddoubao-seed-2.0-liteto the hardcodedDEFAULT_CONTEXT_LENGTHSinagent/model_metadata.pyas fallback