Skip to content

fix(responses): type and echo safety_identifier on responses - #569

Merged
franciscojavierarceo merged 1 commit into
vllm-project:mainfrom
justrightnow:fix/safety-identifier-request-echo
Nov 19, 2026
Merged

franciscojavierarceo merged 1 commit into
vllm-project:mainfrom
justrightnow:fix/safety-identifier-request-echo

Conversation

@justrightnow

Copy link
Copy Markdown
Contributor

Summary

Fixes #568.

The OpenAI contract defines safety_identifier as both a request parameter and an effective response field (it replaces the deprecated user field). The gateway declared StandardResponseFields.safety_identifier but never populated it: inbound values landed in the untyped extra map and the public Responses object always echoed null.

This change models safety_identifier as a typed request field and mirrors the existing prompt_cache_key path end to end:

  • parse from /v1/responses and /v1/responses/compact requests (string or explicit null → absent; non-string rejected at admission);
  • forward unchanged to the upstream Responses request, including gateway tool rounds and compaction summary inference;
  • echo the current request's value on the Response object through the single apply_request path (HTTP JSON/SSE and stored GET snapshot);
  • expose it in the generated OpenAPI request schema and document it in the API control matrix;
  • continuations do not inherit it, matching the other current-request-only controls.

Test Plan

  • New unit tests: request parse/forward/null-omission/non-string rejection (types/request_response.rs) and response echo/clear (standard_response.rs).
  • New HTTP integration test responses_test::test_safety_identifier_is_forwarded_and_echoed_on_the_response asserts the mock upstream request and the public Response body both carry the value.
  • cargo fmt -- --check: clean.
  • cargo clippy --all-targets -- -D warnings: clean.
  • cargo test --workspace: all targets pass except two pre-existing, environment-specific messages_test cases (*_unreachable_upstream) that expect 502 but receive 504 on this host's loopback/proxy setup; the same two fail identically on unmodified origin/main.

Model safety_identifier as a typed request field, forward it unchanged upstream, and echo it on the response through the single apply_request path, matching the OpenAI contract and the existing prompt_cache_key behavior. Continuations and compactions do not inherit it. Fixes vllm-project#568.

Signed-off-by: Jack Wei <weike@chinamobile.com>
@franciscojavierarceo
franciscojavierarceo merged commit c5600bf into vllm-project:main Nov 19, 2026
17 checks passed
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.

Responses: safety_identifier is dropped from request typing and absent from response echoes

2 participants