Repository navigation
Conversation
(ai: vllm-qwen/qwen3.8-27b) Review of PR #7211 — fix: validate token memo against exact counted text Duplicate screening: 查重: 不重复. Searched open+closed issues/PRs for the same fix (token memo / Bug verification: Confirmed the #7208 bug is real. The memo key Fix correctness: The fix adds an exact-text gate to the memo hit ( Tests: Verified the 17 new tests are real regressions — 15 fail / 2 pass on the unmodified base (I swapped in the base CI: Green — 16 success, 12 skipped, 0 failed, 2 pending ( Memory: The fix trades Behavior change (disclosed): A warm Unicode request now receives its own correct budget (47,687) instead of inheriting the stale memo's budget (51,271). This is the intended fix. Labels: Applied Verdict: Recommend merge — correct root-cause fix, real regression tests, green CI, clean diff, behavior change disclosed. Pending the 2 in-flight CI checks and owner approval. 结构化八问(中文,供人工复核):
收工判定: 建议合并——根因修复正确、回归测试真实(base 上 15 红 / 2 绿)、CI 绿、diff 干净、行为变更已披露。待 2 个在跑 CI 检查通过 + owner 批准。 |
Fixes #7208.
Problem
Kernel IDs describe logical message identity. Tool arguments serialized with Unicode escapes and literal CJK can therefore have the same ID and text length while the CJK-aware token counter returns different values. The memo currently treats that pair as identical, so unrelated earlier requests can change the output budget for the same current request.
A real OpenAI codec fixture gives 100-character arguments with equal IDs but counts of 25 and 29; the Responses codec has the same behavior. With 800 completed tool calls through the HTTP proxy, the same Unicode request receives
max_tokens=51271after an escaped-JSON warmup but47687from a cold memo.Change
Require the cached entry's exact text to match as well as the existing ID, length and thinking-token key. A live message anchors its immutable text/count entry through a WeakMap, and the global memo holds only WeakRefs. Cloned histories can still reuse live entries, while expired entries are safely recounted. Resetting the test memo also resets those anchors.
The kernel, wire serialization, compression modes and budget formulas are unchanged. Both plugin and proxy paths use the same corrected estimator; this does not change their different summary carriers.
Validation
47687for both warm and cold Unicode requests. Each returns HTTP 200 with the expected answer, one upstream request and all 800 original tool arguments preserved.npm run typecheck,npm run build,npm run check:test-import-graphandgit diff --checkpass.E2E_CHECK=1finds the Codex CLI and built dist, but the configured local upstream at127.0.0.1:8199is unreachable. The required real-model four-phase Codex suite has not run and remains a pre-merge gate. Full-suite validation is left to remote CI.Prior work
Compared all 272 live fork branches and 920 upstream file-history commits (171 complete versions). The memo introduced by #5131 does not verify counted text; the actual patches in #6460 and #6474 address different calibration/billing behavior.