Repository navigation
[PR] feat: per-session compression opt-out via /__bili/session/<id>/compress (#5300) - #5404
ranxianglei wants to merge 10 commits into
Conversation
…ss (#5300) One session whose history must never be folded (e.g. a long-lived companion conversation) can now be excluded from compression at runtime while every other session on the same model keeps compressing. The flag lives in session.metadata (persisted with the record, survives restarts); matching is by exact session id only. Excluded sessions ride the SAME verbatim tail as global/route passthrough (handle.ts gate placed before any bookkeeping): no fold, no nudge, no tool/philosophy injection, no preflight, no marker; window overflow surfaces as the upstream's own error instead of a quiet fold. Plugin-lane compress calls are refused loudly (409 COMPRESSION_DISABLED) so a host never believes a fold happened; decompress stays available. The incremental lane pre-arms rawTail durability before dispatching its synthetic request so excluded turns still land in the canonical table. Loopback-gated like every /__bili/ route: POST {"enabled":bool} requires a resident session (404 otherwise), GET reads back resident-first with a read-only store fallback (the guard against silent re-enablement).
Both-direction rows per gate discipline: baseline injection present (negative row), disable -> byte-identical forward with sibling sessions unaffected, re-enable -> injection returns, unknown id -> 404 on both verbs, malformed bodies -> 400 with the flag untouched, and a plugin-lane end-to-end row asserting the 409 COMPRESSION_DISABLED refusal plus a non-excluded control that does NOT receive it.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10276-pr.5404.ef52beaThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5404.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 结论先行:可合(人工合)。 方向正确、实现干净、本地定向验证全绿、未发现回归。这是新功能面(feat),按纪律走人工 review,不自动合并。下面是我独立重做的审核(没有照抄 PR 描述或 issue 结论——typecheck、定向测试、资源生命周期、路由冲突、文档双语都是我这边重新跑过/读过代码判定的)。 查重: 不重复。#5300 开单时已做过全量查重(per-session/opt-out/exclude/disable compression 多组关键词),本 PR 即其实现,无并行重复条目。 结构化八问
我独立跑过的证据
非阻塞建议(都不挡合并)
收工判定方向对、实现干净、本地定向验证全绿、未见回归、无缓存破坏、无设计转向、无新增配置面。建议 CI 全量转绿后由人工合并(feat 面,按 §7.4 不自动合并)。上面第 1 条测试缺口建议随后续小 PR 补上,其余为可选项。 |
…out flag
Review supplement (review-worker-r1): the feature's central durability claim
('the flag persists in the session record across restarts') had no regression
pin — every harness in the suite runs SessionStore({ enabled: false }), so a
metadata-serialization change that thins the persisted record would silently
re-enable compression with no test failing. This is exactly the silent
re-enablement failure mode issue #5300 asked the GET read-back to guard.
Two-phase test on a real file-backed store: disable + writeNow on a live
instance, then empty the resident pool and stand up a fresh store over the
same dir (process-death stand-in). Asserts the GET read-back reports the flag
from disk AND the first model request after 'restart' still forwards
byte-identical (gate re-armed from the reloaded record).
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Verdict: APPROVE (posted as a review comment — GitHub rejects the author approving their own PR; human merge pending per §7.4).
Reviewed end-to-end against issue #5300 (owner decision: option A — runtime endpoint, no config field, exact id match, GET read-back). No kernel/ changes, no version bump, branch up to date with master, CI green on head 6d44019 (all test shards + static gates + mysql-contract).
Direction (issue check). The gap is real: the control surface had global passthrough, static three-level compress merge, and route-scoped passthrough — nothing between "all sessions" and "per-route". This lands exactly the approved scope: runtime flag, exact session id, persisted with the record, loud refusal on explicit compress calls, window overflow surfacing as the upstream's own error instead of a quiet fold.
Code.
src/server/handle.ts:1444— gate placed right aftergetSessionAsync(which reloads evicted/cold records from disk, #4942 seam), so the flag is effective on first touch after a restart even before any warm boot. It rides the sameforward(...)verbatim tail as the other passthrough exits, usingreqConfiglike the later pipeline forwards do (consistent; the earlier tails use rawconfigonly because they run before config resolution).src/server/admin.ts— strict URL parsing (exact suffix, decode-guarded, rejects empty/>512/embedded-/ids, query tolerated), resident-first GET with store cold fallback, resident-only POST,markDirtyafter mutation, house error shapes ({ok:false,error}, 413 on BodyTooLargeError). Loopback-gated insidehandleAdminRoute; no collision with the/__bili/sessions/*//__bili/replicas/*routes.src/plugin.ts— compress refusal sits after the session lookup (so unknown ids keep their existing 404s) and beforeisProxyToolFor; decompress stays available. Correct placement.src/incremental-lane.ts— pre-arm verified against the flow: the gate skipsprepare-anthropic(the normal arming point for rawTail durability), the lane's own post-forwardscheduleSave(#5155 close-out) then flushes the armed snapshot, andentry.msgsis structurallyCoreMessage[]-compatible (TS accepted it) and matches the lane's canonical table better than the wire-round-tripped view would.- Persistence:
metadataround-trips as a whole blob (envelopepayload.metadata,lazyMetadatare-materializes from disk and refuses thinned views) — the "survives restarts" claim holds mechanically.
Tests. The six original rows are real behavioral tests through the live server: byte-identical forwarding is asserted exactly (captured.body === body), both directions of the cycle, sibling isolation, 404/400 error rows, and the plugin refusal has its negative control row. Good teeth.
One gap, fixed in place: the central durability claim ("flag persists across restarts") had no pin — every harness ran SessionStore({ enabled: false }), so a metadata-serialization change thinning the persisted record would have silently re-enabled compression with no test failing. That is precisely the silent-re-enablement mode the GET read-back exists to guard. Pushed as review supplement 8d300ff: two-phase test on a real file-backed store (disable + writeNow, then empty pool + fresh store over the same dir = process-death stand-in) asserting both the cold GET read-back and byte-identical forwarding after "restart". Local: 7/7 green, typecheck clean.
Non-blocking notes (no action required):
- Excluded requests don't count toward in-flight drain (early return precedes
acquireInFlight) — identical to every existing verbatim-passthrough exit; worst case a long excluded stream is cut at a self-update restart and the client retries. - Excluded sessions skip image-billing tracking (#1843/#1857) like any passthrough session — worth one line under the docs' honest boundaries if you want full disclosure.
- On the incremental lane,
lastMessagesnow holdsBiliMessage[]directly (carriesledgerSeq/tsinto the session file'smessagesarray) — harmless shape drift, consumers tolerate the extras; noted for awareness.
结构化八问
- 是什么问题:功能请求(#5300)——某些会话的历史绝不能被折叠(原始措辞本身就是资产),需要运行时按会话关闭压缩。
- 什么原因导致的:非缺陷——控制面粒度缺口:只有全局
passthrough、静态三级 compress 合并、route 级 passthrough,缺「单会话运行时」这一层作用域。 - 影响范围与严重程度:新功能,对既有行为零影响(flag 未设时 gate 恒为 inert);排除期间该会话输入 token 线性增长、窗口溢出显式失败(owner 确认的语义)。严重程度:不适用(功能)。
- 怎么修复的:flag 存
session.metadata.compressionDisabled(随记录持久化、跨重启生效);pipeline gate 置于会话解析后,骑全局/route passthrough 同一条 verbatim 尾(无 prepare/fold/nudge/injection/preflight/marker);POST/GET 管理端点(loopback、精确 id、严格 URL 解析);插件车道 compress 工具调用响亮拒绝409 COMPRESSION_DISABLED(decompress 保留);增量车道在合成请求派发前预置 rawTail 持久性(gate 跳过了 prepare-anthropic 这个常规武装点)。 - 是否有回归问题:逐项过完——未排除会话 gate inert(基线行断言注入仍在)、兄弟会话隔离已钉、早返回跳过 in-flight 计数与 spill 与所有既有 verbatim 出口同类行为(非新语义类)、排除会话跳过图像计费/面板统计与 passthrough 会话一致(已披露边界)。未发现回归。
- 是否破坏缓存:不涉及——排除会话逐字转发,其自身前缀缓存行为不变;无 cache-stamp/重试/去重键改动;metadata 整体 blob 往返持久化,不引入失效策略变化。
- 是否改了设计方向:没有。刻意不加配置字段(owner 门禁面不动,#5300 线程拍板的 option A);复用既有 passthrough 尾与 metadata 持久化通道;精确 id 匹配是明确决策(不做前缀/标签)。
- 是否引入了新的配置:无新 env/config/默认值。新面:两个 loopback 管理端点(GET/POST
/__bili/session/<id>/compress)、一个 info 日志标签[session-compress-off]、一个新 409 码COMPRESSION_DISABLED(PR 正文 + CONFIGURATION.md en/zh 均已披露)。
判定:可合(feat,按 §7.4 走人工合并;review 补充提交 8d300ff 待 CI 复跑绿)。
(ai: vllm-qwen/qwen3.8-27b) Review done — verdict APPROVE, posted on GH PR #5404 as a review comment (GitHub rejects author self-approval; human merge pending per §7.4). Review supplement commit |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Round 2 (head 8d300ff) — verdict unchanged: APPROVE (posted as a review comment; GitHub still blocks author self-approval, human merge pending per §7.4).
Delta since the round-1 review (6d44019 → 8d300ff) is exactly one commit: review supplement 8d300ff, tests-only (+61/-2 in tests/issue5300-session-compress-optout.test.ts) — the restart-survival pin called out in round 1. No src/, kernel/, config-surface, or doc changes; no new dependencies. Re-verified on the pushed head: file run 7/7 green, typecheck clean (both reported locally before push), branch still at merge-base of master (7578e81, up to date).
CI on 8d300ff via mirror cache: 30 checks, 0 failed, 0 pending — all runnable lanes success (test shards ubuntu/windows × node 22/24, static-gates, mysql-contract, version-guard); skips are the expected gated e2e lanes.
Compact eight-question (full analysis stands from round 1):
- 是什么问题:同上一轮(#5300 按会话运行时关闭压缩)。
- 什么原因导致的:同上一轮(控制面粒度缺口,非缺陷)。
- 影响范围与严重程度:同上一轮(新功能,既有行为零影响;排除期输入增长/溢出显式失败为 owner 确认语义)。
- 怎么修复的:同上一轮 + 本轮补齐重启存活回归钉(两阶段真实文件存储测试)。
- 是否有回归问题:无——本轮增量仅测试文件,不触碰任何运行路径。
- 是否破坏缓存:不涉及。
- 是否改了设计方向:没有。
- 是否引入了新的配置:没有(新面仍为两个 loopback 端点 + 日志标签 + 409 码,已披露)。
判定:可合(feat → 人工合并)。
(ai: vllm-qwen/qwen3.8-27b) Round-2 re-review on head |
Resolve conflicts for the #5300 per-session compression opt-out PR against current master: - src/plugin.ts / src/server/admin.ts: union import lists (this branch adds isCompressionDisabled + markDirty; master adds noteTruncatedUpstream + announcements/remote-notices) - src/server/handle.ts: keep both independently-added blocks at the same anchor: this branch's #5300 verbatim early-return first, then master's #5490 unresolved-model warn - CONFIGURATION.md / .zh-CN.md: adopt master's redirect stubs (doc moved under docs/); re-home this branch's new per-session opt-out section into docs/configuration.md and docs/configuration.zh-CN.md
[bot] Progress after forced restart — no blockers. Rounds 1–2 done (verdict APPROVE posted twice on GH PR #5404; my test-pin commit 8d300ff pushed, CI green). Round 3 on new head 91ee054 in progress: the branch has since been synced onto a much newer master (58a8796, v0.1.211-era, ~600 upstream commits touching the same hot files), so I am re-verifying the PR's own changes against the new base before concluding. |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Round 3 (head 91ee054) — verdict unchanged: APPROVE (posted as a review comment; GitHub blocks author self-approval, human merge pending per §7.4).
The branch was synced onto current master (merge-base now 58a8796, v0.1.211-era) since round 2. I therefore re-reviewed the full PR delta ON THE NEW BASE rather than trusting the old verdict. PR-specific commits vs master: the original feat/test/docs trio + my round-1 restart-survival pin + two master-sync merges. PR-specific diff vs master: exactly the same 8 files (+493/-4), no kernel/ involvement, no kernel-change declaration → authorization boundary not triggered.
Re-verification on the new base (every touched hot file had moved under upstream churn):
- src/server/handle.ts:1715 — gate still sits immediately after getSessionAsync(:1703)+memProbe, BEFORE the #5490 warn, personaNamespace marking, publicForkPrefix acquireInFlight(:1732), audit stamps and rawInputTokens estimation; the forward call matches the pipeline's 12-arg form (newer trailing model-hint args are optional); returns before any in-flight acquisition → no counter underflow, same class as every existing verbatim-passthrough exit.
- src/server/admin.ts — the new routes are behind the loopback+trusted-origin+anti-tunnel gates (:244-261): isManagementPath(:177) is a prefix test (/__bili/), so /__bili/session//compress IS management-gated. No route collision: /__bili/session-report and /__bili/sessions/ are distinct strings; the id parser stays exact-match (suffix-anchored, decode-guarded, ≤512, no "/").
- src/plugin.ts:2367 — compress refusal still placed after the !session 404 handling and before isProxyToolFor; decompress untouched.
- src/session.ts:1710/:1718 — isCompressionDisabled + snapshotMessages intact (snapshotMessages keeps its non-empty guard); metadata persists as the whole record blob, so the flag survives restarts (mechanically verified in rounds 1–2, pin re-ran green here).
- src/incremental-lane.ts — pre-arm of rawTail durability before the synthetic forward, flushed by the lane's own post-forward scheduleSave close-out (#5155) — both intact.
- docs/configuration.md + .zh-CN.md — the doc hunks were correctly relocated into the new docs/ layout by the sync; anchor #passthrough exists; content matches code (exact-id semantics, 404/400 behaviors, loopback note, 409 COMPRESSION_DISABLED).
Evidence: local on this head — typecheck clean, targeted suite 7/7 pass (incl. the restart-survival pin). CI via mirror cache on 91ee054: 30 checks, 0 failed, 0 pending (test shards ubuntu/windows × node 22/24, static-gates, mysql-contract, build-artifact; skips are the expected gated e2e lanes).
No findings above the nit bar remain — nothing to fix in place, nothing routed to a decision.
八问(中文,供人工 reviewer):
- 是什么问题:#5300 请求的运行时按会话压缩开关——全局/provider/model 三级合并之外、route passthrough 全有全无之内,缺一个「只排除一个会话」的作用域。
- 什么原因导致的:控制面粒度缺口(设计缺口,非缺陷);owner 已在 issue 内拍板方案 A(运行时端点 + 精确 id + GET 读回防静默恢复)。
- 影响范围与严重程度:纯新增功能面;未排除会话零行为变化(flag 默认 unset,gate 惰性)。排除期输入 token 线性增长、窗口溢出显式失败——均为 issue 内确认的预期语义。
- 怎么修复的:session.metadata.compressionDisabled 标志随记录持久化;pipeline 在会话解析后、任何记账前走与 passthrough 相同的 verbatim 尾;插件车道 compress 工具 409 响亮拒绝;增量车道预置 rawTail 耐久。本轮增量:分支同步到新 master 后全量重验接线位置不变。
- 是否有回归问题:无——新基座上逐文件重验(gate/端点/拒绝/helper/lane/docs),既有行为清单逐项保持;高危模式(语义漂移、fail-fast 变吞错、阈值/时序/输出格式)均无命中。
- 是否破坏缓存:不涉及(前缀缓存对 verbatim 会话反而更友好;无缓存/重试/游标语义变化)。
- 是否改了设计方向:没有(在既有 passthrough 机制上开一个会话级开关)。
- 是否引入了新的配置:没有配置字段/env;新面为两个 loopback 管理端点 + [session-compress-off] 日志标签 + 409 码,PR 已披露。
判定:可合(feat → 人工合并)。
(ai: vllm-qwen/qwen3.8-27b) Round-3 re-review on head |
[bot] Status after this restart — nothing is stuck or pending; round 3 finished before the watchdog fired (the session was simply idle afterward). Verified live on GitHub just now: all three review comments are in place on PR #5404 — round 1 (5726672456), round 2 (5726699718), round 3 on head 91ee054 (5851502875, verdict APPROVE, full re-verification on the new master base, CI green 30/0/0 via mirror cache). The one-line round-3 report above stands. No blockers; standing by for the next trigger or human merge. |
[bot] 🏷 Final closeout — review of GH PR #5404 (this mirror thread #5405), final head What was done (3 rounds):
Outcome: APPROVE, posted as review comments (GitHub blocks author self-approval — fleet account is the PR author): ids What remains / risk: only the human merge (feat → human-only per §7.4). Risk: none identified — zero behavior change for non-excluded sessions (flag default unset, gate inert); new surfaces fully disclosed (2 loopback admin endpoints, 八问(中文):
判定:可合,等人合入。 |
…mpressAtFoldPoint removal)
…ockOps gate + snapshot-write-lifecycle)
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) CI-engineer lane (attempt 1/3) — merge-conflict resolution + red-CI check for this PR. Verified live before acting: the reported What I did & found:
Final head: 八问(中文结构化结论)
收工判定:冲突不存在(触发器的 dirty 为过期信息);分支已同步到当前 master 尖端并本地验证绿,head= |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) CI-engineer lane (attempt 1/6) — merge-conflict resolution + red-CI check. Verified live before acting: this time there was a real conflict (unlike the prior run, which was only What I found (live):
What I did:
Result (live, re-checked after push):
No design decision needed; no kernel-guard surface (the conflict was a host-side import line, not 八问(中文结构化结论)
收工判定:真实冲突(仅 plugin.ts import 并集)已解决;分支已同步到当前 master 尖端 |
…rward The gate's forward() call omitted the throttleModelHint that every other passthrough call site in handleRequest passes (605/675/713/840/1640/3511); the relay then re-derived the model by scanning the request body (requestModelFromBody). Pass the already-resolved throttleModel so the excluded-session path matches its siblings exactly. PR #5404 review finding (mechanical consistency, no behavior change).
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: opencode/vllm-qwen/qwen3.8-27b)
Note: posted as a comment review — the fleet account cannot submit an APPROVE event on its own PR (GitHub 422). Verdict below stands.
(ai: opencode/vllm-qwen/qwen3.8-27b)
APPROVE — the per-session compression opt-out is implemented correctly, minimally, and on the existing passthrough/admin machinery. One mechanical finding fixed on the spot (receipt below).
Independent verification (head 0336cc0, plus fix 3b12371)
① Direction (original issue #5300). The issue asks for a runtime per-session opt-out: no fold, no nudge, no compress-tool injection, full verbatim send, explicit upstream failure over silent loss, siblings unaffected. The PR delivers exactly that mechanism — a persisted session flag + an early verbatim-forward gate + a plugin-lane 409 — not a symptom patch. The root gap it addresses: exclusion granularity was global/route passthrough only before.
② Regression surface (existing behaviors touched by the diff, each checked):
handleRequestmain path — the gate is an earlyreturnafter session resolution, before any bookkeeping; traced the brace structure: no try/finally is skipped (acquireInFlight/releaseInFlightboth start after the gate). Non-flagged sessions execute byte-identical code to before. ✓- Passthrough semantics — the gate reuses the exact tail-call shape (
scrubAnthropicPck+scrubCompatDrop+forward+forwarded=true), so excluded sessions behave identically to route/global passthrough, including compat rewrites when configured. ✓ - Session lifecycle —
lastSeenis stamped by the session lookup itself (stampExisting, src/session.ts:1453), so an excluded session with live traffic is not evicted as stale. ✓ - Admin surface — both endpoints sit behind the existing loopback + tunnel + trusted-origin gates (
isManagementPathcovers/__bili/*); URL parsing rejects empty/>512///bad-UTF-8; no route shadowing (existing plural/__bili/sessions/untouched). ✓ - Incremental lane — the pre-arm (
snapshotMessagesbefore the synthetic forward) is correct: the rawTail ingest readslastMessagesand the pre-arm clearslastMessagesFolded, so even a mid-forward debounced save ingests the raw tail before folding it — the canonical table always gets the turn; worst case is the lane-contracted 409 resync, never wrong history. ✓ - Watermark lane (KDD #15) — the gate skips prepare → no
x-bili-pf-seqstamp → the client converges to the legacy full-resend path in one round;pf-*headers are stripped pre-upstream. Contract-consistent. ✓ - Plugin lane — the 409 is placed after session resolution (unknown sessions still 404) and before execution;
decompress/retrieveremain available. ✓
③ Code. Gate placement, admin parsing, and the plugin-lane check are minimal and follow existing patterns; no dead code, no new deps, naming consistent.
④ Tests. The 7-test suite is real and has teeth: byte-identity of the forwarded body (catches any accidental injection/rewrite), sibling isolation, re-enable, 404/400 on both verbs with the flag untouched, plugin-lane 409 with a non-409 control, restart persistence across two harness instances. Both gate directions are asserted (injection baseline vs suppressed). Ran locally: 7/7 pass; adjacent suites (passthrough, route-passthrough, incremental-lane, plugin-tool-routing, admin-origin/probe, …) 68/68; typecheck clean. CI on head 0336cc0: 39 success / 15 skipped / 0 failed.
⑤ Diff. 8 files, every line on-purpose; en/zh docs parity; no whitespace or lockfile churn.
已顺手修
已顺手修:the gate's forward() call (src/server/handle.ts:1786) omitted the throttleModelHint that all 7 sibling passthrough call sites pass — the relay then re-derived the model by scanning the request body; added undefined, undefined, throttleModel to match the tail call at :3511 exactly (no behavior change, avoids the redundant scan) + commit 3b12371
八问
- 是什么问题:#5300 需求——长会话(陪伴/角色扮演)的原文是资产,要一个运行时开关把单个会话排除出压缩,其余会话照常;窗口溢出时显式失败(上游自己的报错),不静默丢历史。
- 什么原因导致的:此前排除粒度只有全局/路由级 passthrough,没有会话级。本 PR 补上会话级粒度:会话记录上的持久化标志位 + 管线入口的 verbatim 转发门 + 插件车道 compress 工具 409 拒答。
- 影响范围与严重程度:纯增量能力。未排除的会话路径逐字节不变(门是提前 return,不触碰既有分支);新端点仅回环可达。对启用开关的会话,输入 token 线性增长(PR 已如实披露);窗口溢出时收到上游原始报错(显式失败,符合 issue 要求)。
- 怎么修复的:标志位放
session.metadata.compressionDisabled(随记录持久化,重启自动恢复);门放在会话解析之后、任何簿记之前,直接复用与全局/路由 passthrough 完全相同的 verbatim 尾调用;增量车道在派发合成请求前预置 rawTail 持久化(snapshotMessages),保证跳过 prepare 不丢 canonical 行。 - 是否有回归问题:无。逐项核过:主路径无跳过的 try/finally;passthrough 语义(含 compat 改写)一致;lastSeen 由会话查询自身盖戳,排除会话不会被误逐出;admin 三闸门(回环/隧道/可信源)全覆盖;水位车道一轮收敛回 legacy(KDD #15 明文的降级契约);插件车道仅拒 compress。
- 是否破坏缓存:不破坏。排除会话走 verbatim 转发,客户端字节逐轮稳定,上游前缀缓存行为与 passthrough 相同;pf 水位戳跳过 → 客户端一轮收敛回 legacy 全量路径,是 KDD #15 的降级契约,不是缓存破坏。
- 是否改了设计方向:否。复用既有 passthrough 尾调用与 admin 闸门体系,未引入新数据流;会话级粒度是 passthrough 机制的自然延伸。
- 是否引入了新的配置:无新 config 字段 / env / CLI flag——纯运行时端点(POST/GET
/__bili/session/<id>/compress),文档中英已同步。
CI note: the fix commit 3b12371 is a one-line mechanical change verified locally (7/7 + typecheck); CI will re-run on the new head.
(ai: opencode/vllm-qwen/qwen3.8-27b) Review complete — verdict: APPROVE (posted as a comment review on GitHub PR #5404; the fleet account cannot submit an APPROVE event on its own PR — GitHub 422 "Can not approve your own pull request" — the verdict stands in the review body).
八问
收工判定:可合并(feat → 人工评审档,等 owner 合并)。 |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: opencode/vllm-qwen/qwen3.8-27b)
Round 2 — re-review of head 3b12371: verdict unchanged, APPROVE stands.
Delta since the reviewed head 0336cc0 is exactly one commit — the mechanical fix from round 1 (fix: pass the throttle-model hint on the session-compress-off gate forward, one line at src/server/handle.ts:1786 adding undefined, undefined, throttleModel to the gate's forward() call). Verified byte-for-byte via git diff 0336cc0c5..3b123711e; no other changes on the branch, no new author commits. The fix was already verified locally in round 1 (new suite 7/7, typecheck clean) and aligns the gate call with all 7 sibling passthrough call sites — no behavior change.
CI on head 3b12371: green (mirror cache: 14 success / 14 skipped / 0 failed; dispatch snapshot green, mergeable_state: blocked = awaiting review only).
八问(增量复核,结论与首轮一致)
- 是什么问题:同首轮——#5300 会话级压缩排除;本轮增量仅为评审顺手修的 throttleModelHint 一致性修复。
- 什么原因导致的:同首轮;增量行消除的是 gate 调用与兄弟调用点之间的参数不一致(relay 会重扫 body 推导模型)。
- 影响范围与严重程度:增量无外部影响——仅避免一次冗余的 body 模型扫描,转发字节不变。
- 怎么修复的:同首轮;增量 = 给 gate 的 forward() 补上已解析好的 throttleModel 提示参数。
- 是否有回归问题:无——增量行不触碰任何既有行为路径;本地 7/7 + typecheck 干净,CI 绿。
- 是否破坏缓存:不破坏——与首轮判断一致。
- 是否改了设计方向:否——与首轮一致。
- 是否引入了新的配置:无——与首轮一致。
收工判定:可合并(feat → 人工评审档,等 owner 合并)。
(ai: opencode/vllm-qwen/qwen3.8-27b) Round 2 复核完成(head 3b12371)——结论不变:APPROVE。 新 head 相对已评审的 0336cc0 只有一个增量 commit:首轮顺手修的 throttleModelHint 一致性修复(src/server/handle.ts:1786 一行, 八问增量复核:8 项答案与首轮一致——增量行不触碰任何既有行为路径(仅避免一次冗余 body 模型扫描),无回归、不破坏缓存、不改设计方向、无新配置。完整八问见 PR 上两轮 review 评论。 收工判定:可合并(feat → 人工评审档,等 owner 合并)。 |
Closes #5300
What
One session whose history must never be folded (e.g. a long-lived companion/roleplay conversation where the original wording itself is the asset) can now be excluded from compression at runtime, while every other session on the same model keeps compressing normally.
POST /__bili/session/<id>/compress{"enabled":false|true}— set/clear; requires a resident session (404 otherwise); exact id match only (no label/prefix — a mis-hit would fail silently, which defeats an anti-silent-loss feature)GET /__bili/session/<id>/compress— read-back (resident-first, read-only store fallback for cold sessions, 404 unknown): the guard against silent re-enablementsession.metadata.compressionDisabled, persisted with the record → survives restartsHow
Excluded sessions ride the same verbatim tail as global/route passthrough (
src/server/handle.tsgate right after session resolution, before any bookkeeping): no fold, no nudge, no tool/philosophy injection, no preflight, no marker — client bytes go out untouched, so window overflow surfaces as the upstream's own error instead of a quiet fold (intended semantics: an explicit failure you can see beats irreversible silent loss).compresstool call on an excluded session is refused loudly —409 {"code":"COMPRESSION_DISABLED"}— so a host never believes a fold happened;decompressstays available (restoring a pre-exclusion block is still meaningful).snapshotMessages) before dispatching its synthetic request, because the gate skipsprepare-anthropic— without this, excluded turns would miss the canonical table and a cold rebuild would 409-resync against history the client already pruned past its acked seq./__bili/route.Behavior changes (disclosure)
No existing behavior changes for non-excluded sessions — the flag defaults to unset and the gate is inert. New surfaces:
POST/GET /__bili/session/<id>/compress).[session-compress-off]per forwarded request of an excluded session.COMPRESSION_DISABLED(HTTP 409) on/__bili/plugin/toolforcompresscalls against excluded sessions.Config surface: no new config fields or env vars — runtime endpoint only, deliberately (the owner-gated static surface is untouched). Kernel boundary:
kernel/untouched.Honest boundaries
decompressrestores them).Tests
Local targeted runs (the full suite is CI's job): typecheck clean; new suite
tests/issue5300-session-compress-optout.test.ts6/6 (both-direction rows: baseline injection present / disable → byte-identical forward + sibling unaffected / re-enable → injection returns / unknown id → 404 on both verbs / malformed body → 400 with flag untouched / plugin-lane 409 refusal + non-excluded control); adjacent regression files covering every touched path 68/68 (fix-1117-passthrough, route-passthrough, incremental-lane, e2e-plugin-tool-routing, #1875 outcome, #2652 timeout, admin-origin, admin-probe, #5155 durability).Feat (new capability surface) → human review, not auto-merge.