Repository navigation
fix(pixel-inference): validate presence_penalty and frequency_penalty float bounds - #5941
Closed
vaibhavsrv wants to merge 1 commit into
Closed
vaibhavsrv wants to merge 1 commit into
vaibhavsrv wants to merge 1 commit into
Conversation
This was referenced Sep 19, 2026
Closed
Collaborator
|
Thanks for this contribution. |
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,_prepare(payload, grant)admitspresence_penaltyandfrequency_penaltydirectly without verifying that they conform to the canonical[-2.0, 2.0]floating point boundaries specified by the OpenAI completions protocol. When a request supplies an out-of-range value (e.g.5.0or-10.0) or non-numeric/boolean parameters (e.g.trueor string descriptions), the invalid argument is forwarded to the backend inference runtime, causing model server crashes, unexpected sampling failure, or unhandled 500 errors.This change adds a targeted loop validating both
presence_penaltyandfrequency_penaltyin_prepare. If either parameter is present, it verifies that its type isintorfloat(excludingbool) and that its value falls within[-2.0, 2.0], raisingShareError(400, f'invalid_{penalty}')on violation. All existing valid penalty values and omissions continue to behave identically.Validation
{"presence_penalty": 5.0}or{"frequency_penalty": True}bypassed checks and was admitted into the prepared payload.invalid_presence_penalty/invalid_frequency_penalty; valid values in[-2.0, 2.0]pass unmodified.Overlap check
temperaturebounds inpixel-inference.pixel_settings/contract.py.pixel_edge.py.pixel_gateway.This PR targets distinct penalty fields in
pixel-inference/app/main.pyand does not conflict with or duplicate concurrent PRs.Risk / AI disclosure
AI-assisted investigation, implementation, and regression verification. This strengthens request boundary validation and does not alter runtime execution or running containers. Independent human review and qualification remain gates.
Follow-up integration evidence
Composed cleanly on top of #5569, #5871, and #5875 at HEAD without conflicts. Production and test diffs passed together; adjacent pixel-agent and pixel-settings checks remain intact.
Backlog composition was local-only (production/test diffs, excluding workflow/Makefile wiring); it is not an upstream merge or independent human approval. Declared live-review gates remain open.