fix(llm): use validated messages variable in non-streaming handlers#5655
Merged
greysonlalonde merged 2 commits intomainfrom Apr 29, 2026
Merged
fix(llm): use validated messages variable in non-streaming handlers#5655greysonlalonde merged 2 commits intomainfrom
greysonlalonde merged 2 commits intomainfrom
Conversation
iris-clawd
approved these changes
Apr 29, 2026
Contributor
iris-clawd
left a comment
There was a problem hiding this comment.
LGTM — uses the already-validated local messages variable instead of re-indexing params. Clean fix.
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
_handle_non_streaming_responseand_ahandle_non_streaming_response, theresponse_model+ litellm path validatesmessagesviaparams.get("messages", [])and raises a clearValueErrorif missing, but then re-indexesparams["messages"]a few lines later when calling_handle_emit_call_events— which would raise a confusingKeyErrorinstead.messagesvariable in both call sites.Note
Low Risk
Small, localized change to event payload wiring in the non-streaming
response_modelpath; no changes to completion behavior or data processing.Overview
Fixes event emission in
_handle_non_streaming_responseand_ahandle_non_streaming_responsewhenresponse_modelis used with the LiteLLM path.Instead of re-indexing
params["messages"](which could raise aKeyErrordespite earlier validation), the code now passes the already-validated localmessagesvariable into_handle_emit_call_events, preserving the intendedValueErrorfor missing messages.Reviewed by Cursor Bugbot for commit 9d029bc. Bugbot is set up for automated code reviews on this repo. Configure here.