Skip to content

fix: model gateway calls in the Responses input union - #464

Merged
maralbahari merged 3 commits into
vllm-project:mainfrom
awesome-pro:fix/reject-unsupported-input-items
Oct 20, 2026
Merged

maralbahari merged 3 commits into
vllm-project:mainfrom
awesome-pro:fix/reject-unsupported-input-items

Conversation

@awesome-pro

@awesome-pro awesome-pro commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

summary

part of #452.

input items whose type was not modeled deserialized to InputItem::Unknown and were dropped before inference and storage, so a gateway-executed request could succeed while quietly losing part of its input.

  • InputItem derives its tagged deserialization from the variants it supports. an unmodeled discriminator fails at the request boundary instead of becoming an unknown item.
  • web_search_call and mcp_call are typed variants that reuse the payloads already defined for outputs, so their action, sources, output, and error fields survive replay. accepting them no longer means keeping only a type name.
  • shorthand messages (no type) still deserialize: the implicit message discriminator is filled before the derived deserializer runs. an explicitly supplied discriminator is never rewritten, so an unsupported item with role and content fails as an unknown variant instead of becoming a message.
  • item ids, id prefixes, token estimates, and conversation-item handling cover the two new variants; the exhaustive matches and the InputItem OpenAPI schema are updated.

the executor-side validation, the string allowlist, and the dedicated error variant from the earlier revision are removed.

test plan

  • cargo test -p agentic-server-core --lib types::io::input covers payload preservation for the new variants, rejection of unmodeled types, and shorthand messages (including an explicit unsupported discriminator not being rewritten).
  • cargo test -p agentic-server --test responses_test sends computer_call with store: true and store: false and asserts the request fails at the boundary with nothing reaching the upstream.
  • cargo test -p agentic-server --lib openapi validates the InputItem schema, including the two new variants, against every fixture the deserializer accepts.
  • cargo test --workspace, fmt, clippy -D warnings, and the production file-size check are clean.

notes

  • stored rows written by the previous build as {"type": "unknown"} no longer parse as input items; they are skipped on read, matching the old unknown handling.
  • ResponsesInput is an untagged enum, so the client-facing message for an unmodeled entry is serde's untagged text. the status and envelope are the existing invalid-request ones.

@awesome-pro
awesome-pro force-pushed the fix/reject-unsupported-input-items branch from 541b0b3 to dc4fbbd Compare October 19, 2026 12:16
@awesome-pro awesome-pro changed the title fix: reject unsupported Responses input items fix: model gateway calls in the Responses input union Oct 19, 2026
@awesome-pro
awesome-pro force-pushed the fix/reject-unsupported-input-items branch from dc4fbbd to 329e6e4 Compare October 19, 2026 12:28
serde_json::json!({"type": "mcp_list_tools", "id": "mlt1", "server_label": "s", "tools": []}),
serde_json::json!({"type": "compaction", "id": "cmp1", "encrypted_content": "enc"}),
serde_json::json!({"type": "compaction_trigger"}),
serde_json::json!({"type": "web_search_call", "id": "ws1", "status": "completed", "action": {"type": "search", "query": "q"}}),

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.

the new web_search_call fixture fails openapi::tests::serialized_fixtures_validate_against_component_schemas: the generated InputItem oneOf does not accept a value that now deserializes as InputItem::WebSearchCall. this leaves the documented request schema behind the typed input contract. we should update the InputItem OpenAPI schema for both new variants and get this fixture test passing.

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.

fixed in 58b9ef0: InputItem's schema now has web_search_call and mcp_call branches, same shape as OutputItem's, and the fixture test passes. i had only run the openapi_test integration binary, not the lib tests, so i missed it.

pushing also surfaced a second one: input_file_repro seeds a stored item through a direct InOutItem parse, which now needs the explicit message tag. stored rows always serialize it, so only the fixture changed. cargo test --workspace and clippy are green now.

Input items whose type was not modeled deserialized to InputItem::Unknown and
were dropped before inference and storage, so a gateway-executed request could
silently lose part of its input.

InputItem now derives its tagged deserialization from the variants it supports,
so an unmodeled discriminator fails at the request boundary instead of becoming
an unknown item. web_search_call and mcp_call become typed variants that reuse
the output payloads, so their action, sources, output, and error fields survive
replay. Shorthand messages still omit the discriminator; the default is filled
before the derived deserializer runs, so an explicit unsupported discriminator
is never mistaken for a message.

Refs vllm-project#452

Signed-off-by: Abhinandan <[email protected]>
@awesome-pro
awesome-pro force-pushed the fix/reject-unsupported-input-items branch from 329e6e4 to 58b9ef0 Compare October 20, 2026 03:57
@awesome-pro

