Repository navigation
fix(server): reject multiple completion prompts with a client error - #2418
Open
remote-controlled-man wants to merge 2 commits into
Open
remote-controlled-man wants to merge 2 commits into
remote-controlled-man wants to merge 2 commits into
Conversation
This branch has not been deployed
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.
Problem
POST /v1/completionswith{"prompt": ["first", "second"]}reaches an assertion and returns HTTP 500 with an empty internal error message. With Python optimization enabled, the assertion disappears and the server silently uses only the first prompt.The legacy
/v1/engines/copilot-codex/completionsroute shares this behavior, for both streaming and non-streaming requests.Change
Return HTTP 400 with
Only a single prompt is supported.before acquiring the model or creating a stream. Keep the existing behavior for string prompts, single-item arrays, and empty arrays.Add HTTP regression tests using the real application and a fake inference model. They cover both routes and streaming modes, multiple prompts (including two empty strings), and supported-input controls.
Validation
On macOS arm64, Python 3.12.14, with the native library built from the pinned llama.cpp submodule using the installed macOS 15.4 SDK:
python -O.-O; the 16 supported-input controls pass.make test: 54 passed, including the real-model fixtures and the HTTP regressions.make lint: Ruff checks pass and all 30 Python files pass the format check.The HTTP regressions isolate model loading; the full suite separately exercises the upstream real-model fixtures. No GPU/backend behavior is changed.