fix: show budget-limit message on 429 instead of generic error - #51
Open
biswajitpanda-dev wants to merge 2 commits into
Open
fix: show budget-limit message on 429 instead of generic error#51biswajitpanda-dev wants to merge 2 commits into
biswajitpanda-dev wants to merge 2 commits into
Conversation
Collaborator
|
Hi! Can you please star the project so i can assign to you the issue? Tnx |
Collaborator
|
Can you fix the verifier? |
Author
|
Hi @AmitAvital1 , I just starred the project, please assign the issue to me. |
Collaborator
|
FE layer should be stateless as much as can, who handling the error should be BE and FE only parsing it or maybe detailed it with human read able string. GENERIC ERROR should be only if we got error not known but here we should upstream dedicated error, and check by 429 is good, but not enough. maybe we can do a little infra that we hold message on body and and FE parse just unmarshall and parse it |
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.
fix: show budget-limit message on 429 instead of generic error
Problem
When a conversation exceeds its
context_max_tokensbudget, the backend correctly returns HTTP 429. However, the widget rendered the generic"Something went wrong. Please try again."message — implying a transient failure and prompting the user to retry, even though every retry will also 429.Root Cause
submit()inAgentChatApp.tsxcaught all stream errors and attempted a non-streaming fallback (sendToAgent), which also 429s. The innercatchthen unconditionally rendered the generic error string, with no inspection of the HTTP status.Changes
AgentChatApp.tsxerror?: booleanfield toMessageEntrytype.submit(), detectAgentChatHttpError.status === 429before attempting the non-streaming fallback. When matched, immediately render a clear non-retriable message ("This conversation has reached its context limit. Please start a new chat to continue.") and skip the fallback entirely.shadcnAiElements.tsxerror?: booleanprop toMessage, which conditionally applies themsg-errorCSS class.styles.ts.msg.ai.msg-errorrule — red-tinted text, background, and border — to visually distinguish permanent error messages from normal AI responses.tests/agent_manager/test_api.pytest_send_returns_429_when_token_budget_exceededtest_stream_returns_429_when_token_budget_exceededTesting
Both new tests use a
ConversationServiceconfigured withmax_tokens=1, exhaust the budget with a first message, then assert the second returns429with"budget"in the detail — covering both the/messagesand/messages/streamendpoints.