fix(agent): propagate custom provider context_length to compression feasibility check#13540
Conversation
1 similar comment
|
Related: PR #17460 takes a more general approach to the same problem. Instead of propagating |
1113227 to
90a0e1a
Compare
🔧 CI Test FixThe CI run 26390953273 on this branch failed with 7 test failures in Root cause: Fix (commit
git fetch https://github.com/talwayh1/hermes-agent.git fix/custom-provider-compression-ctx
git cherry-pick a1a6dc506All 16 tests + 3 new PR tests now pass. |
90a0e1a to
03d4755
Compare
…lity check call Two CI failures on PR NousResearch#13540: 1. check-attribution: hermes-ci-bot@nousresearch.com not in AUTHOR_MAP. Add the mapping so the CI bot's commits pass the attribution gate. 2. test_init_feasibility_check_uses_aux_context_override_from_config: The test was refactored to use assert_any_call but the explicit agent._check_compression_model_feasibility() call was accidentally dropped, so the mock recorded zero calls. Restore the call before the assertion since the feasibility probe is deferred from init.
CI FixesTwo CI failures have been fixed on 1. check-attribution ❌→✅Added 2. test_init_feasibility_check_uses_aux_context_override_from_config ❌→✅The deferred Cherry-pick: git fetch https://github.com/talwayh1/hermes-agent.git fix/custom-provider-compression-ctx
git cherry-pick 11ca03064 |
CI Test FixThe Fix: PR #32001 — re-adds the explicit Attribution failure (same branch) is handled by PR #31991 (adding No action needed from you — the test fix will land on |
ffde182 to
d1ebe73
Compare
c721b42 to
a751b99
Compare
What does this PR do?
When
custom_providerssets acontext_lengthfor the main model (e.g. 200K), the compression feasibility check didn't propagate this to the auxiliary model'sget_model_context_length()call when the aux model falls back to the main model. This caused a false-positive "compression model too small" warning and unnecessary threshold auto-lowering.Example from the issue:
custom_providerssetscontext_length=200000,threshold=0.65(130K). Without the fix, the aux query returns the built-in default 128K, which is below 130K — triggering a spurious warning.Three-part fix in
run_agent.py:_config_context_lengthaftercustom_providersresolution in__init__(was only set before the providers loop).aux_model == self.modeland base URLs match (the fallback scenario).get_model_context_length()with the correct config override, instead of reading the potentially-stalethreshold_tokensfrom the compressor.Related Issue
Closes #12977
Type of Change
Changes Made
run_agent.py:_config_context_lengthaftercustom_providersresolution in__init__._config_context_lengthto the aux-modelget_model_context_length()call when aux model falls back to the main model and base URLs match.get_model_context_length()instead of reading possibly-stalethreshold_tokensfrom the compressor.tests/run_agent/test_compression_feasibility.py:How to Test
Platform tested: macOS 15 (Apple Silicon).
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs