Skip to content

feat: validate Responses capabilities per model - #512

Merged
maralbahari merged 2 commits into
vllm-project:mainfrom
skyloevil:codex/responses-model-capabilities
Nov 16, 2026
Merged

maralbahari merged 2 commits into
vllm-project:mainfrom
skyloevil:codex/responses-model-capabilities

Conversation

@skyloevil

@skyloevil skyloevil commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Use the existing [models] configuration and shared core capability resolver for both the Codex catalog and Responses admission. Fold cache and model checks into RequestPayload::ensure_supported_parameters() with typed errors at core admission, WebSocket preflight, and summary inference.

Type reasoning effort, service tier, and top_logprobs. Preserve omitted/null/integer top_logprobs upstream, reject same-name Rust extra entries, and keep actual response tiers and stored response reasoning strings compatible. Share the immutable capability table across cloned transport state.

Explicit reasoning lists now also constrain requests; catalog fallback levels do not. Unknown effort/tier values and malformed logprobs fail decoding for every model. WebSocket decode errors retain existing checkpoint cleanup, while typed admission rejections preserve the parent for retry.

Merged current main and updated configuration/API documentation.

Part of #330. The agreed compaction cache_salt fix remains separate; this PR does not close the issue.

Test Plan

  • Workspace tests with OpenAPI and required conversation cassettes: 3153 passed, 26 ignored. Two existing macOS Messages connection-refusal tests return 504 instead of 502; both failures were reproduced on unmodified upstream main a3f1239. No new failures.
  • Includes HTTP JSON/SSE and storage variants, WebSocket parent retries/parse failures, compaction and recorded replays, model catalog compatibility, OpenAPI, and split-context hydrate/seal/persist/continuation coverage.
  • Workspace/all-target Clippy with OpenAPI, server build, and core/server checks without default features passed. The latter retains an existing unused-import warning in conversation_items.rs.
  • Full pre-commit 4.4.0 (including Rust file sizes and formatting), diff checks, and strict MkDocs build passed.

@sohom-cs

sohom-cs commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

One gap this doesn't cover: cache_salt is still dropped on every compaction path. summarize_items builds the summary request with request_payload() (cache_salt: None) and copies only the prompt-cache fields and service_tier, and CompactRequest has no cache_salt, so /v1/responses/compact ignores it. The summary request carries the whole conversation but reaches vLLM without the salt. #506's summary_settings() doesn't copy it either. I have a fix with tests and will open it separately, unless you'd rather fold it in here.

Copy link
Copy Markdown
Contributor Author

Thanks for catching this, @sohom-cs. A separate PR sounds good. Please link it to #330 so we can include the fix before closing the issue.

@maralbahari maralbahari left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this. I agree with the goal in #330 of keeping per-model validation configurable, so Astra restrictions don't become global restrictions on vLLM models. But the PR adds a second capability type, a second config table and a second validation function next to ones we already have. I'd like it built on the existing pieces.

Where validation is today

Request validation lives on the request types in types/, not in executor modules:

  • The request is decoded at ingress into the typed RequestPayload, so shape errors (wrong types, unknown enum values such as prompt_cache_retention) are rejected there.
  • Parameters the gateway can't honour are rejected by RequestPayload::ensure_supported_parameters() (types/request_response/unsupported.rs), with a typed UnsupportedParameterError whose param() and code() produce OpenAI's error envelope. It runs at admission in rehydrate.rs.
  • Upstream capability is checked by RequestPayload::validate_prompt_cache_options(supported) (types/request_response/prompt_cache.rs), at the same admission point plus the summary request in compaction.rs and the WebSocket handler before a continuation takes its checkpoint. Its input is the deployment-wide responses.prompt_cache_options_supported.
  • Model-input rules, such as how reasoning is lowered for vLLM, are in ResponsesInput::normalized_model_input (types/io/input/conversions.rs).
  • Per-model capabilities are configured in [models.<id>] (ModelFileConfig) and resolved by ModelCapabilities (ModelOverride { input_modalities, supported_reasoning_levels }). Today they feed the /v1/models and Codex catalogs, not admission.

The inline comments show how each new piece can extend these instead: one place to configure a model, one typed value per setting, and one check.

#330 is about preserving prompt-cache controls and service tiers across execution paths; this PR adds rejection, not preservation, so it shouldn't close the issue. Please change "Closes #330" to "Part of #330". The branch also conflicts with main now.

