Skip to content

test(e2e): verify multi-turn Anthropic sessions - #2711

Merged
guapisolo merged 11 commits into
mainfrom
jiajun/anthropic-session-e2e
Aug 30, 2026
Merged

test(e2e): verify multi-turn Anthropic sessions#2711
guapisolo merged 11 commits into
mainfrom
jiajun/anthropic-session-e2e

Conversation

@guapisolo

@guapisolo guapisolo commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Verify six-request Anthropic sessions and pin SGLang conversion behavior in Miles CI.

Motivation

Six-request tool/result/text histories, reasoning replay, and supported intermediate-system insertion must preserve TITO prefixes. Incomplete Nemotron and GLM-4.7 responses must retry without advancing invalid history. SGLang PR #35127 refactors the runtime-independent Anthropic conversion seams, but its external-PR policy does not run the owning CPU suites, so Miles needs a temporary paired-checkout gate for behavior preservation.

Usage

python3 tests/e2e/sglang/test_session_server_multi_role/test_qwen36.py
SGLANG_SOURCE_ROOT=/path/to/sglang/python python3 -m pytest -q tests/fast/router/test_sglang_anthropic_conversion.py

Design Notes

  • Mental model: Each per-model test drives OpenAI v1/v2 and Anthropic v2 through the session tree.
  • Verification gates: The verifier admits only a valid six-request leaf, then independently gates hard token drift and model/endpoint-specific assistant serialization drift.
  • CPU ownership: Miles runs SGLang's conversion tests from SGLANG_SOURCE_ROOT pinned by ci-sglang-pr: #35127 at e95eae48.
  • Retries: Invalid responses retry from the same parent.
  • Intermediate system: Insertion requires both live-route and template support.
  • MiniMax: The test skips Anthropic and rejects direct agent use.
  • Port isolation: Auto allocation selects each worker port independently; an explicit --session-server-port still anchors a consecutive range.
  • Formatting boundary: Qwen3/Qwen3.5/Qwen3.6 keep Anthropic-only 1.0 assistant-text thresholds for conversion-normalized delimiters; OpenAI thresholds and all hard mismatch gates remain unchanged.

Verification

  • Exact-image focused tests on miles-h200-dev-2: 38 passed for session verifier routing on b9bea31d, then 12 passed for router allocation and 146 passed for argument parsing on 713df081c; changed-file pre-commit passed.
  • Qwen3 full v1/v2/Anthropic E2E on two H200s: two consecutive runs passed.
  • Qwen3.6 Anthropic on four H200s: four samples completed six requests each; hard mismatch metrics were 0.0, and the captured assistant diff was only </think>\n\n<tool_call> versus </think><tool_call>.
  • Controlled Qwen3.6 gate: the captured 4/4 sidecar failed at 0.2 and passed at the Anthropic-only 1.0; pre-commit passed.
  • Rebase at b8f5667c: 11 commits replayed conflict-free onto 11563829a; source metadata and cumulative trees were verified.
  • git diff --check 11563829a...b8f5667c: passed.

Review Focus

  • Anthropic verifier: canonical-record assertions, retry semantics, and hard-versus-soft mismatch boundaries.
  • CPU bridge: paired SGLang checkout at e95eae48 and subprocess failure propagation.
  • Port allocator: independent automatic allocation and explicit-range preservation.

Exercise six-request Anthropic tool histories across the per-model
session matrix, including supported intermediate-system insertion and
endpoint-specific assistant formatting thresholds.

Journal verifier assertions and hard TITO mismatches before rollout
retries can replace failed attempts.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

Retry length-limited OpenAI and Anthropic generations from the same parent
prompt before advancing the verifier. Keep retries bounded and preserve hard
completion, history, and TITO checks when the model does not recover.
Retry incomplete endpoint responses before advancing and validate the active
six-turn path while the v2 tree retains superseded retry leaves.
Apply the exact trailing comma required by the repository Black hook.
Execute the paired SGLang conversion and serving suites from Miles stage-a
CPU CI so SGLang PR #35127 has a policy-independent behavior-preservation
gate.
Match the repository's Black line-length configuration so pre-commit does not
rewrite the new CPU bridge.
@guapisolo

guapisolo commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

Wait for sglang bump and rebase, then we can merge this PR.

@guapisolo

Copy link
Copy Markdown
Collaborator Author

Verified on head 18d41fd0806d39adccc77d3b49631926151ef6f1:

The bridge executes SGLang #35127's owned test_utils.py and test_serving.py; the direct paired-checkout run on miles-h200-dev-2 reported 84 passed, 55 subtests passed.

@guapisolo
guapisolo force-pushed the jiajun/anthropic-session-e2e branch from 18d41fd to eb65212 Compare August 29, 2026 02:08
Qwen3.6 Anthropic tool-call conversion normalizes assistant delimiters and yields a 1.0 formatting-only mismatch rate. Keep the 0.2 OpenAI threshold and hard mismatch gates unchanged while allowing 1.0 only for the Anthropic pass.
Auto allocation no longer rejects a usable port because another port in a consecutive span is occupied. Explicit --session-server-port values continue to anchor consecutive worker ranges.
Base automatically changed from jiajun/anthropic-session-api to main August 30, 2026 01:34
@guapisolo
guapisolo force-pushed the jiajun/anthropic-session-e2e branch 2 times, most recently from 6e16fc6 to b8f5667 Compare August 30, 2026 01:42
@guapisolo
guapisolo merged commit 02a97ee into main Aug 30, 2026
45 of 50 checks passed
@guapisolo
guapisolo deleted the jiajun/anthropic-session-e2e branch August 30, 2026 04:01
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