Canonicalize volatile system prompt headers in OpenAI paths#528
Open
Thump604 wants to merge 1 commit into
Open
Canonicalize volatile system prompt headers in OpenAI paths#528Thump604 wants to merge 1 commit into
Thump604 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.
Refs #524.
Summary
x-anthropic-billing-headerstripper.Local repro / observed behavior
On current
waybarrios/vllm-mlxmain (f068991when this branch was cut), the Anthropic Messages adapter removesx-anthropic-billing-header:fromrequest.systeminvllm_mlx/api/anthropic_adapter.py::anthropic_to_openai, but the OpenAI server paths did not apply the same canonicalization:vllm_mlx/server.py::_prepare_chat_messagesvllm_mlx/server.py::_prepare_responses_requestA Chat Completions system message or Responses
instructionsvalue containing:was still present in the prepared system message sent to the engine.
Expected behavior
The validated billing-header line is non-semantic request metadata and should be removed from system-role text before engine execution. User-role content with the same text is preserved, and user-visible timestamp text is not stripped.
Minimal patch shape
vllm_mlx/api/prompt_canonicalize.pymodule with a static stripper list andcanonicalize_system_prompt().canonicalize_system_messages()helper that copies only changed system messages.Explicitly not claimed
Verification