Skip to content

fix: compression model should read context_length from custom_providers - #15397

Closed
bestnite wants to merge 1 commit into
NousResearch:mainfrom
bestnite:fix/compression-custom-providers-context-length
Closed

fix: compression model should read context_length from custom_providers#15397
bestnite wants to merge 1 commit into
NousResearch:mainfrom
bestnite:fix/compression-custom-providers-context-length

Conversation

@bestnite

Copy link
Copy Markdown

Problem

When auxiliary.compression.context_length is not explicitly set in config.yaml, the compression model's context length falls through to DEFAULT_CONTEXT_LENGTHS or the 128K fallback, skipping custom_providers[].models[].context_length entirely.

This means users who correctly configure their model's context length in custom_providers:

custom_providers:
- base_url: https://example.com/v1
  models:
    deepseek-v4-flash:
      context_length: 1000000

...still see the false warning:

⚠ Compression model (deepseek-v4-flash) context is 128,000 tokens

Fix

  1. In init: Store normalized custom_providers on self._aux_compression_custom_providers
  2. In _check_compression_model_feasibility(): After resolving aux_model and aux_base_url$, if no explicit context_lengthwas configured, match the compression model + base_url againstcustom_providers` entries — mirroring the main model's logic.

Fixes #8550

In _check_compression_model_feasibility, the compression model's context
length resolution only checked auxiliary.compression.context_length in
config.yaml, missing the per-model context_length configured in
custom_providers[].models[].context_length.

This mirrors the main model's custom_providers lookup logic (lines
~1689-1725) for the compression model path:

1. Store normalized custom_providers in __init__ alongside
   _aux_compression_context_length_config
2. In _check_compression_model_feasibility, if no explicit config was
   set, fall through to match aux_model + aux_base_url against
   custom_providers entries

Fixes NousResearch#8550.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint area/config Config system, migrations, profiles labels Apr 24, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #13813 — same fix: read context_length from custom_providers for compression model in run_agent.py. See also #13807 and #12977 for the underlying issue cluster.

@bestnite

bestnite commented Apr 24, 2026

Copy link
Copy Markdown
Author

Agreed — #13813 covers this more broadly (incl. providers). Closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: compression model context length not read from custom_providers

2 participants