fix(agent): respect model.context_length config#37548
Conversation
Hermes CI triageCI is currently failing for this PR in two places:
if _config_context_length is not None and _ctx and _ctx < _config_context_length:
...
if _config_context_length is None and _ctx and _ctx < MINIMUM_CONTEXT_LENGTH:
...Also small style nit: Evidence: failing jobs |
|
The split logic removes the Original code (line 1476 on main): _ctx = getattr(agent.context_compressor, "context_length", 0)
if _ctx and _ctx < MINIMUM_CONTEXT_LENGTH:The PR code: if(_config_context_length is not None and _ctx < _config_context_length):When Suggested fix — restore the if _ctx and _config_context_length is not None and _ctx < _config_context_length:
raise ValueError(...)
if _ctx and _config_context_length is None and _ctx < MINIMUM_CONTEXT_LENGTH:
raise ValueError(...)This preserves the original "skip when unknown" behavior while adding the user-configured override path. A test for the |
What does this PR do?
This PR fixes #8430 in a exhaustive way, introducing proper context length checking in case the user has provided a model.context_length config.
Related Issue
#8430
Fixes #8430
Type of Change
Changes Made
How to Test
model.context_lengthin config to be less than 64000Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — N/Acli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/A