Copy link
Copy Markdown
Contributor Author

thanks, reworked along those lines, plus the schema fix.

  • InputItem derives Deserialize with the existing type tag. the variant list is now the accepted-shape list, so computer_call, image_generation_call, file_search_call, local_shell_call, and mcp_approval_response fail at the request boundary instead of becoming an unknown item.
  • web_search_call and mcp_call are typed variants reusing the output structs; their action, sources, output, and error fields survive replay.
  • shorthand messages are preserved without a dispatcher: the implicit message tag is filled before the derived deserializer runs, and an explicit discriminator is never rewritten, so an unsupported item with role/content fails rather than becoming a message.
  • ResponsesInput keeps its derive; only the item array fills the shorthand default.
  • removed validate_input_items, the string allowlist, and UnsupportedInputItem, and updated the exhaustive matches, id/prefix rules, token estimates, and OpenAPI fixtures. InputItem's schema in types/io/input/openapi_schemas.rs now has the two new branches, so serialized_fixtures_validate_against_component_schemas passes.
  • input_file_repro seeds a stored item with a direct InOutItem parse, which now needs the explicit message tag; stored rows always serialize it, so only the fixture changed.

tests cover payload preservation, boundary rejection with store: true and false (nothing reaches the upstream), and shorthand. cargo test --workspace, fmt, clippy -D warnings, and the file-size check pass.

one note: ResponsesInput is untagged, so the client-facing message for an unmodeled entry is serde's untagged text rather than the inner unknown-variant message. the status and envelope are the existing invalid-request ones; say if you want that surfaced differently.

@maralbahari

Copy link
Copy Markdown
Collaborator

thanks, reworked along those lines, plus the schema fix.

  • InputItem derives Deserialize with the existing type tag. the variant list is now the accepted-shape list, so computer_call, image_generation_call, file_search_call, local_shell_call, and mcp_approval_response fail at the request boundary instead of becoming an unknown item.
  • web_search_call and mcp_call are typed variants reusing the output structs; their action, sources, output, and error fields survive replay.
  • shorthand messages are preserved without a dispatcher: the implicit message tag is filled before the derived deserializer runs, and an explicit discriminator is never rewritten, so an unsupported item with role/content fails rather than becoming a message.
  • ResponsesInput keeps its derive; only the item array fills the shorthand default.
  • removed validate_input_items, the string allowlist, and UnsupportedInputItem, and updated the exhaustive matches, id/prefix rules, token estimates, and OpenAPI fixtures. InputItem's schema in types/io/input/openapi_schemas.rs now has the two new branches, so serialized_fixtures_validate_against_component_schemas passes.
  • input_file_repro seeds a stored item with a direct InOutItem parse, which now needs the explicit message tag; stored rows always serialize it, so only the fixture changed.

tests cover payload preservation, boundary rejection with store: true and false (nothing reaches the upstream), and shorthand. cargo test --workspace, fmt, clippy -D warnings, and the file-size check pass.

one note: ResponsesInput is untagged, so the client-facing message for an unmodeled entry is serde's untagged text rather than the inner unknown-variant message. the status and envelope are the existing invalid-request ones; say if you want that surfaced differently.

@awesome-pro Thanks for addressing the feedback! I’ve pushed a small correction to handle shorthand messages through the typed discriminator and derived deserialization, removing the extra preprocessing helpers. Once CI passes, I’ll approve and merge.

@maralbahari
maralbahari merged commit 964ac38 into vllm-project:main Oct 20, 2026
15 checks passed
haoshan98 added a commit to EmbeddedLLM/agentic-api that referenced this pull request Oct 29, 2026
Addresses review comment 4385842254: converting replayed gateway-executed
call items is out of scope for hosted tool search and moves to a
follow-up issue covering every gateway item type.

- Remove replayed_calls.rs, the MCP naming that served it (mcp_names.rs,
  the mcp half of HistoryNaming) and their tests. internal_mcp_tool_name
  is private to mcp/handler.rs again, as on main; stable_name_hash moves
  to utils::common for its two users.
- The model-input projection lowers only tool_search items and
  compaction checkpoints. A replayed mcp_call or web_search_call reaches
  vLLM unchanged, as on main; one referenced by id is left out of model
  input, as on main. vllm-project#464's canonical-history test is back to main's
  assertions.
- The gateway leg of the hosted tool-search replay cassette is dropped
  (it replays mcp_call items); the OpenAI reference recording stays as
  parity evidence.
- Docs and CHANGELOG state the known gap.

Signed-off-by: haoshan98 <[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