fix(server): handle stop and malformed messages - #2266
Open
Pouyanpi wants to merge 2 commits into
Open
Conversation
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
1 task
Pouyanpi
marked this pull request as ready for review
August 7, 2026 15:19
Contributor
Greptile SummaryThe PR fixes propagation of OpenAI-compatible stop parameters and adds early validation for chat messages missing a role.
|
| Filename | Overview |
|---|---|
| nemoguardrails/llm/call.py | Safely extracts stop parameters from a copied options dictionary and normalizes streaming-handler stop state. |
| nemoguardrails/server/schemas/openai.py | Adds permissive message-object validation that requires a string role while preserving extra OpenAI-compatible fields. |
| tests/llm/test_call.py | Covers stop precedence, input immutability, and streaming normalization across string, list, and null values. |
| tests/server/test_api.py | Covers malformed-message rejection and propagation of supported stop values into generation options. |
Reviews (1): Last reviewed commit: "fix(streaming): normalize string stop se..." | Re-trigger Greptile
RobGeada
approved these changes
Aug 11, 2026
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
Fixes NGUARD-880 stop handling, streaming normalization, and malformed-message validation.
AI Assistance
Stack Position
Part 2 of 2.
Stack Context
Moves llm_call tests first so the NGUARD-880 fix is reviewed as a small behavioral diff.
Please review each PR against its parent branch, not directly against the root base branch, except for part 1.
pouyanpi/refactor-llm-call-testsdeveloppouyanpi/fix-nguard-880-stop-and-messagespouyanpi/refactor-llm-call-testsValidation