fix: preserve config_context_length when switching models - #6844
Conversation
When switching models at runtime, the config_context_length override was not being passed to the new context compressor instance. This meant the user-specified context length from config.yaml was lost after a model switch. - Store _config_context_length on AIAgent instance during __init__ - Pass _config_context_length when creating new ContextCompressor in switch_model - Add test to verify config_context_length is preserved across model switches Fixes: quando estamos alterando o modelo não está alterando o tamanho do contexto
… credential check When opencode-go API key is set, it should appear in the /model list. The provider was already in PROVIDER_TO_MODELS_DEV and PROVIDER_REGISTRY, so it appears via Part 1 (built-in source). Also fixes a potential issue in Part 2 (HERMES_OVERLAYS) where providers with auth_type=api_key but no extra_env_vars would not be detected: - Now also checks api_key_env_vars from PROVIDER_REGISTRY for api_key auth_type - Add test verifying opencode-go appears when OPENCODE_GO_API_KEY is set
|
In Observation: The Question: In |
|
Merged via PR #7187. Both commits cherry-picked with your authorship preserved. Thanks for both fixes! |
Problem
When switching models at runtime via
/model <new-model>, the customconfig_context_lengthoverride from config.yaml was not being passed to the new ContextCompressor instance. This caused the user-specified context length to be lost after a model switch.Fix
_config_context_lengthon AIAgent instance during__init___config_context_lengthwhen creating new ContextCompressor inswitch_model()config_context_lengthis preserved across model switchesTesting
tests/run_agent/test_switch_model_context.pywith 2 test cases:test_switch_model_preserves_config_context_length- verifies config override is preservedtest_switch_model_without_config_context_length- verifies behavior when no override is setFixes: quando estamos alterando o modelo não está alterando o tamanho do contexto