fix(compression): pass custom_providers to feasibility check context lookup#19553
Closed
luyao618 wants to merge 1 commit into
Closed
Conversation
Collaborator
Collaborator
…lookup The compression feasibility check calls get_model_context_length() without passing custom_providers, so per-model context_length overrides from custom_providers config are ignored. The check falls back to the auxiliary model's detected context (e.g. 256K) instead of the user's override (e.g. 1M), causing spurious warnings and auto-lowered thresholds. Fix: store _custom_providers on self during __init__ and forward it to get_model_context_length() in _check_compression_model_feasibility(). Closes NousResearch#19539
d635134 to
004714d
Compare
This was referenced May 6, 2026
Closed
Closed
Contributor
Author
|
Closing: this PR has merge conflicts and the codebase has moved on. Will re-submit if the fix is still needed. |
Closed
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The compression feasibility check in
_check_compression_model_feasibility()callsget_model_context_length()without passingcustom_providers, so per-modelcontext_lengthoverrides fromcustom_providersconfig are ignored. The check falls back to the auxiliary compression model's detected context window (e.g. 256K) instead of the user's configured override (e.g. 1M), causing spurious warnings and auto-lowered compression thresholds.Root Cause
get_model_context_length()supports acustom_providersparameter (added in #15779) that checks per-modelcontext_lengthoverrides before probing endpoints. However, the feasibility check atrun_agent.py:2657was not passing this parameter.The
_custom_providerslist was resolved during__init__but only used for the main model's context length resolution, not stored onselffor the feasibility check to access.Fix
_custom_providersonselfalongside_config_context_length(line 1949).custom_providers=getattr(self, '_custom_providers', None)toget_model_context_length()in_check_compression_model_feasibility().Testing
pytest -k compress).test_compression_feasibility.pyassertions to verify the new parameter is forwarded.Scope
run_agent.py: 2 lines addedtests/run_agent/test_compression_feasibility.py: 3 assertion updatesCloses #19539