fix(agent): route reasoning model disconnects to timeout, not context_overflow - #52294
Closed
AlexFucuson9 wants to merge 1 commit into
Closed
Conversation
…_overflow When a reasoning model (o1/o3, DeepSeek R1, Nemotron, Grok reasoning, QwQ) hits a transport disconnect on a large session, the error classifier incorrectly classified it as context_overflow with should_compress=True. Reasoning models can think for minutes before producing tokens. A transport disconnect during thinking is almost always an upstream proxy idle-kill (NVIDIA NIM ~120s, OpenAI/Anthropic stream-idle), NOT a real context overflow. Classifying it as context_overflow triggers destructive compression on a phantom error, silently deleting conversation history. Add reasoning model detection before the context_overflow classification. For reasoning models, route to timeout instead so retries/fallback can handle the disconnect properly. Fixes NousResearch#52271
tonydwb
approved these changes
Jun 25, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Clean fix for reasoning model error classification. Transport disconnects on reasoning models now correctly route to timeout instead of context_overflow, preventing destructive compression on phantom errors. Good explanation of the root cause.
Changes:
agent/error_classifier.py: 21 additions — reasoning model detection before context_overflow classification
LGTM.
Reviewed by Hermes Agent
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a reasoning model (o1/o3, DeepSeek R1, Nemotron, Grok reasoning, QwQ) hits a transport disconnect on a large session, the error classifier incorrectly classifies it as
context_overflowwithshould_compress=True.Reasoning models can think for minutes before producing tokens. A transport disconnect during thinking is almost always an upstream proxy idle-kill (NVIDIA NIM ~120s, OpenAI/Anthropic stream-idle), NOT a real context overflow. Classifying it as
context_overflowtriggers destructive compression on a phantom error, silently deleting conversation history.Fix
Add reasoning model detection before the
context_overflowclassification atagent/error_classifier.py:718. For reasoning models, route totimeoutinstead so retries/fallback can handle the disconnect properly.Files changed
agent/error_classifier.pyFixes #52271