Expand databricks agent error handling to fallback to token limit errors #3535
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.
I noticed the UI shows a generic 401 unauthorized (occasionally) or 400 bad request from Databricks when a token limit is reached instead of kicking off the auto summarization. It doesn't recognize that its a token limit error because the message doesn't have the phrases we look for like "token limit" in the error message. It appears to be a token limit issue because manually using the summarize feature allows chat to continue while just sending a chat message without summarization does not.
This adds fallback logic to work around that and allows the UI to handle it gracefully by allowing chat to continue with auto summarize.