Repository navigation
SWF(bug): reject malformed logit_bias token keys - #53
Merged
maplepaladin73 merged 1 commit intoNov 22, 2026
Merged
Conversation
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration
Bot
force-pushed
the
devin/1795371417-reject-malformed-logit-bias
branch
from
November 22, 2026 18:30
e207e72 to
79e63c1
Compare
6 of 7 tasks
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
/v1/completionsand/v1/chat/completionsnow return a 400invalid_request_error(param: logit_bias) for alogit_biaskey that is not au32token id (e.g."abc"). Before, the key was dropped and the request ran without that bias.Failing run (regression test on unfixed code):
Passing run (with fix):
Full
sparktest binary (rebased on main after #51):3201 passed; 0 failed; 14 ignored.The tests call both handlers, blocking and streaming. They check that a malformed key returns 400 and never reaches the scheduler, and that valid, empty and absent maps still reach the scheduler unchanged.
Root cause: both lowering paths (
completions.rsand chat'sopenai/to_ir.rs) turn the wire map into(u32, f32)pairs withfilter_map(|(k, v)| k.parse::<u32>().ok() ...). A failed parse becomesNoneand is silently discarded, and nothing earlier checks the keys. The newvalidate_logit_biasruns in both handlers before dispatch, next to the other request validations, and uses the existingopenai_error_response_with_paramhelper. Valid requests take the same path as before.Try it:
(needs
bash scripts/ci_gpu_stubs.shon a GPU-less box)Test plan
cargo fmt --all -- --check && ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo clippy --workspace --tests && bash scripts/check-license-headers.sh && typos: exit 0api/logit_bias_tests.rs)Notes for reviewers
mainafter SWF(bug): restore spark test build broken by stray tokio::test attributes #51. All runs above are from the rebased branch with no local changes.completions.rsis already on the file-size allow-list (547 → 550 LoC).CLA
Implemented in session Reject malformed logit_bias token keys
Review with Devin · Open in Devin Desktop