Return error if the chat answer is empty#487
Merged
Merged
Conversation
josephjclark
approved these changes
May 11, 2026
Collaborator
josephjclark
left a comment
There was a problem hiding this comment.
I've not been able to repro but this looks good.
Interesting use of mocking. Let's consider this pattern more when we come to the proper integration tests
I've added a changeset and will prep the release
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.
Short Description
workflow_chat,global_chat, andjob_chatcould return HTTP 200 with response:""when the LLM produced no usable text. Lightning treated the 200 as success leaving the user-side message stuck in:processing. Each service now raises ApolloError when there's no usable text, so Lightning's handle_error_response routes it into the error tuple.Fixes #484
Implementation Details
ApolloError usage
Each service raises
ApolloError(502, ...)when text output is empty after the existing retry/loop logic. Type isOUTPUT_TRUNCATEDforstop_reason=max_tokens,EMPTY_OUTPUTotherwise. Code and types are new values within the existingApolloErrorshape.Sentry tracking
We attach Sentry reporting before each raise.
entry.py's existing capture_exception records one event per failed request.Tests
Added temporary tests in separate test files that won't run automatically. This is to avoid conflicts from our testing architecture which is currently in progress. These tests will need to be rewritten to fit into the new tests.
AI Usage
Please disclose how you've used AI in this work (it's cool, we just want to know!):
You can read more details in our Responsible AI Policy