Repository navigation
[PR] feat(dsh): route models between stock native and bili compaction - #6123
bluesmilery wants to merge 14 commits into
Conversation
[bot] (ai: vllm-qwen/qwen3.8-27b) Full independent review of this draft PR (GitHub #6123) is done — code, tests, docs, CI and compatibility boundaries walked from the diff, not from the PR description. Verdict up front: code quality is high; what's outstanding is your sign-off on the configuration contract plus a short punch-list before undrafting. No forced alignment-refactor warranted — naming, structure, error handling and test style match repo conventions. 查重: 不重复。 Searched open+closed issues/PRs for a per-model native-compaction mechanism — no prior thread proposes it. Same family as #5994 (restore native when bili-native is absent/disabled) but different granularity and mechanism: #5994 is binary/global (the whole lane flips to native when bili is off); this PR is per-model ownership declared in config, with bili still active for every other model and safe mid-session switching. Different enough to stand alone. 标签: Live state (verified just now): head What I verified independently
Findings (punch-list — none blocking by itself)
Behavior-change disclosure (old → new)
🔶 需要决策背景一句话:本 PR 是 DRAFT,作者明确请求 maintainer 审「配置/归属契约」;按 Configuration Surface Discipline,新增配置字段必须 owner 签核后才能进入合并。待决问题:是否批准 结构化八问:
选项对比:
推荐 A:形状贴合既有 不决定的默认行为:PR 保持 draft,不合并、不再推进,等待你的拍板。 收工判定:代码质量高、CI 绿、方向不跑偏——可进入契约审批;契约批准后补齐小修清单 + rebase 即可撤 draft 待合。本 bot 不关闭、不合并该 issue/PR(owner 权限)。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Status note after two daemon restarts mid-task (the work finished before the last one fired — nothing lost):
I will not close or merge anything (owner-only). Waiting on your call. |
[bot] (ai: vllm-qwen/qwen3.8-27b) 进度汇报(进程被强制重启后恢复): 我是本 PR 的 CI 工程师(11-12 两次系统指派「上游 PR 冲突(dirty),冲突与红项由 CI 工程师一次处理」)。上次会话在同步 master 阶段卡住被重启,无阶段性成果丢失——工作树干净,恢复后已重新核实全部状态: 当前实况(刚刚核实):
接下来(本次会话继续执行):
预计 30–60 分钟内给出冲突解决结果。若中途再遇阻塞会立即汇报,不会静默卡住。 |
# Conflicts: # scripts/live-files.mjs
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) PR #6123 冲突 + 红项处理进度(进程重启后接续) 1. 冲突已解决并推送。 把 2. 本地验证(§7.2:全量回归交给 CI): 3. 红项 = PR 自带测试的确定性缺陷,根因已钉死,正在修。 失败测试 "bili-only and model-routed bili have identical real proxy folds and forwarded requests"(本 PR 新增)fork 两个独立 proxy 逐字节对比转发请求,但 proxy 盖的 ACP 标签带墙钟 4. CI:新 head 已推送在跑,走镜像缓存查看(不轮询),flake 修复 + CI 结果出来后给最终八问。 八问(当前状态)
判定:冲突解决完成、已推送;红项根因已钉死、修复进行中;CI 绿后给最终结论。 |
The parity test compares forwarded payloads across three forked proxy arms with deepEqual, but the kernel stamps wall-clock yyyy-mm-dd hh:mm:ss timestamps into the ACP tag time= attribute and the compress tool-result block time range. Arms running on different seconds differ in those bytes alone, so the comparison flaked. Mask every wall-clock timestamp before the cross-arm comparison (same sanctioned normalization as issue5403-watermark-fastpath.test.ts).
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Independent review of PR #6126 (GitHub #6123) — complete. I completed a full independent end-to-end review of the PR (head 08bf768, 27 files, +959/-27). Verdict: 🔶 需要决策 — config contract pending owner sign-offThe code is clean (no blocking findings). However, this is a DRAFT feature PR that introduces a new config field I do NOT approve — not because the code is deficient, but because the config contract requires owner sign-off. The PR body itself states: "This PR is draft for maintainer review of the configuration/ownership contract. No maintainer approval, merge or release is implied." What I verified
Findings (all non-blocking, already in floor 5 punch-list)
None blocking. All are disclosure/doc/test-coverage items already noted in floor 5. 8问 (structured review checklist)
收工判定代码质量高,测试有牙,文档/配置/构建表面一致,默认零变更。但这是 DRAFT 功能 PR + 新配置字段,需要 owner 签核配置契约。不批准——路由到 🔶 需要决策。needs-decision 标签已由 floor 5 打好。 注: |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) CI-engineer run complete: conflict resolved + red item fixed, both pushed, CI green on the new head. What I did this run
结构化八问
判定:冲突已解、红项已修、CI 绿,PR 分支 head = |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Independent review — code is clean, but this is a DRAFT feature PR with a new config field requiring owner sign-off.
I completed a full independent end-to-end review of the PR (head 08bf768, 27 files, +959/-27).
Verdict: 🔶 需要决策 — config contract pending owner sign-off
The code is clean (no blocking findings). However, this is a DRAFT feature PR that introduces a new config field dsh.nativeCompactionModels. Per Configuration Surface Discipline (owner-gated), a new config field requires owner sign-off BEFORE implementation. I confirm the needs-decision routing from the prior review with my own independent analysis.
I do NOT approve — not because the code is deficient, but because the config contract requires owner sign-off. The PR body itself states: "This PR is draft for maintainer review of the configuration/ownership contract. No maintainer approval, merge or release is implied."
What I verified
- kernel/ and pi-subagents/ UNTOUCHED — zero files under
kernel/orpi-subagents/in the diff. Nokernel-changedeclaration. The HARD RULE (kernel gate) does NOT apply. - Default
[]= zero change — with no config, the wire is byte-identical to today. Opt-in only. - Tests have teeth — 7 both-directions unit tests, e2e A/B (native/bili/native switch + bili-only vs routed-bili parity via forked proxies), real-DSH integration script, WS socket direct + refuse-reuse, native-intercept bypass bytes/headers.
- Docs/config/build surfaces consistent — en/zh docs, configuration.md, architecture.md, index.md, README.zh-CN.md, reference/architecture.md, website/config-reference/server.yaml, package.json exports, tsup.config.ts, check-unused-exports.mjs, live-files.mjs — all updated in the same PR.
- CI green per dispatch.
Findings (all non-blocking, already in prior review punch-list)
- Title-request zombie ledger (iso + gen≥1): title requests use raw
sidwhile main traffic is scoped → phantom conversation accumulates; untested. - Fail-closed blast radius (iso + DSH build lacking
session.surface.replaceGeneration): every conversation-id call throws → even bili models lose bili tools; should be disclosed in PR Behavior section. - Malformed-config edge: invalid entry throws at lane activation; preset keeps stock compaction-basic armed without bili tools; one doc sentence needed.
- Missing test rows (4): client React probe path,
/bili/origin?sessionId=policy face, title-request behavior, ready-set miss with valid id. - Nits:
noteGateCoverageskipped on noBackend branch; WS owner check on create-frames only (deemed fine);attachEngine~90L could split.
None blocking. All are disclosure/doc/test-coverage items already noted in the prior review.
收工判定
代码质量高,测试有牙,文档/配置/构建表面一致,默认零变更。但这是 DRAFT 功能 PR + 新配置字段,需要 owner 签核配置契约。不批准——路由到 🔶 需要决策。
Resolves the two doc/config conflicts from master's Japanese-docs + config-coverage work: - docs/architecture.md: union (keep PR's DSH native-model-policy intro line + master's en/zh/ja hub line). - website/config-reference/server.yaml: keep the PR's feature-aware dsh section desc (wire guard refuses UNMANAGED native compaction, nativeCompactionModels bypasses it) over master's stale 'refused unconditionally' wording; add the desc_ja that master's new gen-config-docs check-coverage now requires on every entry for dsh.nativeCompactionModels / .model / .provider. No code changes; config-coverage and architecture-docs guards green.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) PR #6123 冲突再次处理完成(master 在 11-12 之后又前进了 140 提交,触发新一轮 dirty 派发)。 状态核实(推送后单次 GET 确认,非轮询):
这次做了什么
结构化八问
判定:冲突已解、会红 CI 的 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Re-review at new head d98db52 — verdict unchanged: 🔶 需要决策 The new head is a pure master sync (merge commit Verdict stands: code clean, no blocking findings, but the new config field |
Resolves the one code conflict in src/agent/dsh-native.ts (master moved 265 commits past the previous merge base 36a04a7): - PluginContext.tools type: union of the PR's register {when} conditional (native-compaction model gating) and master's new tools.get? method. - restoreTools register call: keep master's host-owned-lifetime structure (owner.ctx.tools.register(definition), ranxianglei#6702/ranxianglei#3380) and re-attach the PR's {when} predicate so bili tools stay hidden on native-owned models. definition is the same toolDefinition(tool) master pre-builds into owner.definitions (line 1084), so behavior is identical to the PR's inline registration. Verified locally: typecheck + build green; dsh-native-compaction + dsh-native targeted suites 83/83 pass.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) PR #6123 冲突再次处理完成(master 又前进了 265 提交)。 先核实时况(本轮实测,非记忆): 上一轮我合到 做了什么
状态核实(推送后单次 GET): head 结构化八问
提示:这个 draft PR 生命周期较长,master 侧改动频繁(两天 265 提交),冲突会反复出现——每次 dirty 派发我会重新同步一次。CI 在新 head |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 本轮核对:PR 已不 dirty,无需处理——这是一条 stale 派发。 本轮实测(非记忆、非旧评论):
为什么这条派发是 stale:本条 forward 时间戳(00:24:49)与我上一轮推送 处置:不做冗余操作。重新把已是 master 子集的 PR head 再 merge 一次是空操作,只会制造一个空合并提交污染历史。PR 现在干净且与 master 同步,CI 在 本 bot 不撤 draft、不合并、不关闭(owner 权限)。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Re-review at head 88dea57 — verdict unchanged: 🔶 需要决策 Pure master sync (merge No new findings. Awaiting owner decision on the |
|
(ai: vllm-qwen/qwen3.8-27b) Re-review at head 88dea57 — pure master sync, PR-specific source files byte-identical to prior review. Verdict unchanged: 🔶 需要决策 (config contract pending owner sign-off). No new findings. |
# Conflicts: # src/agent/dsh-native.ts
[bot] 🏷 冲突已解决并推送(第 4 次接冲突)。master 前进 64 个提交(f648217cb8 → 301e1a5),PR head 88dea57 落后 → 真 dirty(非 stale)。已把 origin/master 合入 PR 分支,解决 七问:
状态:PR head = |
[bot] 🏷 本次为 stale dispatch(过期触发),未做任何改动——PR 当前不 dirty。 live 验证(本次 run 实测):
为何 stale:这条 "merge state: dirty" 事件在我上一次推送 未做改动的原因:master 已被 PR head 完整包含,再 merge 只会产生空 merge(no-op),违反「不为无冲突的 head 重复 merge」。 状态:PR head = |
ranxianglei
left a comment
There was a problem hiding this comment.
评审结论:功能方向认可,测试质量高,但属于设计级变更,不进这批批量合并 —— 需要你/维护者先拍板下面几个语义,之后可以单独走评审合并。
我做的验证
- 分支上 typecheck 干净,
git merge-tree与当前 master 零冲突。 - 新测试全跑过:
dsh-native-compaction+native-intercept+native-ws-intercept= 146/146,dsh-llm-stream-attribution9/9。 - 默认关闭已验证:配置缺省 →
rules=[], generationIsolation=false→ 所有新路径死代码(compactionConversationId返回原 sid、preset 走原分支)。
需要先明确的设计问题
- 按模型归属权契约:
dsh.nativeCompactionModels让选中的模型保留宿主原生压缩、其余走 bili。这是「谁拥有某模型的压缩」的新契约,且支持会话中途切换——切换瞬间两边对同一历史的状态归属怎么算,目前只由测试保证,没有实跑背书(见第 4 点)。 - 新的会话命名空间:
|dsh-generation:<N>后缀让 bili 会话 id 跟随 DSH 的session.surface.replaceGeneration。这意味着宿主一次「替换代」后,持久化/回放看到的是不同的会话 id——新的持久化语义,需要明确这是有意的(跨代隔离)还是实现副产品。 - DSH API 版本兼容面:
ctx.tools.register(definition, { when })(dsh-native.ts:1015)、agent/pre-step前置、ctx.effect/ctx.inject(["compaction"])都依赖你自己在 PR 描述里标注「需要额外兼容验证」的 DSH 版本矩阵。读错一个版本是整条 lane 变砖的风险,不是常规回归。 - 交接失败模式是被接受的,不是被修掉的:PR 描述记录了两例 GLM→Luna 切换在 stock shrink guard 处失败,且主动删掉了早先的 budget/split/retry 机制。这个 trade-off(接受交接失败)应该由人签字,不应该随批量 bugfix 悄悄进来。
- 文档与代码不一致(建议修):
website/config-reference/server.yaml写default: "[]",但显式空列表不是默认行为——configureNativeCompaction([])会置generationIsolation = true(dsh-native-compaction.ts:40),即写nativeCompactionModels: []会在零规则下激活后缀会话 id 和 tool-when 门控。PR 描述承认了这点,但 YAML 的default: "[]"仍然误导,建议改为说明「缺省关闭;显式 [] 仅启用代隔离」。 - 配置错误的爆炸半径:一条坏规则会让
configureNativeCompaction()抛错,而它跑在declareDshCompactionActive()里(dsh-compaction-disable.ts:83)——一个新 key 打错可以整个 bili-native DSH 插件加载失败。「显式失败」可以接受,但目前没有任何降级或启动提示,建议在文档里写明。
以上 1-4 是「要不要按这个契约做」的决策,5-6 是落地前的小修。等决策后这个 PR 本身可以单独合。
…l-native-compaction
…els (ranxianglei#6123) The PR added the dsh.nativeCompactionModels seed entries and regenerated the EN/ZH config docs, but the Japanese artifact was left stale — the docs-sync drift guard (gen-config-docs generate + git diff --exit-code) went red on the merge ref. This commit is the generator's own output; no manual edits.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Re-review at head 7bb2966 — verdict unchanged: 🔶 需要决策 New PR commit No new findings. Awaiting owner decision on the config contract. |
|
(ai: vllm-qwen/qwen3.8-27b) Re-review at head 7bb2966 — new PR commit is docs-only (regenerated configuration.ja.md for the new config entries). All source code byte-identical to prior head. Verdict unchanged: 🔶 需要决策 (config contract pending owner sign-off). No new findings. |
(ai: vllm-qwen/qwen3.8-27b) CI fixed — both failing checks are green on the new head What I did this run:
八问:
收工判定:CI 全绿,两个 blocker 已消除,PR 处于可审状态(仍为 draft,由作者/owner 决定转正)。 |
…l-native-compaction # Conflicts: # src/agent/dsh-compaction-disable.ts
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Re-review at head 15efcee — verdict unchanged: 🔶 需要决策 Pure master sync (merge No new findings. Awaiting owner decision on the |
|
(ai: vllm-qwen/qwen3.8-27b) Re-review at head 15efcee — pure master sync, PR code identical to prior head. Verdict unchanged: 🔶 需要决策 (config contract pending owner sign-off). No new findings. |
(ai: vllm-qwen/qwen3.8-27b) Merge conflict resolved — the PR is now What I did this run:
八问:
收工判定:冲突已解、CI 全绿,PR 处于可合并状态;当前 mergeable_state=blocked 仅剩人工 review 审批(本 PR 为 feat 类,按 §7.4 属 human-only 档),等 reviewer/owner 批准,合并动作由人执行。 |
DSH Web users can select models that use stock DSH compaction while unmatched models continue to use bili. For example,
gpt-*/codex/gpt-*use native compaction and GLM/Kimi use bili, including switching within one session. Wire passthrough alone cannot restore the disabled host backend.Refs #6121; related #6106, #5975, #5300/#5404 and #4872/#4883.
Configuration surface proposal
Adds opt-in
dsh.nativeCompactionModels: Array<{ provider?: string, model: string }>. Provider IDs match exactly; model IDs match exactly or by a trailing prefix*. No setting retains the existing bili behavior. Restart the host after changing the preset policy. An explicitly empty list returns all models to bili while retaining the generation isolation established by earlier native checkpoints; deleting the setting is a separate migration.This remains a draft for maintainer review of the configuration and ownership contract. No maintainer approval, release or merge is implied.
Behavior
summarizeexactly once with the same input, agent, signal and receiver. Return its result/error unchanged. DSH owns thresholds, retention, model selection, prompts, output limits, pressure retries and checkpoint transactions.surface.replaceGenerationas the bili namespace boundary. Native checkpoints invalidate old fold identity without mutating the original event log. Replaying a session preserves this namespace. Ordinary appends and switches without a host replacement keep it stable.There is no additional summary budget check, tool-schema reservation, message splitting, intermediate summarization, recursive merge or merge prompt. Those additions from earlier revisions of this draft have been removed. An oversized native request has stock DSH/provider failure behavior; this routing feature does not promise successful handoff of arbitrarily long history. The earlier Luna merge-quality A/B measured the removed implementation and is not acceptance evidence for this revision.
Validation
0.2.2-rc.1engine differential integration: 13 cases compare an engine without the policy adapter against one with it. Both start from exactly equal events. Compare complete summary requests, compaction events, replacement generations and measured context; normalize only newly generated host IDs. Cases cover below-pressure, pressure, two consecutive native compactions, manual/region compaction, model switching, explicit summarization model, provider error, retry, cancellation, oversized history and large/oversized tool catalogs. Error cases preserve history in both arms.compresstool, resend its real call/result, and verify the retained summary and shorter request. Ignore only fold timestamps, durations and generated invocation IDs. Assert routing rules are active after plugin initialization.c4a91e9c4d882b8dcd4c5530436e39740509f304: 38 successful, 14 conditionally skipped, none failed or pending. Skipped checks are not claimed as executed coverage.The differential upstream is deterministic to eliminate model randomness. These tests establish routing/algorithm-call parity for the covered cases, not universal summary fidelity.
Subsequent live deployment validation
The same head was backed up and installed through the official DSH plugin installer on the target Mac mini; all 21 installed dist files match the verified candidate. Two new real sessions exercised Luna native automatic/manual compaction, GLM bili compression, and both round trips. Eight successful native summaries and one bili block retain five fixed facts each; six recall checks pass. Thirty-nine raw-history prefix comparisons are unchanged. In the native handoff, DSH selected the previous GLM model for summaries; the old bili request counter remained 17 → 17, confirming the auxiliary calls bypassed bili. Returning to bili used a fresh namespace without old folds. Existing sessions remain listed, compression configuration is unchanged, and the prior default model was restored.
This was not an entirely clean run. The longer GLM → Luna switch failed twice at the stock shrink guard (summary 688 >= 432 and 431 >= 429 estimated tokens); completed checkpoints survived and the previous request header was preserved. Stock /compact then reduced the retained history and enabled the switch and return. One ordinary Luna pressure-compaction attempt also failed the stock shrink guard but its turn continued successfully. One GLM upstream stream_error recovered on short requests, and one GLM answer invoked read-only acp_status despite a no-tools prompt. These outcomes remain documented, with no adapter budget, splitting, prompt or retry changes. Bili compaction was explicitly requested; the 200000-token automatic nudge threshold was not exercised.
Compatibility and patch maintenance
Web standard/ptc/cordis and structurally equivalent presets with
dsh-compaction-basicare covered. Stock minimal remains without a compaction backend; unsupported/unattached policies fail explicitly. Unknown DSH API versions and root-plane CLI compositions require additional compatibility validation.The bilingual guide and detached-runtime integration script ship with the source. The local patch kit pins the upstream base, source commit, cumulative patch hash and DSH module hashes. Updates reapply to a clean checkout and rerun tests/build/integration before creating a candidate. Conflicts or failed checks retain the installed version; unknown future versions are not assumed compatible.
No kernel or proxy compression-pipeline changes, package version bump, registry publish or merge. The verified local package has been deployed after backup; the PR remains a draft.