Repository navigation
[PR] fix: OpenAI cache attribution — treat omitted cache fields as measured zero - #6340
myNameIsZhangYu wants to merge 11 commits into
Conversation
…change The ranxianglei#6329 fix changes how omitted cache fields are persisted: the sample is no longer quarantined as unmeasured but recorded with cached=0. This alters stats and cache-ledger metadata digests in the storage-render golden snapshots. Regenerated via scripts/update-storage-render-goldens.ts.
…omission is a measured miss The revert in the previous head deleted the regression test for the openaiCachedTokens fix. Restore it: an OpenAI upstream that omits prompt_tokens_details / prompt_cache_hit_tokens (sglang's behavior when cached_tokens=0) must record cachedTokens=0 and count a cache sample, not quarantine the request as unmeasured. Verified: fails on the pre-fix adapter, passes with the fix.
…ibution change" This reverts commit bc2be40.
…bution change Regenerated only tests/golden/storage-render/chat.json after restoring the four storage/update fixes that were accidentally reverted during a baseline comparison. This commit contains only the golden file change.
Revert incident explainedMy apologies for the confusion in the intermediate head. During a local baseline comparison I ran I have now:
The current head is |
…cts by keeping master's merged versions The PR's own ranxianglei#6317 (archive sweep) and ranxianglei#6323 (auto_vacuum ordering) fixes collided with master's already-merged versions of the same fixes (d25b225, e6e746a). Resolution keeps master's implementations (master's ranxianglei#6317 is a superset; ranxianglei#6323 is functionally identical) and preserves the PR's unique contributions: ranxianglei#6329 (OpenAI cache attribution), ranxianglei#6325 (delta ingest write-skip, re-applied on master's store.ts), and ranxianglei#6309 (atomic in-place self-update).
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) CI engineer final report — merge conflict on PR #6340 resolved and pushed. (This issue #6342 is the tracking issue for PR #6340; this English report supersedes the earlier Chinese note.) What was done Resolution (merge commit
Current state (verified just now)
Notes for author / owner
结构化八问
判定:冲突已解、CI 全绿,PR 已具备合并条件——仅剩 review/approval(human-only),由 owner 批准后合并。#6323/#6317 测试去留、PR 正文范围、以及 #6325 方案是否需重做,由作者/owner 定。 |
(ai: vllm-qwen/qwen3.8-27b) Thanks for the explanation — the accidental-revert story checks out against the commit history. I verified the live state: the head has moved once more since your comment (now Resolved since my last review
Still blocking: the PR bundles three undeclared changes beyond #6329The diff is 8 files, but the body declares only #6329 (1 source file + 1 test + golden). The other five files are leftovers from the original bundle: 1. 2. 3. RecommendationTrim the PR to its declared scope — #6329 only (
结构化八问
判定:拦 — 收敛到 #6329 声明范围(或正文如实声明全部改动并修掉 #6325/#6309 两个被证伪的方案)之前不可合并;#6329 部分本身已就绪。 |
|
Landed via batch PR #6482 (merged) — closing as superseded. |
|
本pr引入了回归问题,导致自动更新瘫痪 需要高度注意 |
|
全靠真模型门禁的 Lane X(自动更新车道)抓到的,静态 review 和 CI 都没抓到。 完整链条:
这正是门禁"不能只看表面、要真机全链路"的价值——它抓的是行为回归,网住的是单元测试和 diff 阅读的系统性盲区。 |
…6643 regression class) The update code paths were only covered by unit tests with hand-built directories and by the real-model gate Lane X, which materializes a REAL npm global install. ranxianglei#6643 (pre-ranxianglei#6340 atomic-swap rewrite) made every in-place update on an npm-layout install fail 100% — cp-onto-existing- backup hit libuv's self-copy guard on the relative node_modules/.bin symlinks — and no CI lane caught it. New tests/e2e/e2e-selfupdate-cli.test.ts in the existing hermetic registry lane (ACP_TEST_REGISTRY=1, ci-registry.yml, ubuntu+windows): publish a fixture package with a bin-bearing dependency (so npm lays down a real relative .bin symlink tree), npm install -g it, then run the REAL CLI 'bili update' and assert the version advances on disk + in 'bili --version', plus a clean no-op second update. Verified: - green on master (fix in place) in the bili-gate container (node 22 / npm 10) - red with ranxianglei#6643 reverted: exact gate failure signature 'backup of current install failed ... ERR_FS_CP_EINVAL ... node_modules/.bin/mime' - green locally (node 25 / npm 11 writes absolute .bin links — trap inert, flow still exercised)
Fixes #6329: the OpenAI adapter treated a missing
prompt_tokens_details/prompt_cache_hit_tokensas "unmeasured" instead of "zero cached tokens", inflating the unmeasured bucket and undercounting the real cache hit rate (sglang omits the field whencached_tokens=0).Fix:
openaiCachedTokensnow returns0(measured miss) whenprompt_tokensis present but both cache fields are absent; returnsnull(unmeasured) only when no token count exists at all.Test:
tests/loop-core.test.ts— regression assertscacheSamples = 1,cachedTokens = 0, andunmeasured.samples = 0for the OpenAI cache-omission case. Verified: fails on the pre-fix adapter, passes with the fix.Closes #6329