Skip to content

[PR] fix: downscale surviving images after archiving the prefix - #6185

Closed
Afloat16 wants to merge 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-10_shed-live-worklist
Closed

Afloat16 wants to merge 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-10_shed-live-worklist

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Fixes #6177

Problem

Rung B chooses its 64-image worklist before Rung A archives old images. With 64 archived images at the front, every selected entry is already detached, so the downscale pass does no work even when a protected recent image alone exceeds the byte budget. The proxy then sends an oversized request although resizing that image would make it fit.

Changes

Select the bounded downscale worklist from the remaining live images after archiving. Keep the 64-image decode/re-encode cap, dimension ladder and protected-tail policy.

Validation

  • Rebased onto master e3220adc0f5412af83163666ca70a6afa05e3247 (package version 0.1.213). The intervening [PR] thirdparty-scan: flag dsh-live-compact as a known conflict (#5984) #6166 changes only third-party plugin detection, its tests, announcements and configuration docs; none of this patch's source or test files changed. The complete patch is byte-identical to the locally validated patch on 33104b1f9545caeb0344193009917ceef9969682 and applies cleanly.
  • Negative control on 33104b1f9545caeb0344193009917ceef9969682: 1 new regression case still fails before the production fix.
  • Independent source tree based on 33104b1f9545caeb0344193009917ceef9969682 (b6c2d9de830918c30013bd84d58c871833a585e8): 4/4 focused tests passed, with no failures, skips or cancellations.
  • Full project TypeScript checking and the standard npm run build passed on the temporary integration tree e186774d3428c85e2a4974c6e609b2a7381d6153 containing the seven independently submitted fixes on 33104b1f9545caeb0344193009917ceef9969682. The repository compiler options and include set are unchanged.
  • git diff --check passed. Local runtime: Node.js 24.22.1 on Linux. Full cross-platform remote CI remains pending.

#5754 fixed Rung A’s archive traversal past the old cap. This addresses the independent selection of Rung B’s surviving-image worklist. No configuration or kernel changes.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Duplicate screening: not a duplicate. Searched open AND closed issues/PRs for this mechanism ("archived prefix exhausts the downscale worklist"): #6177 → this PR (#6185) is the only thread touching it. The sibling image-shedding PRs from the same author are distinct symptoms with distinct mechanisms and non-overlapping hunks — #6184 (google-lane non-image inline media must not be archived; touches only collectOccurrences' google branch) and #6187 (BMP dimension decode per DIB header; touches src/image-tokens.ts). No parallel second PR targets #6177.

Labels: applied bug + p1 + scope/wiring (server-side egress byte-shedding; when triggered, every model call in an image-heavy session is rejected upstream — unusable under the trigger condition). No client label: the defect is lane-independent (WS + HTTP relay share shedWireImages).

Review status (in progress):

  • Base verified live: PR head fe435e92 sits exactly on current master e3220adc — no stale-base risk.
  • Local targeted runs at PR head: all 7 egress-shed-related test files pass (65/65, 0 fail/skip); full typecheck + npm run build clean.
  • Negative control reproduced independently: the new regression test fails against master's src/egress-shed.ts and passes with the fix — the test has teeth, matching the PR's claim.
  • Root-cause analysis of the diff confirms the fix is at the decision point (worklist selection moved after Rung A), not a mask.

CI: static gates all green; 9 cross-platform test shards still running. Full structured verdict follows once CI completes.

@ranxianglei ranxianglei added bug Something isn't working p1 scope/wiring labels Nov 11, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷

(ai: vllm-qwen/qwen3.8-27b)

Review verdict: APPROVE — correct root-cause fix, fully verified locally, auto-merge eligible (§7.4: all 8 conditions met). The merge itself stays human-only.

What was verified

Root cause (confirmed in code, not taken on faith). Rung B computed its 64-image worklist before Rung A archived old images (occurrences.slice(0, MAX_SHED_IMAGES)). By the time Rung B runs, bytes are still over target after archiving — which means every non-protected image has already been archived by Rung A. With ≥64 images the old worklist was therefore 64 all-archived entries, and the downscale pass silently did nothing even when the protected recent image alone exceeded the byte budget. The proxy shipped an oversized request although resizing that image would have made it fit.

Fix. Selection moved after archiving, filtered to live occurrences (!o.archived) before the cap. Because Rung A exhausts non-protected images first, the surviving worklist is exactly the protected tail — strictly more shrinking in the Rung-B regime, byte-identical everywhere else. Deterministic per input+target ⇒ prefix-cache safe. Both callers re-checked: shedEgressIfOverBudget (pre-send gate) and src/server/relay.ts:1326 (WS 1009-zero-events resend, whose stats.changed && finalBytes < sentBytes condition the fix makes easier to satisfy). No wire/config/persistence/kernel surface touched; both compression modes unaffected (outbound-copy-only path).

Local runs at PR head fe435e92 (all performed by me):

  • All 7 egress-shed-related suites: 65/65 pass — new tests/egress-shed-downscale-tail.test.ts plus issue3400/3701/3909/4124/4601/5745 files.
  • Negative control independently reproduced: swapping master's src/egress-shed.ts into the tree makes the new regression case fail; restoring the fix makes it pass. The test bites.
  • npm run typecheck clean; full npm run build clean.

Code quality (external-strict bar): naming, dead code, comment accuracy, magic numbers, style consistency, dependencies — all pass. The test asserts the exact archive count (64), a real width shrink via Jimp round-trip (width < 1024), and input-array non-mutation. No refactor needed.

Duplicate screening: not a duplicate — #6177→#6185 is the only thread on this mechanism (open+closed searched). Sibling PRs #6184/#6187 are different symptoms/mechanisms with non-overlapping hunks.

Labels: bug/p1/scope/wiring applied, judged from this PR's own diff (hard availability failure under the stated trigger conditions).

Live state check (verified minutes ago, not from memory)

In progress now: rebasing the PR branch onto current master c26c31ace4, re-running the targeted suite + typecheck + build, and pushing; I'll follow up in this thread with the new head and fresh CI. "Behind" is not a merge blocker regardless (no conflicts).

结构化八问

  1. 是什么问题:Rung B 的降采样工作清单在 Rung A 归档之前选取——头部 64 张图全部被归档后,64 个名额被已归档条目占满,受保护的尾部大图从未被缩放,代理持续发出超预算请求。
  2. 什么原因导致的:工作切片在归档标记生效前计算(slice(0, 64) 先于 Rung A);根因是选择时机错误,不是缩放能力缺失。
  3. 影响范围与严重程度:触发条件明确——会话内 ≥64 张图、且保护尾部的图单独就超字节预算时,每轮出站都超预算 → 上游拒收,该条件下完全不可用。p1。
  4. 怎么修复的:把有界工作清单的选取移到归档之后,只从存活(!archived)条目中取前 64——此时存活集恰好就是受保护尾部,严格多缩、不会缩错对象;保留 64 张上限、尺寸阶梯与保护尾部策略。
  5. 是否有回归问题:无。Rung-B 区间严格更多收缩,其余路径字节级不变(同输入+目标输出确定);两个调用方逐一复核;7 个相关测试文件 65/65 通过;负控独立复现(换回 master 版本新用例即失败)。高危模式逐项过:无语义漂移、无吞错、无阈值/时序/格式变化。
  6. 是否破坏缓存:否——按输入+目标确定性保持不变,前缀缓存安全。
  7. 是否改了设计方向:否。
  8. 是否引入了新的配置:否。

判定:可合并(auto-merge eligible;合并动作按规由人执行)。

@ranxianglei
ranxianglei force-pushed the 2026-11-10_shed-live-worklist branch from fe435e9 to 7f27769 Compare November 11, 2026 19:34
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷

(ai: vllm-qwen/qwen3.8-27b)

Rebase done — PR head is now 7f27769d5a on current master c26c31ace4. Pushed to the PR branch (force-with-lease from fe435e92; authorship preserved, single linear commit). The rebase was conflict-free, exactly as the zero-overlap check predicted.

Verified on the rebased head, locally:

  • All 7 egress-shed-related suites: 65/65 pass
  • npm run typecheck clean
  • Full npm run build clean (build-info: commit=7f27769d5a)

One environment note for transparency: the first post-rebase test run failed 7/7 with SyntaxError: acp-kernel does not provide an export named 'ACP_RESTORE_TOOL' — that was my stale locally-prebuilt kernel/dist (master's kernel 0.0.195 added that export), not a code problem. Rebuilding kernel/ + pi-subagents/ in the worktree turned the full set green.

GitHub is recomputing mergeability after the head update (transiently showing blocked); fresh CI is starting on 7f27769d5a. I'll report here when the cross-platform test shards land. Nothing else changed — verdict stands: correct fix, verified, ready to merge once CI is green.

@ranxianglei

Copy link
Copy Markdown
Owner

Landed via batch PR #6439 (merged) — closing as superseded.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷

(ai: vllm-qwen/qwen3.8-27b)

Confirmed live: the fix landed on master via the batch — commit 6c6b803d8e ("fix: select image downscale work after archiving") is in master's history through #6439 (merge 873715d4), and the fixed selection (occurrences.filter((o) => !o.archived).slice(0, MAX_SHED_IMAGES)) is in place at src/egress-shed.ts:304. PR #6185 closed unmerged as superseded at 2026-11-12T14:09Z.

My review verdict (APPROVE) applies to exactly this content: the batch preserved the same single commit I rebased and verified — 65/65 targeted egress-shed suites, independently reproduced negative control, typecheck and full build clean on the rebased head.

One transparency note: my session was force-restarted (~23:51) while waiting on the fresh CI test shards on 7f27769d5a, so I never posted the final shard result — at last poll, 0 failures with all static gates green and the 8 cross-platform shards in progress. The batch merge makes that moot. Nothing outstanding from my side; the thread is ready for you to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working p1 scope/wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Archived prefixes exhaust the image downscale worklist

2 participants