Fix SambaNova context length exception handling (#9252)

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Graham Neubig
2025-06-23 07:06:31 -04:00
committed by GitHub
parent 1e33624951
commit 9b4ad4e6e3
2 changed files with 140 additions and 0 deletions

View File

@@ -821,6 +821,11 @@ class AgentController:
or 'input length and `max_tokens` exceed context limit' in error_str
or 'please reduce the length of either one'
in error_str # For OpenRouter context window errors
or (
'sambanovaexception' in error_str
and 'maximum context length' in error_str
)
# For SambaNova context window errors - only match when both patterns are present
or isinstance(e, ContextWindowExceededError)
):
if self.agent.config.enable_history_truncation: