Skip to content

fix(gateway): read context_length from custom_providers in session info header#19708

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a
May 4, 2026
Merged

fix(gateway): read context_length from custom_providers in session info header#19708
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

@teknium1 teknium1 commented May 4, 2026

Salvage of #16579 by @JanCong onto current main.

Summary

_format_session_info() in gateway/run.py only read context_length from top-level model.context_length in config.yaml. When users set context_length under a custom_providers entry (the place the provider actually lives), the session-info header reported no context length and downstream bookkeeping fell back to defaults. Match the current model against custom_providers entries and use their context_length as a secondary source.

Conflict resolution during salvage

Main has since added a custom_provs = get_compatible_custom_providers(data) hoist for related callsites. Preserved that alongside the PR's data initialization so both the session-info header (this PR) and the related custom-provider usage lines continue to work.

Changes

  • gateway/run.py: _format_session_info reads context_length from custom_providers when model.context_length is unset (+36/-0)

Validation

Manual review; diff is surgical and scoped to the single function.

Original PR: #16579

@teknium1 teknium1 merged commit 3ccf723 into main May 4, 2026
7 of 10 checks passed
@teknium1 teknium1 deleted the hermes/hermes-8c54fd4a branch May 4, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants