Skip to content

feat(vllm_model): add opt-in fold_nonleading_system_messages - #4010

Open
linj-glitch wants to merge 3 commits into
NVIDIA-NeMo:mainfrom
linj-glitch:linj/vllm-fold-system-messages
Open

linj-glitch wants to merge 3 commits into
NVIDIA-NeMo:mainfrom
linj-glitch:linj/vllm-fold-system-messages

Conversation

@linj-glitch

@linj-glitch linj-glitch commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

Claude Code can insert a system notice after a tool turn, which causes Qwen-style chat templates to reject the request with System message must be at the beginning.
Enabling fold_nonleading_system_messages changes later system/developer messages to user messages while preserving their content, chronological position, and the leading system block, after applying replace_developer_role_with_system.
The option defaults to false and rejects the Responses-native path; enabling it deliberately changes those prompt roles.
Head 8ce785af39a50ca2e63cb025a8b424243b2ecd5c includes an additive DCO-signed merge of main f36e126547866601bee9c0671c9b59484ef83723 to pick up the existing mini-SWE dependency-isolation and terminal-test fixes, with the folding behavior unchanged.
Validation on Python 3.13.14 with imports verified from this checkout passed all 573 vLLM tests, pre-commit run --all-files, the private guardwords scan of this PR's diff and description, and git diff --check.
The author's historical GRPO rollout with Claude Code SWE agents and a Qwen-family policy reported that affected requests were served when enabled; this AI-assisted integration adds no new real-model rollout evidence, and normal GitHub review and current-head CI gates still apply.

@copy-pr-bot

copy-pr-bot Bot commented Oct 4, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@yaoyu-33 yaoyu-33 added area:model Model servers, inference providers, and model adapters complexity:low Localized change in one scope with a small, straightforward review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer labels Oct 5, 2026
@linj-glitch
linj-glitch marked this pull request as draft October 5, 2026 06:12
@linj-glitch
linj-glitch force-pushed the linj/vllm-fold-system-messages branch from 9eae98e to a396650 Compare October 8, 2026 00:15
Some harnesses inject system messages mid-conversation; Claude Code, for
example, appends background-task notices with role=system after tool
turns. Chat templates that only admit a system message at the start
(e.g. "System message must be at the beginning") reject the whole
request, which the harness sees as a server error.

Add `fold_nonleading_system_messages` to VLLMModelConfig (default off).
When set, every system/developer message after the leading system block
is sent as a user message with identical content, so the model still
reads it in chronological position. It runs after
`replace_developer_role_with_system` and, like that option, raises
NotImplementedError on the Responses-native path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lin Jia <linj@nvidia.com>
@linj-glitch
linj-glitch force-pushed the linj/vllm-fold-system-messages branch from a396650 to d42f056 Compare October 8, 2026 00:20
@linj-glitch
linj-glitch marked this pull request as ready for review October 13, 2026 23:08
Signed-off-by: Lin Jia <linj@nvidia.com>
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 14, 2026
@linj-glitch

Copy link
Copy Markdown
Collaborator Author

/ok to test 6c73d74

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Signed-off-by: Lin Jia <linj@nvidia.com>
@linj-glitch

Copy link
Copy Markdown
Collaborator Author

/ok to test 8ce785a

This branch was previously deployed

1 inactive deployment
public — 8ce785af Deployed Oct 24, 2026 by copy-pr-bot[bot] via release / finalize / notify #7063
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:model Model servers, inference providers, and model adapters complexity:low Localized change in one scope with a small, straightforward review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer sla:triage-overdue Review assignment is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants