Repository navigation
[PR] feat(dsh): emit compression coverage readout on the first routing request (#6770) | feat(dsh): 在首个路由请求上输出压缩覆盖读数 (#6770) - #6772
Conversation
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。本 PR 针对 #6770(#3962 覆盖读数缺口的后续),与既有 issue/PR 无重叠。 结论: 可合 (approve) — 高质量外部贡献,无需重构。 结构化八问
代码质量(逐项过⑤b硬标准)
测试有效性(④)
CI 与基线
判定可合。 解决 #6770 的读数出口缺失:代码整洁、注释到位、核心逻辑有真测试、无回归、CI 绿、基线最新。外部贡献达到项目标准,无需对齐重构。 |
3e49cb3 to
7f57b51
Compare
4f518a2 to
08f704a
Compare
The #6772 formatter tests never exercised the emission path (first routed request through takeoverGate -> exactly one [dsh-client] line in bili.log, once per process). Add the once-per-process flag reset hook and a wiring test on the #1772 paradigm (drive apply + gate, read bili.log, assert count + exact line).
ba26388 to
50584be
Compare
The #6772 formatter tests never exercised the emission path (first routed request through takeoverGate -> exactly one [dsh-client] line in bili.log, once per process). Add the once-per-process flag reset hook and a wiring test on the #1772 paradigm (drive apply + gate, read bili.log, assert count + exact line).
50584be to
cd6c615
Compare
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
APPROVE — independent review of head cd6c61597 (2 commits, +154/−8 across 4 files; base = current master, 0 behind).
Direction. Issue #6770's diagnosis holds: the #3962 coverage readout's only exit was the durable profile-bundle note, which stays silent wherever profileContext.startedBundles cannot be read (observed on both desktop dsh and dsh-go) — so the reading had no reachable exit at all. The PR implements the issue's own proposal: one [dsh-client] line on the first routed request, pure logging, no wire/config/env changes. The startedBundles root cause is explicitly left to #6778. Correct layer, correct scope.
What I verified:
gateCoverageSuffix()refactor (src/agent/dsh-native.ts:296) is byte-identical to the old inline strings in BOTH branches — the two profile notes (src/agent/dsh-native.ts:2921, :2930) are unchanged.- The new block in
attributionOf()(src/agent/dsh-native.ts:1341–1352) is a once-per-process log write guarded bycompactionCoverageNoted, set before the write (no double-emit); it precedes the scoped-store logic and cannot alter the return value or control flow. Same pattern as the existingnoticedScopedAttributionflag. compactionCoverageText()(src/agent/dsh-compaction-disable.ts:138) is pure over the record; the empty frame honestly says "no preset entry rewritten in this process (preset configs resolve lazily…)" instead of a bare zero that could be misread as "nothing needed rewriting".- The removed
dshCompactionGateTelemetryimport has no remaining references in src/agent/dsh-native.ts. - Tests: ran both files locally —
tests/issue6770-compaction-coverage-text.test.ts4/4 (case 4 drives the REAL overlay middleware through the public API, not a mock) andtests/dsh-llm-stream-attribution.test.ts8/8 (the new wiring test pins the emit itself: exactly one line on the first gate-routed request, none on the second).tsc --noEmitexit 0. - CI on head cd6c615: 52/52 check runs completed — 38 success, 14 skipped, 0 failed.
- No kernel/ changes, no kernel-change declaration → no human-tier gate applies.
The new wiring test also closes the gap noted in the 2026-11-14 review round (at the old head a43596e the once-per-process line itself was untested; only the formatter was).
结构化八问
- 是什么问题: #3354/#3962 的 compaction overlay 覆盖读数(overlay 实际改写了哪些 preset 条目)此前唯一出口是 profile-bundle note,而该 note 依赖
profileContext.startedBundles有值才发声;实测所有宿主(桌面 dsh、dsh-go)都读不到该值,读数因此没有任何可用出口。 - 什么原因导致的: 读数的出口与一个当前 dsh 构建上探测不到的值(
profileContext.startedBundles)耦合——出口被探测缺口卡死。overlay 本身与 telemetry 记录都正常,缺的只是一个不依赖该探测的出口。探测缺口本身的根因另由 #6778 跟踪,不在本 PR 范围。 - 影响范围与严重程度: 纯可观测性。受影响面:所有 dsh 宿主上「overlay 覆盖了哪些条目」不可见;压缩功能、wire、配置面均不受影响。严重程度:观测缺口(p3 级)——无数据丢失、无可用性影响。
- 怎么修复的: 把读数格式化收敛为单一纯函数
compactionCoverageText()(旧 note 与新出口共用,旧 note 输出逐字节不变);在attributionOf()(dsh 车道 gate 主路径必经,模型请求/headersFor/命令路径均经过)打一条进程内一次的[dsh-client]日志。选这个点:preset config 延迟解析,首个被归属请求是改写已可能发生的最早可靠观测点;命令路径理论上可先于首个模型请求触发,但 preset 在会话建立时已解析,且行内措辞(lazy-resolution 说明)已覆盖该边界。 - 是否有回归问题: 无。逐项过了触碰路径的既有行为:(a)
gateCoverageSuffix()两个调用点(profile note)——空/非空两分支重构后逐字节一致;(b)attributionOf()返回值与控制流不变,新增块只写日志;(c) 移除的 import 无残留引用。无语义漂移、无 fail-fast 变吞错、无阈值/时序/输出格式变化;唯一行为变化是每进程新增一条日志行(PR 正文已披露)。 - 是否破坏缓存: 不涉及。不触碰缓存、重试、增量游标、去重键。
- 是否改了设计方向: 不涉及。纯增量观测出口;
startedBundles根因留给 #6778。 - 是否引入了新的配置: 不涉及。无新 env/config/默认值。
Verdict: mergeable. Note: feat: scope → not an auto-merge candidate per §7.4; human merge.
(ai: vllm-qwen/qwen3.8-27b) 审核完成:APPROVE 已提交(head |
cd6c615 to
1d304fc
Compare
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
APPROVE — re-review of the rebased head 1d304fcda.
What changed since the previous review (cd6c61597): rebase only. The PR's own content is byte-identical — the diff against master is unchanged (4 files, +154/−8; verified by diffing the old and new PR diffs). The new base 77fe0b1d63 pulls in #7054 (attribution diagnostics topic, src/web/diagnostics.ts) and #6592 (docs/clients) — neither touches this PR's four files, so there is no semantic interaction. Branch is 0 behind master.
Fresh verification on this head:
- Local:
tests/issue6770-compaction-coverage-text.test.ts4/4 +tests/dsh-llm-stream-attribution.test.ts8/8,tsc --noEmitexit 0. - CI on head
1d304fcda: 52/52 check runs completed — 38 success, 14 skipped, 0 failed. - No kernel/ changes, no kernel-change declaration → no human-tier gate applies.
The substance review (pure formatter, byte-identical gateCoverageSuffix() refactor, once-per-process gating in attributionOf(), real-middleware + real-gate test coverage) stands exactly as in the cd6c61597 review — same bytes, same conclusions.
结构化八问
(内容与上一审核 head cd6c61597 逐字节一致,以下逐项重新核对本 head 后沿用结论)
- 是什么问题: #3354/#3962 的 compaction overlay 覆盖读数(overlay 实际改写了哪些 preset 条目)此前唯一出口是 profile-bundle note,而该 note 依赖
profileContext.startedBundles有值才发声;实测所有宿主(桌面 dsh、dsh-go)都读不到该值,读数因此没有任何可用出口。 - 什么原因导致的: 读数的出口与一个当前 dsh 构建上探测不到的值(
profileContext.startedBundles)耦合——出口被探测缺口卡死。overlay 本身与 telemetry 记录都正常,缺的只是一个不依赖该探测的出口。探测缺口本身的根因另由 #6778 跟踪,不在本 PR 范围。 - 影响范围与严重程度: 纯可观测性。受影响面:所有 dsh 宿主上「overlay 覆盖了哪些条目」不可见;压缩功能、wire、配置面均不受影响。严重程度:观测缺口(p3 级)——无数据丢失、无可用性影响。
- 怎么修复的: 把读数格式化收敛为单一纯函数
compactionCoverageText()(旧 note 与新出口共用,旧 note 输出逐字节不变);在attributionOf()(dsh 车道 gate 主路径必经)打一条进程内一次的[dsh-client]日志。选这个点:preset config 延迟解析,首个被归属请求是改写已可能发生的最早可靠观测点。 - 是否有回归问题: 无。逐项过了触碰路径的既有行为:(a)
gateCoverageSuffix()两个调用点(profile note)——空/非空两分支重构后逐字节一致;(b)attributionOf()返回值与控制流不变,新增块只写日志;(c) 移除的 import 无残留引用。无语义漂移、无 fail-fast 变吞错、无阈值/时序/输出格式变化;唯一行为变化是每进程新增一条日志行(PR 正文已披露)。rebase 带入的 #7054/#6592 与本 PR 四文件零交集。 - 是否破坏缓存: 不涉及。不触碰缓存、重试、增量游标、去重键。
- 是否改了设计方向: 不涉及。纯增量观测出口;
startedBundles根因留给 #6778。 - 是否引入了新的配置: 不涉及。无新 env/config/默认值。
Verdict: mergeable. Note: feat: scope → not an auto-merge candidate per §7.4; human merge.
(ai: vllm-qwen/qwen3.8-27b) 复审完成(head 已 rebase 至 |
|
Your fix is merged — it landed via the wave-11 batch merge (#6827 → master GitHub did not auto-flip this PR to Merged because the head of the branch moved after the batch snapshot (a rebase onto newer master changed the commit object ids), so the PR's current tip is not literally an ancestor of master. A Closing as merged-via-batch. Thanks for the honest-log fix. |
问题
#6770:#3962 的覆盖读数只挂在 profile-bundle note 上,而那条 note 需要
profileContext.startedBundles有值才发。实测桌面 dsh 与 dsh-go 宿主两端都读不到这个值(手机bili.log1.85 MB、桌面 8.5 MB,profile bundles与Overlay coverage so far均 0 命中),于是读数在两端都没有出口。改动
src/agent/dsh-compaction-disable.ts:新增纯函数compactionCoverageText(),把覆盖读数收敛到一处。记录为空时如实说「本进程还没改写任何 preset 条目」并附延迟解析的说明,不写「0 条」以免被读成「确实不需要改写」。src/agent/dsh-native.ts:gateCoverageSuffix()改为调用该函数,输出与原来逐字节相同(既有 note 行为不变)。attributionOf()内新增一条进程内一次的输出:bili-native-dsh: compaction overlay coverage — … (#6770);另补_resetCompactionCoverageNoteForTest()测试钩子(与_resetDshNewerBuildNoteForTest同族)。影响面
纯日志。不改 wire、不改配置面、不加 env;不读
profileContext,因此不受该探测缺口影响。验证
tests/issue6770-compaction-coverage-text.test.ts:4 用例钉住格式化(空记录措辞、单复数、空 covered 列表、默认参数读实时记录)→ 4/4 通过。tests/dsh-llm-stream-attribution.test.ts:新增 1 用例钉住发声接线本身——用真实 takeover gate 走一次首个路由请求,断言读数写出恰好一次、第二个请求不再重复 → 该文件 7/7,两个文件合计 11/11 通过。npm run typecheck(tsc --noEmit)exit 0。Fixes #6770
相关:#6588(dsh-go 宿主识别)、#3962(覆盖读数来源)、#6778(根因汇聚单 observability;本 PR 只覆盖其中的 #6770 一半,#6729 未触碰)