Skip to content

test: cover multi-block system preservation across the Messages gateway loop - #154

Merged
franciscojavierarceo merged 2 commits into
vllm-project:mainfrom
ashwing:test/issue-116-messages-system-blocks
Jul 31, 2026
Merged

test: cover multi-block system preservation across the Messages gateway loop#154
franciscojavierarceo merged 2 commits into
vllm-project:mainfrom
ashwing:test/issue-116-messages-system-blocks

Conversation

@ashwing

@ashwing ashwing commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a regression guard that a multi-block Anthropic system field survives the /v1/messages gateway tool loop unchanged across rounds.

The loop rebuilds the upstream request body every round — append_round_to_history appends the assistant turn + tool_result to messages. It only touches messages, so system should ride through untouched, but the loop path had no coverage of that (only the transparent-proxy path asserted system forwarding). Claude Code sends system as an attribution block + instructions, so this is the shape that matters.

The test drives a two-round gateway loop with a multi-block system and asserts both upstream request bodies carry the identical blocks — so a future refactor that rebuilds the upstream body from a curated field subset can't silently drop system.

Completes the Stage 3 (#116) system-attribution parity item. Part of #113.

Test Plan

  • cargo test -p agentic-server-core --test messages_loop_test --test messages_stream_test (15 tests, including non-streaming and streaming multi-block system preservation)
  • cargo fmt -- --check
  • cargo clippy --all-targets -- -D warnings

…ay loop

The gateway tool loop rebuilds the upstream request body each round
(append_round_to_history appends the assistant turn + tool_result to
messages). A multi-block Anthropic `system` — the attribution block +
instructions shape Claude Code sends — must ride through untouched, but
the loop path had no coverage of it (only the transparent-proxy path did).

Adds a two-round loop test asserting both upstream request bodies carry
the identical system blocks, so a future refactor that rebuilds the body
from a curated field subset can't silently drop system.

Closes the Stage 3 (vllm-project#116) system-attribution parity item.

Signed-off-by: Ashwin Giridharan <girida@amazon.com>

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

The new regression guard covers only the non-streaming run_messages_loop path. Claude Code sends stream: true, and /v1/messages routes those requests through the independent run_messages_stream implementation and its own round-history mutation. Without a matching request-body assertion in messages_stream_test.rs, a streaming-only refactor could still drop or reshape the multi-block system field while this test remains green.

I’m pushing the corresponding streaming request-capture regression test to this branch before merge.

Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>

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

Verified the non-streaming and streaming multi-block system regression coverage, including a mutation check against the streaming path. Local cargo test, formatting, and Clippy all pass.

@franciscojavierarceo
franciscojavierarceo merged commit 47daeef into vllm-project:main Jul 31, 2026
4 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.

2 participants