Skip to content

fix: honor custom-provider context length on model switch#15706

Closed
kevin930321 wants to merge 1 commit into
NousResearch:mainfrom
kevin930321:fix/model-switch-custom-provider-context
Closed

fix: honor custom-provider context length on model switch#15706
kevin930321 wants to merge 1 commit into
NousResearch:mainfrom
kevin930321:fix/model-switch-custom-provider-context

Conversation

@kevin930321

@kevin930321 kevin930321 commented Apr 25, 2026

Copy link
Copy Markdown

Summary

  • honor custom provider per-model context_length in /model success output
  • prefer custom_providers per-model context_length over global model.context_length during agent init
  • re-resolve config context length on switch_model so switching between custom-provider models refreshes the compressor correctly
  • add regression coverage for display and switch_model paths

Testing

  • /home/ubuntu/.hermes/hermes-agent/venv/bin/python -m pytest tests/hermes_cli/test_model_switch_context_display.py tests/run_agent/test_switch_model_context.py tests/run_agent/test_invalid_context_length_warning.py -q -o addopts=

Context

This fixes custom OpenAI-compatible providers where config.yaml sets per-model context lengths under custom_providers[].models. Before this patch, /model could display 128K instead of the configured limit, and switch_model could keep using the previous model's context length after a session-only model switch.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard comp/agent Core agent loop, run_agent.py, prompt builder area/config Config system, migrations, profiles labels Apr 25, 2026
@kevin930321 kevin930321 closed this by deleting the head repository Apr 30, 2026
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 comp/cli CLI entry point, hermes_cli/, setup wizard 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.

2 participants