Repository navigation
[PR] fix(egress): count protected originals against image caps - #7141
Conversation
Keep retained original images in the remaining-image budget while preserving their byte-pressure exemptions. Archive eligible images until the shared target is met and reuse the learned cap on subsequent proxy and plugin relay turns. Fixes ranxianglei#7140
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 No other open issue or PR targets #7140, and no open 标签: bug + p1 + scope/wiring — p1: under a provider image cap, a session whose history contains restored originals ( Review verdict: mergeable (pending the remote CI test shards, which were still running at check time). No blocking issues found. What I verifiedThe bug is real (reproduced on unchanged master). I ran the PR's new regression suite The fix logic is correct (full diff read). Regression review — every existing behavior on the touched paths:
Test validity (④). The new suite uses an independent wire-shape oracle ( Local runs on the PR head: typecheck clean, build clean (dist guards OK), and 124 targeted tests green across 13 egress-shed-related suites (72 + 52). The full-suite verdict is the remote CI's. CI (mirror cache, fetched 2026-11-18T10:23:54Z): 30 checks, 0 failed, 11 pending (test shards in progress); all 19 completed lanes green (static-gates ×2, gate, lock-sync, kernel-guard, version-guard, config-surface-guard, mysql-contract); e2e lanes skipped (gated). 结构化八问
行为变更披露(Deliverable 4):旧行为——受保护原图不计入图片预算,救援可能在「可归档图片单独放得下」时静默 no-op,完整请求(总图片数 > cap)原样发出并被 400;新行为——受保护原图计入预算,普通图片被归档直至总数 ≤ cap−1,请求收敛后成功。这是本 PR 的修复目标本身;字节压力路径行为不变。 结论:可合(等远程 CI 的 test 分片跑完;已完成的 19 个 check 全绿、0 失败)。无阻塞问题,无需顺手修。合并由人工执行。 |
Problem
Fixes #7140.
Image-count rescue currently removes protected originals from the occurrence list before calculating the remaining image count. Those images still occupy slots in the upstream request. When the eligible images alone appear to fit, rescue leaves the complete request above the provider's limit and returns the rejection to the caller.
A real relay reproduction sends two retained original images plus three ordinary images to an upstream that accepts at most four images. Unchanged master forwards five images once and returns HTTP 400. The existing rescue target is three; the complete request must retain the two originals and one ordinary image.
Change
Keep protected originals in the collected occurrences and mark their exemption explicitly. Count all of those images toward the remaining-image budget, while skipping exempt occurrences when choosing images to archive.
The byte-pressure path still excludes protected originals before its archival/downscaling work. Existing wire-format support, original-image exemptions, configuration, and prompt text are preserved.
Validation
npm run typecheck,npm run build(including distribution guards), andgit diff --checkpass. An independent source/test review found no blocking issues.Prior work and scope
Compared all 258 earlier fork heads, the five resulting
src/egress-shed.tsvariants, its 15-commit file history, and relevant open/closed upstream work. The previous image-count implementation (#4496) and tool-result exemption work address different behavior; the earlier variants still omit retained originals from this count.Three files change:
src/egress-shed.ts, the existing #4124 count-cap regression, and the new #7140 regression suite. No kernel, dependency, configuration, or persistence-format changes.Primary contributor: Afloat16.