Repository navigation
Conversation
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Verdict: APPROVE. The fix is correct, minimal, and pinned by tests with teeth. Guards (gate/kernel-guard/config-surface-guard/mysql-contract) are green at this head; the test shards were still running when I reviewed, with 0 failures — the full-suite verdict rides on CI.
Correctness. rescaleImage() gates on maxDim before touching the cache (src/image-rescale.ts:151), and doRescale output is fully determined by (mime, maxDim, content) — the encode format follows the declared mime (src/image-rescale.ts:122-124). The new key sha256(${mime}:${maxDim}:${b64}) (src/image-rescale.ts:153) covers exactly those inputs. Negative results (low-benefit skip → null) are cached per policy too, which is what makes the BMP 1600→800 sequence work: a null at one limit no longer poisons another.
Teeth. At this head the file passes 26/26 locally; swapping master's src/image-rescale.ts back in fails exactly the 3 new tests (23p/3f) — they reproduce the reported bug, not just the happy path. Both directions of the gate are asserted (same policy → cache hit + log once; different dim → re-encode + log again), per the negative-assertion discipline (#3617).
Regression audit (existing behaviors on the touched paths):
- Same-policy reuse (the #3400 feature): preserved — identical (mime, maxDim, content) still encodes once; log-once retained (pre-existing "hash cache" test unchanged, passing).
- Cross-limit behavior: INTENDED change, already disclosed in the PR body. Old: the first (mime, maxDim) pair seen per process lifetime won for that content forever. New: each active limit gets its own entry, so a mid-process
BILI_IMAGE_RESCALE_MAX_DIMchange takes effect at next egress instead of pinning until restart. Key old→new:sha256(b64)→sha256(${mime}:${maxDim}:${b64}); reason: the old key was the reported bug (#6085). - Forced-shed path (
shedDownscaleImage): untouched by this diff; verified byte-identical. - Cache cap (512 entries, src/image-rescale.ts:48) and eviction mechanism: unchanged; key space grows by distinct (mime, maxDim) pairs, bounded by the cap.
- Wire shape: unchanged — same block fields; only the encoded payload differs when the active limit differs.
- Byte-stability within a fixed policy: preserved ("byte-stable" test passing).
- Config surface / persistence / kernel/: none touched.
Finding from this review (non-blocking; pre-existing on master, NOT introduced here). shedDownscaleImage() keys its encode cache on sha256(${dim}:${b64}) (src/image-rescale.ts:186) without the mime, while its output format follows the declared mime — identical bytes under two declared mimes both through forced shedding would serve the first mime's bytes under the second's wire label. Same mechanism family as this PR, independent defect. Trigger is narrow (identical bytes + two declared mimes + both shed within one process lifetime), so p3-class. The author's fork has maintainer edits disabled, so I could not land it on this branch; per house tiny-fix discipline it ships separately: issue #6108 ([no-dispatch] recording, labeled bug/scope-wiring/p3) + fix PR #6109 (key gains the mime; new regression test fails without the change, file 24/24 with it). Merge order relative to this PR is irrelevant — no textual overlap.
One factual observation for the author, no action demanded: with the new key, the doc comment above rescaleImage ("Cached per content hash…") and the cap comment ("unique images per process") now understate what the key covers.
Clean diff (2 files, every line on-purpose), references its issue, single-module scoped pure fix — meets the §7.4 auto-merge gate criteria; merge decision stays human.
中文八问:
- 是什么问题:图像重缩放缓存键只含内容 hash——同一张图在进程生命周期内被第一个遇到的 size limit 策略钉死,之后改 limit、或同内容图在不同 limit 下先后出现时,都会拿到旧策略的编码结果(包括旧的 null 结果)。
- 什么原因导致的:缓存键设计漏掉了两个决定输出的输入——声明的 mime 与当前生效的 maxDim(
doRescale的输出完全由这三者决定,编码格式还跟着声明的 mime 走)。 - 影响范围与严重程度:所有开启 BILI_IMAGE_RESCALE 的会话;触发条件=进程内 size limit 变化(env/config 改动)或同内容图跨 limit 出现。后果是发出错误尺寸的图(体验/成本瑕疵),不丢数据、无安全问题 → 特定条件下有问题,p2-p3。
- 怎么修复的:缓存键从 sha256(b64) 扩为 sha256(mime:maxDim:b64),让键覆盖全部输出决定因素;负结果(null)同样按策略缓存,不再跨策略污染。
- 是否有回归问题:逐项审过——同策略复用保持(编码一次+日志一次)、跨策略为有意变更(正文已披露旧值→新值+原因)、shed 路径未触碰、缓存上限 512 机制不变、wire 形状不变、固定策略内字节稳定性保持。无意回归:无。
- 是否破坏缓存:上游前缀缓存不受影响(仅图片 payload 数据可能变化);本模块自身 encode 缓存行为按第 5 条逐项核对过。
- 是否改了设计方向:不改——仍是进程级 encode 缓存,只是键的定义修正为与输出一致。
- 是否引入了新的配置:无。
判定:可合并(APPROVE)。审查中发现的 shed 路径同类缺陷已独立立项(#6108)+修复 PR(#6109),不属于本 PR 范围。
[bot] 🏷 Review complete: APPROVE posted on PR #6086 → #6086 (review) (full English justification + 八问 in the review body). Verified (targeted local runs):
Review finding (non-blocking, pre-existing on master, NOT introduced by this PR):
Coordination one-liner posted on #4599. No open ends: the finding ends FIXED-in-separate-PR (receipt above), nothing parked. 中文八问(精简版):
收工判定:PR #6086 可合并(APPROVE 已提交);审查中发现的 shed 路径同类缺陷经 #6108/#6109 独立闭环,无遗留。 |
|
Landed via batch PR #6439 (merged) — closing as superseded. |
[bot] 🏷 Acknowledged. Verified on current master: the #6086 fix is in via batch #6439 — Status of the follow-up from my review (independent, pre-existing defect on the forced-shed path):
Nothing else pending on this thread. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 重复 — 本 PR 的改动已经合入 master,PR 本身是空操作/重复项,建议关闭。 I reviewed PR #6086 ("include the active size limit in image rescale cache keys"). The finding: the exact change this PR proposes is already in master, so the PR is a complete duplicate of already-merged work. Evidence
The PR head ( The fix itself is correct — scoping the rescale cache key by normalized MIME + maxDim is the right call: same-policy requests still reuse their result, a changed maxDim now re-encodes instead of returning the stale dimensions, and a cached low-benefit no-op no longer suppresses a later stricter resize. It just doesn't need to land again — it already did, via #6439. Recommendation: close PR #6086 as a duplicate of the already-merged #6439 cherry-pick. Per policy I won't close or relabel the source PR myself — flagging for the owner. 结构化八问
判定:PR #6086 为已合入 master 的重复项(#6439 cherry-pick),建议 owner 关闭,不予合并。 |
doRescale encodes in the declared mime's format, so the encode-cache key must cover it; identical bytes under two declared mimes otherwise collide and the second caller receives the first mime's bytes under the wrong wire label. Same mechanism family as PR #6086 (rescaleImage key gains mime+maxDim); this is the pre-existing gap on the forced-shed path.
Problem
The ordinary rescaleImage cache uses only base64 content as its key. Reusing an image after maxDim changes returns dimensions from the previous policy; a cached no-op at a larger limit also suppresses required resizing at a smaller limit.
Changes
Include MIME and maxDim with the image content in the ordinary rescale cache key. Same-policy requests still reuse their result. Forced shedding retains its existing independent behavior.
Validation
The full remote-suite verdict belongs to CI. #3425 introduces preprocessing, #3565 covers settings, and #3706 keys forced shedding by dimension. This fixes the separate ordinary rescale cache, including negative results. All 3,221 historical PRs were screened; independent of #6046–#6055.
Closes #6085