Skip to content

Bug: compression model context length not read from custom_providers #8550

@thiswind

Description

@thiswind

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:

  1. Adds the same custom_providers per-model context length lookup logic for compression models that already exists for the main model
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions