Repository navigation
[PR] fix(affinity): preserve parallel tool rounds across wire formats - #6660
Conversation
(ai: vllm-qwen/qwen3.8-27b) Review of PR #6660 — reviewed independently: read the diff, traced all four wire projections, ran the red-green cycle locally, and read the CI job logs directly. 查重: 不重复 — this PR is the fix for #6659 itself; #2839 is its predecessor (single-call projection), not a parallel fix. No other open PR touches ① Direction. The bug is real and the fix hits the root cause. I reproduced both defects on the base source locally:
The fix is at the projection layer (the producer of the identity chain), not a symptom mask: Responses now merges adjacent calls into one pending assistant run (flushed at the existing ② Regression review. Existing behaviors preserved on the touched paths:
Intentional changes (all disclosed in the PR's Compatibility section):
Consequence: active anonymous sessions whose history contains the affected multi-call/multi-result shapes miss once across this upgrade and mint a fresh chain — the same projection-migration class #2839 documented (I checked #2839's upgrade note; the claim is accurate). Single-call projections and identified clients are unaffected. ③ Code / ⑤ diff / ⑤b cleanliness. 22-line change in one source file; minimal, correctly named, no dead code, style-consistent, no new deps, no kernel/provider-payload changes. Clean diff: 3 files, 115+/16-, every line purpose-related, single linear commit. ④ Tests. Real teeth, verified red-green:
CI. 28/30 green. The 2 red shards are 100% inherited master-level failures, not PR-caused (verified in the job logs):
Verdict: mergeable — code is correct, tests are real, no regressions; the only blocker is the inherited CI red on the fork-hosted head. 八问审核结论
结论: 可合入(代码正确、测试真实、无回归)。唯一阻塞是继承的 master 级 CI 红(Windows EBUSY 家族,ci-fixes 已修,#6645 待合);fork 分支本账号无推送权限,需作者自行 merge ci-fixes,或等 #6645 合入后 rebase。 |
|
(ai: vllm-qwen/qwen3.8-27b) Duplicate relationship note (from the #6675 review thread): PR #6675 (opened 2026-11-14 08:14 UTC, ~1h42m after this PR) fixes the same issue #6659 with the same mechanism — line-by-line diff of both branches shows the Per the first-come-first-served policy this PR (#6660, the earlier one) is the one to keep; #6675 is the later duplicate. The full independent review of the shared fix (red→green verification, regression sweep, 8-question checklist) is posted on #6675. Outstanding items on this PR if it is kept: rebase onto current master, labels, and the two red Windows test jobs (claimed pre-existing SQLite teardown-lock failures, not yet verified against master). Closing/labeling decisions are owner-only — flagged there for the owner. |
(ai: vllm-qwen/qwen3.8-27b) Noted the duplicate relationship — agree: #6660 (this PR, opened earlier) is the one to keep, #6675 is the later duplicate. I've now verified the two outstanding items that were still open on this thread, live: 1. The two red Windows jobs — verified pre-existing, and now moot after rebase.
2. Rebase onto current master — needed, clean, and verified.
Labels are owner-only per the note — leaving those to you. Verdict (unchanged): mergeable. The fix is correct, the tests are real, no regressions; the only remaining step is the author's rebase onto current master, which also resolves the two inherited red jobs. |
Closes #6659
Problem
Parallel tool histories do not have the same affinity identity across wires. Responses splits adjacent
function_callitems into separate turns when no assistant commentary precedes them. Gemini's user-parts loop overwrites earlierfunctionResponsebodies. A stateless client switching protocols then mints another anonymous session and loses access to the prior session's fold state.Change
Create a pending assistant run for Responses calls regardless of commentary, and flush it at the existing tool-result boundary. Collect every Gemini result body and emit a tool turn for each in order, retaining wrapper normalization and any trailing user text. Both fixes make one parallel round project identically across OpenAI, Anthropic, Responses and Gemini; no kernel or provider-payload code changes.
Verification
Base
1ff89e878522f3e4d4147067973e2dc26e648923; Node 24.22.1 on Linux.affinity-neutral,affinity-crosswire-fold,prefix-affinity,affinity-persist,prefix-affinity-orphan,prefix-affinity-simhashandfork-adoption.npm run buildandgit diff --checkpass.Compatibility
Ordinary single-call projections and OpenAI/Anthropic projections retain their existing behavior, covered by the controls. Active anonymous sessions containing the affected multi-call/multi-result shapes can miss once across this upgrade because their former projection omitted or split content; the client's retained transcript allows a fresh fold. Explicitly identified clients do not derive their identity from these anonymous hashes. This is the same projection-migration limitation documented in #2839.
This follows #2839's single-call implementation and does not duplicate the separate snapshot, SimHash, or core-ID reconciliation changes.
Hosted CI follow-up
CI run 43566811984 finished with 25 successful jobs, two failed Windows test jobs and one skipped job. All Linux test shards and both Windows/Ubuntu static gates passed, including the full typecheck and build. The overall CI result remains red.
The two failed jobs report only the existing SQLite teardown-lock failures:
persist-metadata-fold-gatecases fail while removing openindex.dbfiles (EBUSY); the runner's automatic retry repeats them.persist-zstdcases fail on the same open-file cleanup; the automatic retry repeats them.The affected fixtures still remove their temporary directories without closing all
SessionStoreinstances. The exact suites and cleanup cause are already covered by upstream issue #6547 and open fix PR #6561. This PR does not duplicate that work. No failure in these logs belongs to this PR's new regression cases.