Skip to content

[None][fix] Chat Completions: accept the OpenAI store field - #20864

Merged
JunyiXu-nv merged 6 commits into
NVIDIA:mainfrom
JunyiXu-nv:dev-junyix-fix-chat-accept-store
Oct 26, 2026
Merged

JunyiXu-nv merged 6 commits into
NVIDIA:mainfrom
JunyiXu-nv:dev-junyix-fix-chat-accept-store

Conversation

@JunyiXu-nv

@JunyiXu-nv JunyiXu-nv commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Dev Engineer Review

  • ChatCompletionRequest now accepts store: Optional[bool] = None for OpenAI compatibility. The field is ignored because the server does not retain chat completions.
  • The change preserves rejection of unrelated unknown fields. It does not change the behavior of other request fields.
  • Test execution results are unavailable.

QA Engineer Review

  • Added tests/unittest/llmapi/apps/test_openai_protocol_chat_store.py and registered it in the CPU CI list.
  • Tests cover accepted values, the None default, JSON parsing, boolean-like coercion, invalid values, unchanged other fields, and rejection of unknown fields.
  • Coverage verdict: sufficient for the new field’s validation and unknown-field behavior. Test execution results are unavailable.

Per-File QA Perspective

  • tensorrt_llm/serve/openai_protocol.py: Verify that chat completion requests accept optional store, default it to None, and do not change completion storage behavior.
  • tests/unittest/llmapi/apps/test_openai_protocol_chat_store.py: Covers field validation, JSON parsing, coercion, and rejection behavior. The file is listed in test-db/l0_cpu.yml.
  • tests/integration/test_lists/test-db/l0_cpu.yml: Registers the new unit test for CPU CI.
  • tests/unittest/api_stability/references/trtllm_serve_api.yaml: Records store in the API stability reference. Verify that the reference remains aligned with the request model.

Description

ChatCompletionRequest forbids unknown fields (extra="forbid"), so a request that sets OpenAI's standard store field fails validation with HTTP 400. The pi coding agent sends store: false on every Chat Completions request unless its model config sets compat.supportsStore: false, so with default settings every pi turn against trtllm-serve is rejected before it reaches the model.

This PR accepts store as Optional[bool] = None and leaves it unused, like user and parallel_tool_calls: the server keeps no copy of a chat completion, so there is nothing to store. Other unknown fields are still rejected.

  • tensorrt_llm/serve/openai_protocol.py: the field, where the OpenAI reference orders it.
  • tests/unittest/api_stability/references/trtllm_serve_api.yaml: its reference row (kind: openai, status: stable).

#20368 adds prompt_cache_key the same way; the two PRs do not touch the same lines.

Test Coverage

  • New tests/unittest/llmapi/apps/test_openai_protocol_chat_store.py (CPU only), registered in l0_cpu.yml: store accepted as a keyword and from JSON, default None, non-boolean values rejected, other fields unchanged by it, unknown fields still rejected. On main, 6 of its 8 tests fail; the 2 that pass are the negative cases, which hold there too.
  • tests/unittest/api_stability/test_serve_api.py covers the reference row.
  • End to end: an A/B on one GB300 node with Qwen3-30B-A3B and the pi coding agent 1.4.0: main at 9bb7931 against the same main with this change (plus the other fixes from the same run), both from the same precompiled CI build, so they differ only in Python. pi over Chat Completions with default settings: on main every request was answered with HTTP 400 (4 of 4 sessions per mode); with the change all were served and the trtllm-serve-model-harness validator found no conformance violation. A replay of 4 recorded pi requests carrying store: 400 on main, 200 with the change.

PR Checklist

  • PR description clearly explains what and why.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

🤖 Generated with Claude Code

ChatCompletionRequest forbids unknown fields, so a request that sets the
standard OpenAI `store` field failed validation with HTTP 400. The pi coding
agent sends `store: false` on every Chat Completions request by default, so
each of its turns was rejected before reaching the model.

Accept the field and leave it unused, like `user` and `parallel_tool_calls`:
the server keeps no copy of a chat completion, so there is nothing to store.
Other unknown fields are still rejected.

Signed-off-by: JunyiXu-nv <219237550+JunyiXu-nv@users.noreply.github.com>
@JunyiXu-nv
JunyiXu-nv requested review from a team as code owners October 23, 2026 04:57
@JunyiXu-nv JunyiXu-nv added the api-compatible Accepted LLM API contract change that is backwards-compatible label Oct 23, 2026
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 9ee328b and bd133a4.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between fd33783 and 611ee1b.

Files selected for processing: 1
  • tests/integration/test_lists/test-db/l0_cpu.yml

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Walkthrough

ChatCompletionRequest now accepts an optional store field for compatibility and ignores it. The API stability reference records the field. CPU tests cover accepted values, parsing, and validation.

Changes

Chat completion store field

Layer / File(s) Summary
Request field and API stability reference
tensorrt_llm/serve/openai_protocol.py, tests/unittest/api_stability/references/trtllm_serve_api.yaml
ChatCompletionRequest adds an optional store boolean field. The API stability reference lists it as stable, optional, and null by default.
Request validation and CPU test registration
tests/unittest/llmapi/apps/test_openai_protocol_chat_store.py, tests/integration/test_lists/test-db/l0_cpu.yml
Tests cover accepted values, omission, JSON parsing, invalid inputs, and model-dump behavior. The CPU integration test list includes the new test module.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to 611ee

No actionable merge-blocking risk is identified in the reviewed change.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description clearly explains the problem, solution, affected files, test coverage, and validation results. It includes the required Description, Test Coverage, and PR Checklist sections.
Title check Passed The title follows the required format and clearly identifies the fix: accepting the OpenAI store field for Chat Completions.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@zhaoyangwang-nvidia zhaoyangwang-nvidia 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.

