Skip to content

fix(run_agent): read context_length from providers/custom_providers for compression model#13813

Open
ms-alan wants to merge 4 commits into
NousResearch:mainfrom
ms-alan:fix/13807-compression-context-length
Open

fix(run_agent): read context_length from providers/custom_providers for compression model#13813
ms-alan wants to merge 4 commits into
NousResearch:mainfrom
ms-alan:fix/13807-compression-context-length

Conversation

@ms-alan

@ms-alan ms-alan commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Summary

When auxiliary.compression.model uses a custom provider with per-model context_length configured under providers/<key>/models/<model>/context_length, the compression feasibility check now looks up that value — mirroring the main model's existing providers lookup in __init__.

Root cause: _aux_compression_context_length_config was only populated from auxiliary.compression.context_length (explicit override). The same providers / custom_providers per-model context_length lookup that exists for the main model was missing for the auxiliary model.

Fix: In _prepare_compression(), added providers/custom_providers context_length lookup for the auxiliary compression model (mirrors the main model lookup in init`)

Testing

  1. Configure auxiliary.compression.provider: custom + auxiliary.compression.model pointing to a local endpoint with context_length: 262141 in providers.local-kimi.models.kimi-code/kimi-code.context_length
  2. Start a session — the compression threshold should use 262141 instead of the endpoint's auto-detected 128000

Closes #13807

teknium1 and others added 4 commits April 22, 2026 11:36
…or compression model

When auxiliary.compression.model uses a custom provider with per-model
context_length configured in providers/local-kimi.models.kimi-code.context_length,
the compression feasibility check now looks up that value — mirroring the
main model's existing providers lookup in __init__.

Previously it only checked auxiliary.compression.context_length (explicit override)
and endpoint auto-detection, ignoring the per-model config in providers.

Closes NousResearch#13807
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder area/config Config system, migrations, profiles labels Apr 22, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #13540 which also targets the same compression context_length propagation gap via a different approach.

1 similar comment
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #13540 which also targets the same compression context_length propagation gap via a different approach.

@smallerxie

Copy link
Copy Markdown

Related: PR #17460 addresses the same root cause but with a more general approach. Instead of adding a providers lookup in _prepare_compression() (compression-only), it auto-loads custom_providers inside get_model_context_length() — fixing all auxiliary paths at once.

See also: #13540, #12977, #13807

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 loop, run_agent.py, prompt builder 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.

auxiliary compression model does not read context_length from providers config

4 participants