Skip to content

fix(pixel-gateway): validate logprobs boolean and top_logprobs integer bounds - #6334

Closed
vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/pixel-gateway-logprobs-bounds
Closed

vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/pixel-gateway-logprobs-bounds

Conversation

@vaibhavsrv

Copy link
Copy Markdown
Contributor

Why this matters

In ods/bin/pixel_provider/runtime_gateway.py, the validate_request routine admits logprobs and top_logprobs without verifying boolean constraints, integer limits, or mutual dependency. Clients supplying non-boolean values for logprobs (e.g. string "true" or integers 1/0), top_logprobs values outside the allowed $[0, 20]$ integer range, or top_logprobs without enabling logprobs: True bypass validation and trigger unhandled downstream API errors or backend inference failures.

This change surgically enforces that logprobs must be a boolean and top_logprobs must be an integer between 0 and 20 requiring logprobs: True in validate_request, rejecting invalid configurations with invalid-inference-request. Valid token log probability configurations remain fully supported.

Validation

  • Baseline reproduction: Payloads specifying logprobs: "true", top_logprobs: 25, or top_logprobs: 5 without logprobs: True were accepted by validate_request.
  • Post-fix behavior: Requests with malformed logprobs types or out-of-bounds top_logprobs raise RuntimeErrorCode('invalid-inference-request'). Valid boolean flags and top_logprobs in $0..20$ pass cleanly.
  • Telemetry: Pixel gateway suites: 4 passed. New-test Ruff, ShellCheck, and diff checks pass; new regressions wired into Linux CI.

Overlap check

Recent PRs #6333 (stop parameter validation in runtime gateway), #6332 (presence and frequency penalty bounds in runtime gateway), and #6331 (seed integer type guard in runtime gateway) harden other request attributes in runtime_gateway.py. This PR isolates checks exclusively to logprobs and top_logprobs without conflicting with adjacent parameters.

Risk / AI disclosure

AI-assisted investigation, implementation and CLI regressions. This strengthens an API validation check, not runtime admission. Independent human review and platform/runtime qualification remain gates. No running configuration, deployment or upstream merge changed.

Follow-up integration evidence

Composed with #6333 at bd263e6 without conflicts. Production and test diffs passed together; gateway and runtime 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.

@Lightheartdevs

Copy link
Copy Markdown
Collaborator

Thanks for this contribution. public-beta was promoted into main on 2026-09-24 and no longer receives changes, so we're closing pull requests that target it. This isn't a judgment on the change itself. If it's still needed, please rebase onto main and open a focused PR. See #7253 for details and the contribution policy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants