fix(errorDetector): classify HTTP 400 context overflow responses correctly#9
Open
hariom888 wants to merge 1 commit into
Open
fix(errorDetector): classify HTTP 400 context overflow responses correctly#9hariom888 wants to merge 1 commit into
hariom888 wants to merge 1 commit into
Conversation
…dies classifyHttpError() returned 'unknown' for HTTP 400 errors without inspecting the response body, so context overflow responses were never reaching classifyApiError(). Fix: for status 400, delegate to classifyApiError() when a response body exists. Also expand overflow detection to recognize provider-specific wording like 'prompt is too long' and 'maximum'. This allows context-based routing fallback to work correctly for OpenAI and Anthropic overflow responses while leaving other status classifications unchanged.
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.
Fixes context overflow detection for providers that return HTTP 400 responses with overflow information embedded in the response body.
Previously, Anthropic-style errors such as:
prompt is too long: 130000 tokens > 100000 maximumwere classified as
unknowninstead ofcontext_overflow, preventing the router's context-based fallback strategy from activating correctly.Changes
Expanded context overflow detection logic in
errorDetectorAdded support for additional overflow indicators:
too longmaximumPreserved existing behavior for:
Verification
7 passed, 0 failed)Closes #6