diff --git a/run_agent.py b/run_agent.py index a3a2b6d58..8b53d030c 100644 --- a/run_agent.py +++ b/run_agent.py @@ -6640,11 +6640,15 @@ class AIAgent: # Without this, compression decisions use the primary model's # context window (e.g. 200K) instead of the fallback's (e.g. 32K), # causing oversized sessions to overflow the fallback. + # Also pass _config_context_length so the explicit config override + # (model.context_length in config.yaml) is respected — without this, + # the fallback activation drops to 128K even when config says 204800. if hasattr(self, 'context_compressor') and self.context_compressor: from agent.model_metadata import get_model_context_length fb_context_length = get_model_context_length( self.model, base_url=self.base_url, api_key=self.api_key, provider=self.provider, + config_context_length=getattr(self, "_config_context_length", None), ) self.context_compressor.update_model( model=self.model,