LGTM

@JunyiXu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80073 [ run ] triggered by Bot. Commit: 8f26eba Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80073 [ run ] completed with state FAILURE. Commit: 8f26eba
/LLM/main/L0_MergeRequest_PR pipeline #65897 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

Picks up the waive of unittest/executor/test_forward_error_survival.py
(NVIDIA#20895, nvbug 6981910), which fails on this branch's base in the CPU
stages independently of this change.

Signed-off-by: JunyiXu-nv <219237550+JunyiXu-nv@users.noreply.github.com>
@JunyiXu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80156 [ run ] triggered by Bot. Commit: b7969fe Link to invocation

@brnguyen2 brnguyen2 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.

Approving — the comments below are optional touch-ups, not blockers.

This handles store the same way as the existing accepted-but-ignored fields (parallel_tool_calls, user), and extra="forbid" still rejects other unknown keys, which test_unknown_fields_remain_rejected checks.

Minor points:

  • The title uses [None] for a user-visible bug fix (requests from a common client returned HTTP 400). If an NVBug or JIRA ticket tracks the pi-agent compatibility work, please cite it.
  • store is a no-op here, but it has real meaning in the Responses API (ResponsesRequest.store defaults to True and controls persistence when enable_store is set). The code comment already says chat completions are never stored. A short note in the serve docs listing which OpenAI chat fields are accepted but ignored would help users who expect store: true to make a completion retrievable. This is optional.

@github-actions

Copy link
Copy Markdown

Automatically added "ci: full pre-merge approved" because this PR has satisfied the required GitHub review approvals. Unresolved review conversations and other required checks remain independent merge requirements.

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80156 [ run ] completed with state SUCCESS. Commit: b7969fe
/LLM/main/L0_MergeRequest_PR pipeline #65966 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@JunyiXu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80216 [ run ] triggered by Bot. Commit: b7969fe Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80216 [ run ] completed with state SUCCESS. Commit: b7969fe
/LLM/main/L0_MergeRequest_PR pipeline #66019 completed with status: 'SUCCESS'

CI Report

Link to invocation

… rejects

The request schema is not strict, so Pydantic coerces boolean-like strings
and integers for store. A test now records that, and the rejection test is
renamed for what it checks: a value that is not boolean-like.

Signed-off-by: JunyiXu-nv <219237550+JunyiXu-nv@users.noreply.github.com>
@JunyiXu-nv

Copy link
Copy Markdown
Collaborator Author

@brnguyen2 Thanks for the review. The inline point about lax coercion is addressed in fd33783. On the two body points:

  • Title: no NVBug or JIRA ticket tracks this. It came from running the pi coding agent against trtllm-serve, so the PR keeps [None].
  • A docs note listing the chat fields that are accepted but ignored: I would rather keep this PR to the schema fix. Such a list would also cover parallel_tool_calls and user, so it fits a separate docs change. The field comment states that a chat completion is never stored.

@JunyiXu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80244 [ run ] triggered by Bot. Commit: fd33783 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80244 [ run ] completed with state FAILURE. Commit: fd33783
/LLM/main/L0_MergeRequest_PR pipeline #66042 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@JunyiXu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80290 [ run ] triggered by Bot. Commit: fd33783 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80290 [ run ] completed with state SUCCESS. Commit: fd33783
/LLM/main/L0_MergeRequest_PR pipeline #66084 completed with status: 'SUCCESS'

CI Report

Link to invocation

Resolve tests/integration/test_lists/test-db/l0_cpu.yml: keep both new
entries (main's test_openai_chat_multimodal_prompt.py and this branch's
test_openai_protocol_chat_store.py).

Signed-off-by: JunyiXu-nv <219237550+JunyiXu-nv@users.noreply.github.com>
@JunyiXu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80314 [ run ] triggered by Bot. Commit: 611ee1b Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80314 [ run ] completed with state FAILURE. Commit: 611ee1b
/LLM/main/L0_MergeRequest_PR pipeline #66103 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

Picks up the waive of unittest/_torch/modeling_v2/models/glm_moe_dsa/test_routing.py
(NVIDIA#20935, nvbug 6986044), which the previous main merge brought in failing on
both CPU stages independently of this change.

Signed-off-by: JunyiXu-nv <219237550+JunyiXu-nv@users.noreply.github.com>
@JunyiXu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80349 [ run ] triggered by Bot. Commit: 9ee328b Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80349 [ run ] completed with state FAILURE. Commit: 9ee328b
/LLM/main/L0_MergeRequest_PR pipeline #66131 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

Picks up main's waives of the LoRA tests that NVIDIA#20774 broke
(test_lora_ownership.py and the test_resource_manager.py PEFT reload tests,

Signed-off-by: JunyiXu-nv <219237550+JunyiXu-nv@users.noreply.github.com>
NVIDIA#20953), which fail independently of this change.
@JunyiXu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80434 [ run ] triggered by Bot. Commit: bd133a4 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80434 [ run ] completed with state FAILURE. Commit: bd133a4
/LLM/main/L0_MergeRequest_PR pipeline #66205 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@JunyiXu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80458 [ run ] triggered by Bot. Commit: bd133a4 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80458 [ run ] completed with state SUCCESS. Commit: bd133a4
/LLM/main/L0_MergeRequest_PR pipeline #66229 completed with status: 'SUCCESS'

CI Report

Link to invocation

@JunyiXu-nv
JunyiXu-nv merged commit c4dd49d into NVIDIA:main Oct 26, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-compatible Accepted LLM API contract change that is backwards-compatible ci: full pre-merge approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants