fix(pixel-inference): validate finite float bounds for temperature parameter - #5714
Open
Vishaaallll wants to merge 1 commit into
Open
Vishaaallll wants to merge 1 commit into
Vishaaallll wants to merge 1 commit into
Conversation
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.
Why this matters
In
ods/extensions/services/pixel-inference/app/main.py,FIELDSacceptedtemperaturein the request payload, but_prepare(payload, grant)omitted range and type validation for the parameter. If a caller supplied non-numeric types, boolean values, non-finite values (NaN,inf), or values outside the standard[0.0, 2.0]sampling range, the invalid value passed unvalidated to the backend inference runtime, causing runtime crashes or undefined sampling distribution behavior.This surgical fix validates that
temperature, when present, is a non-boolean finite float or integer within[0.0, 2.0], raisingShareError(400, 'invalid_temperature')otherwise.Validation
_prepare({"model": "ods/shared", "messages": [{"role": "user", "content": "hi"}], "temperature": -0.5}, grant)passed without error on unpatched code.invalid_temperature.pixel-inference suite: 2 passed. New-test Ruff, syntax, and diff checks pass; new regression wired into Linux CI.Overlap check
Searched open/closed PRs on
Osmantic/ODS. PR #5616 touched capabilities limits and #5696 touched settings contracts. Neither addresses request-time inference parameter bounds inpixel-inference/app/main.py.Risk / AI disclosure
AI-assisted investigation, patch, and regression tests. Strictly validates incoming HTTP inference payload parameters against the OpenAI specification. Independent review remains a gate.
Follow-up integration evidence
Composed locally with public-beta at
4fa6ad170without conflicts. Regression tests pass locally and in Linux CI.