hermes - 💡(How to fix) Fix compression feasibility check ignores custom_providers context_length, causes false 256K warning

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Resolve custom_providers for the compression model

_aux_custom_providers = [] try: from hermes_cli.config import load_config, get_compatible_custom_providers _cfg = load_config() _aux_custom_providers = get_compatible_custom_providers(_cfg) except Exception: pass

aux_context = get_model_context_length( aux_model, base_url=aux_base_url, api_key=aux_api_key, config_context_length=..., provider=..., custom_providers=_aux_custom_providers, # was missing )

Root Cause

_check_compression_model_feasibility() in run_agent.py calls get_model_context_length() without passing the custom_providers parameter. This skips step 0b of the resolution order, which is where per-model context_length overrides from custom_providers config are applied.

Compare the two call sites in run_agent.py:

Call sitecustom_providers passed?Result
Main model init (~L2222)YesCorrect context length from custom_providers
Compression check (~L3145)NoFalls back to 256K DEFAULT_FALLBACK_CONTEXT

Without custom_providers, the resolution chain for unknown custom endpoints short-circuits at step 2 in get_model_context_length(): it tries the /models endpoint, gets no context_length metadata back, and immediately returns DEFAULT_FALLBACK_CONTEXT (256K) without ever reaching the hardcoded defaults or custom_providers entries.

Fix Action

Fix

Add custom_providers resolution to _check_compression_model_feasibility() so it passes the parameter through to get_model_context_length(), matching the main-model path:

# Resolve custom_providers for the compression model
_aux_custom_providers = []
try:
    from hermes_cli.config import load_config, get_compatible_custom_providers
    _cfg = load_config()
    _aux_custom_providers = get_compatible_custom_providers(_cfg)
except Exception:
    pass

aux_context = get_model_context_length(
    aux_model,
    base_url=aux_base_url,
    api_key=aux_api_key,
    config_context_length=...,
    provider=...,
    custom_providers=_aux_custom_providers,  # was missing
)

Code Example

# Resolve custom_providers for the compression model
_aux_custom_providers = []
try:
    from hermes_cli.config import load_config, get_compatible_custom_providers
    _cfg = load_config()
    _aux_custom_providers = get_compatible_custom_providers(_cfg)
except Exception:
    pass

aux_context = get_model_context_length(
    aux_model,
    base_url=aux_base_url,
    api_key=aux_api_key,
    config_context_length=...,
    provider=...,
    custom_providers=_aux_custom_providers,  # was missing
)
RAW_BUFFERClick to expand / collapse

Bug Description

When using a custom provider with custom_providers configured (including per-model context_length), the compression model feasibility check (_check_compression_model_feasibility) incorrectly resolves the auxiliary compression model context as 256K (the DEFAULT_FALLBACK_CONTEXT), even when the model and provider are identical to the main model which correctly resolves to the configured context (e.g. 1M).

This causes a false warning at startup about lowering the compression threshold.

Root Cause

_check_compression_model_feasibility() in run_agent.py calls get_model_context_length() without passing the custom_providers parameter. This skips step 0b of the resolution order, which is where per-model context_length overrides from custom_providers config are applied.

Compare the two call sites in run_agent.py:

Call sitecustom_providers passed?Result
Main model init (~L2222)YesCorrect context length from custom_providers
Compression check (~L3145)NoFalls back to 256K DEFAULT_FALLBACK_CONTEXT

Without custom_providers, the resolution chain for unknown custom endpoints short-circuits at step 2 in get_model_context_length(): it tries the /models endpoint, gets no context_length metadata back, and immediately returns DEFAULT_FALLBACK_CONTEXT (256K) without ever reaching the hardcoded defaults or custom_providers entries.

Steps to Reproduce

  1. Configure a custom provider with custom_providers including a per-model context_length (e.g. 1,000,000)
  2. Set compression.threshold high enough that the main model threshold exceeds 256K (e.g. 0.85 × 1M = 850K)
  3. Ensure the auxiliary compression model resolves to the same custom provider/model
  4. Start Hermes — observe the false warning about 256K compression context

Fix

Add custom_providers resolution to _check_compression_model_feasibility() so it passes the parameter through to get_model_context_length(), matching the main-model path:

# Resolve custom_providers for the compression model
_aux_custom_providers = []
try:
    from hermes_cli.config import load_config, get_compatible_custom_providers
    _cfg = load_config()
    _aux_custom_providers = get_compatible_custom_providers(_cfg)
except Exception:
    pass

aux_context = get_model_context_length(
    aux_model,
    base_url=aux_base_url,
    api_key=aux_api_key,
    config_context_length=...,
    provider=...,
    custom_providers=_aux_custom_providers,  # was missing
)

Affected Version

Observed on Hermes Agent main branch (post v0.12.x). The custom_providers parameter was added to get_model_context_length() for the main model path but the compression feasibility check was not updated to match.

Environment

  • OS: Linux (Arch-based)
  • Provider: custom endpoint with custom_providers config

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING