Skip to content

fix(gateway): read custom_providers context_length in hygiene compression#4044

Closed
teknium1 wants to merge 1 commit into
mainfrom
hermes/hermes-b2abefdf
Closed

fix(gateway): read custom_providers context_length in hygiene compression#4044
teknium1 wants to merge 1 commit into
mainfrom
hermes/hermes-b2abefdf

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Gateway hygiene pre-compression only checked model.context_length from config, missing per-model context_length defined in custom_providers entries. Custom provider users got the 128K default instead of their configured value, causing premature compression.

Root cause: The agent's own compressor reads custom_providers correctly (run_agent.py lines 1171-1189), but the gateway's hygiene pre-compression block was missing this fallback.

Fix: Adds the same custom_providers lookup to the hygiene block, positioned after runtime provider resolution so base_url is available for matching.

Example: A user with custom_providers.models.Qwen3.5-35B-A3B.context_length: 200000 was getting hygiene compression at 85% of 128K = 109K instead of 85% of 200K = 170K.

Reported by LauraOP in Discord. 61 gateway compression/hygiene tests pass.

…sion

Gateway hygiene pre-compression only checked model.context_length from
the top-level config, missing per-model context_length defined in
custom_providers entries. This caused premature compression for custom
provider users (e.g. 128K default instead of 200K configured).

The AIAgent's own compressor already reads custom_providers correctly
(run_agent.py lines 1171-1189). This adds the same fallback to the
gateway hygiene path, running after runtime provider resolution so
the base_url is available for matching.
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.

1 participant