Skip to content

test chat template swap between and during inference#212

Merged
mcharytoniuk merged 1 commit intomainfrom
chat-template-swap-tests
Apr 20, 2026
Merged

test chat template swap between and during inference#212
mcharytoniuk merged 1 commit intomainfrom
chat-template-swap-tests

Conversation

@mcharytoniuk
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings April 20, 2026 07:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds coverage for swapping an agent’s chat template override both between inference calls and while a streaming inference request is in flight, plus additional unit tests validating chat template rendering behaviors in ChatTemplateRenderer.

Changes:

  • Introduce helpers and two new integration tests to validate chat template override swapping behavior (including a concurrent swap during streaming inference).
  • Add renderer unit tests covering looping over messages (role/content) and add_generation_prompt branching.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
paddler_integration_tests/tests/chat_template.rs Adds helpers and new integration tests for chat template swapping between calls and during an in-flight stream.
paddler/src/chat_template_renderer.rs Extends unit tests to validate message iteration rendering and conditional template branches.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +402 to +410
let new_state = chat_template_balancer_state(AGENT_DESIRED_MODEL.clone(), template_b.clone());

cluster
.balancer
.client()
.management()
.put_balancer_desired_state(&new_state)
.await
.context("failed to put new desired state")?;
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

In test_agent_drains_in_flight_then_applies_chat_template_swap, the test doesn't currently assert the key behavior implied by its name (that the agent keeps using the old chat template until the in-flight stream drains). It only asserts the stream doesn't error and that the new template is eventually applied after completion. Consider polling get_chat_template_override after put_balancer_desired_state (while the stream is still active) and asserting it remains template_a until Done, then asserting it becomes template_b after draining. To make this reliable, also consider increasing max_tokens/using a longer prompt so the stream stays active long enough to observe the pre-drain state.

Copilot uses AI. Check for mistakes.
@mcharytoniuk mcharytoniuk merged commit 61b639c into main Apr 20, 2026
14 checks passed
@mcharytoniuk mcharytoniuk deleted the chat-template-swap-tests branch April 20, 2026 10:40
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