fix: preserve result body in async FAILURE responses#178
Merged
Conversation
lilyz-ai
approved these changes
Mar 26, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
d638fbb to
e5a0824
Compare
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.
Summary
resultas a plain string (stringified exception message) onFAILURE, not a nested dict withresult/result_urlkeysFAILUREbranch to readresultdirectly fromasync_responseinstead of trying to unpack it as a dictresult_urlis alwaysNoneon failure — no model output is produced when a task failsstr(res.result)andres.tracebackinGetAsyncTaskV1ResponseforFAILUREstatesTest Plan
test_endpoint_response_future_failure_preserves_resultto reflect the new response shape:resultis a plain string,tracebackis the full stack tracetest_endpoint_response_future_failure_no_result_bodystill covers theNoneresult case (e.g. hard pod kill)Greptile Summary
This PR fixes the
FAILUREbranch inEndpointResponseFuture.get()to correctly preserve theresultfield from async task responses. Previously, onFAILURE, theresultwas hardcoded toNone, discarding the server's stringified exception message. Now,resultis read directly fromasync_response(via.get("result", None)), aligning with the updated llm-engine server behavior whereresultis a plain string on failure rather than a nested dict.launch/model_endpoint.py: Changedresult=Nonetoresult=async_response.get("result", None)in theFAILUREbranch, preserving the error message from the server.tests/test_model_endpoint.py: Added two new tests — one verifying thatresultandtracebackare correctly populated on failure, and another covering theNoneresult case (e.g., pod crash with no response body).Confidence Score: 5/5
This PR is safe to merge — it is a minimal, well-tested bug fix with no risk of regression.
The change is a single-line fix that replaces a hardcoded None with a safe .get() call. The behavior for SUCCESS is untouched. Two new tests directly cover the changed code path, including the edge case. No breaking changes to the public API.
No files require special attention.
Important Files Changed
Sequence Diagram
sequenceDiagram participant User participant EndpointResponseFuture as EndpointResponseFuture.get() participant Client as LaunchClient participant Server as llm-engine User->>EndpointResponseFuture: get() loop Poll until terminal status EndpointResponseFuture->>Client: _get_async_endpoint_response() Client->>Server: GET /async-task/{id} Server-->>Client: {status, result, traceback, status_code} Client-->>EndpointResponseFuture: async_response dict end alt status == SUCCESS EndpointResponseFuture-->>User: EndpointResponse(result=response.result.result, result_url=response.result.result_url) else status == FAILURE Note right of EndpointResponseFuture: Before: result=None (discarded)<br/>After: result=async_response["result"] (preserved) EndpointResponseFuture-->>User: EndpointResponse(result=error_string, traceback=traceback, result_url=None) endReviews (2): Last reviewed commit: "fix: preserve result body in async FAILU..." | Re-trigger Greptile