pub logprobs_supported: Option<bool>,
/// Accepted explicit reasoning efforts, using the upstream's vocabulary.
#[serde(skip_serializing_if = "Option::is_none")]
pub reasoning_efforts: Option<Vec<String>>,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supported_reasoning_levels (SupportedReasoningLevels(Vec<ReasoningEffortLevel>)) already models this and rejects empty lists and duplicates. As plain strings, a typo such as "hgih" is accepted silently, and an empty list rejects every effort. Please validate against supported_reasoning_levels, so what the catalog advertises and what the gateway accepts can't disagree, and type the request's reasoning.effort as the same ReasoningEffortLevel (moved into core) instead of comparing strings.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The request and configuration now share ReasoningEffortLevel, including none and minimal. Explicit supported_reasoning_levels lists govern admission; catalog defaults don't. Empty lists and duplicate entries are rejected.

#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_cache_options_supported: Option<bool>,
#[serde(skip_serializing_if = "BTreeMap::is_empty")]
pub models: BTreeMap<String, ResponsesModelPolicy>,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds [responses.models.<id>] beside the existing [models.<id>] (ModelFileConfig, with supported_reasoning_levels a few lines above). Operators would configure the same model in two places with no link between them. These fields belong in ModelFileConfig.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved these settings into ModelFileConfig under [models.<id>] and removed [responses.models]. Updated the examples and startup validation.

skyloevil commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

@maralbahari Thanks for the review. I plan to address this in the current PR:

  • Extend the existing [models] configuration and move the shared capability types/resolver into core, so the catalog and admission use the same configuration.
  • Reuse typed reasoning levels, including none and minimal for models that support them. Share the request tier type with configuration, and type top_logprobs while preserving omitted versus explicit null.
  • Fold the checks into ensure_supported_parameters() and use UnsupportedParameterError, keeping the core admission, WebSocket preflight, and summary call sites.

Only explicitly configured reasoning levels would restrict requests; the catalog’s fallback levels would remain display defaults. Existing explicit lists would therefore govern both the catalog and admission.

One compatibility detail I’d like to confirm: strict typing moves unknown effort/tier values and malformed top_logprobs into the existing WebSocket parse-error path, which evicts the matching transient parent. Valid values rejected by model policy would still preserve the parent for retry. I suggest keeping that distinction and adding regression coverage. Does that match your expectation?

I’ll also cover direct Rust construction through extra, catalog output compatibility, and split-context round trips. I’ll sync with main and change this to Part of #330; the agreed cache_salt fix remains separate.

Copy link
Copy Markdown
Contributor Author

Proposed flow for the changes in my previous comment:

flowchart TD
    A["[models] configuration"] --> B["ModelFileConfig"]
    B --> C["ModelOverride / ModelCapabilities in core"]
    C --> D["Codex model catalog"]
    C --> E["Explicit overrides for the requested model"]
    F["Deployment-wide cache-options fallback"] --> G["RequestPayload::ensure_supported_parameters()"]
    E --> G
    G -->|Accepted| H["Continue execution"]
    G -->|Rejected| I["Typed parameter error"]
Loading

Catalog display defaults do not become admission limits. The same validation is called at core admission, WebSocket preflight before acquiring a parent checkpoint, and summary inference.

Merge upstream main, share typed model configuration between catalog and admission, and preserve request parameter forwarding and WebSocket error semantics.

Signed-off-by: zitian.zhao <[email protected]>

Copy link
Copy Markdown
Contributor Author

@maralbahari I've addressed your feedback, and CI is passing. Could you take another look when you have a chance? Thanks!

@maralbahari maralbahari left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skyloevil Thanks for the work and providing the diagram helping the review.

@maralbahari
maralbahari merged commit b27ecd5 into vllm-project:main Nov 16, 2026
17 checks passed
LeaderOnePro added a commit to LeaderOnePro/agentic-api that referenced this pull request Nov 16, 2026
Bring in model capability validation (vllm-project#512), unknown conversation id
rejection (vllm-project#531), persisted-turn documentation (vllm-project#533), and the shared
input-item test helper (vllm-project#545).

Signed-off-by: LeaderOnePro <[email protected]>
sohom-cs added a commit to sohom-cs/agentic-api that referenced this pull request Nov 17, 2026
…salt

vllm-project#512 typed service_tier as a Copy ServiceTier, so summary_settings()
copies it instead of cloning; this branch's cache_salt line stays.

Signed-off-by: Sohom Chakraborty <[email protected]>
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.

3 participants