Repository navigation
fix: dsh native-compaction detector requires user/text carrier + novelty (#2621) - #2628
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2852-pr.2628.3915499This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2628.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 收到,按 [PR] 流程做了核对(拉分支读代码、查 CI、查原 issue),不重做。先给结论:这个 PR 本身逻辑是对的,但它和已经合并的 #2629 重叠,且基于过期 master + CI 有一处红,现状不可合并。 下面是结构化八问 + 关键发现。 结构化八问
关键发现:与已合并的 #2629 重复(同源 issue #2621)
建议(owner 拍板)
收工判定不可合并(stale base + CI red + 与已合并 #2629 重叠)。请 owner 二选一:① rebase-keep(我可在你确认后执行 rebase + 定向验证,不擅自 push);② close-redundant。无论哪种,都需要先定位 —— 以上仅审查结论,未做任何 push/merge。 |
…lty (#2621) carriesDshLocalCompactionSummary matched the checkpoint framing bytes on ANY resent message, so a session whose history merely quoted the marker (a tool result that read a transcript, model reasoning citing it, the bili compress tool-call args quoting it) plus an ordinary fold-coverage gap was misjudged as a landed native compaction: ACP fold state rebased/cleared and a misattributed native-compaction conflict recorded (v0.1.190, #2621). Two gates tighten the match to the case where a checkpoint just landed: (1) CARRIER - role=user AND plain text (contentType text when typed); tool results, reasoning, tool-call args, and assistant prose are excluded. (2) NOVELTY - the framing message raw id must not already be in the pre-turn ref map; a freshly-landed checkpoint is a NEW id while a quote/replay is old. Both call sites pass the set (prepare-openai reuses knownRefsBefore; prepare-responses adds a pre-turn byRaw snapshot). The positive landing path is unchanged and still green. Regression tests: carrier+novelty unit truth table plus an e2e proving a marker quoted by a non-user carrier together with a real fold gap does NOT rebase.
a2043ce to
29fb444
Compare
[bot] 🏷 收到上游冲突唤醒。先独立核实了前提(没盲从那段被标记为不可信的转发文本):PR #2628 做了什么
结构化八问
待 owner 拍板(结论不变)相对当前 master,这个 PR 的净增量已收敛为「novelty gate + 接线 + 测试」。novelty gate 守护的是一个未在报告 repro 中出现过的窄残留(user 在更早的 user/text turn 逐字粘贴框架串),而 #2629 的 carrier gate 已经修好报告场景。所以仍是二选一:
收工判定冲突已解决,分支已 rebase 到最新 master 并推送,预期 mergeable 转干净(基于最新 master 且无文件重叠)。本地 typecheck + 定向测试绿,但全量 CI 尚未在新 head 上跑完(尤其 windows-node24 要看这次是否复现)。请 owner 定 keep / close;若 keep,等本轮 CI 全绿即可合并。 —— 仅完成 rebase / resolve / push + 定向验证,未做任何 merge。 |
[bot] 🏷 推送后核实了实际状态(补上一条里「预期转干净」的实测):
|
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.234-master.d101fb5 # this exact build
npm install -g billion-context@master # always the newest merged build
|
What / why
Fixes a false positive in the dsh native-compaction detector introduced with #2432. A long session whose history merely quoted the
<compacted-summary>checkpoint string — without any host compaction actually happening — was misjudged as a landed native compaction: the ACP fold state was rebased/cleared and a misattributednative-compactionconflict was recorded (reported on v0.1.190, commit e1cd9e1).In the reported session the transcript had zero
compaction/events and zerocommand/run compact, yet 36 lines carried the marker — all as quotes (a tool result that read another session's transcript, model reasoning citing it, bili's own compress tool-call args quoting it), never as its production. Combined with an ordinary fold-coverage gap from bili's own folding/drift, both detector signals were satisfied with no host compaction.Root cause
carriesDshLocalCompactionSummary()matched the framing bytes on any resent message's text, ignoring who produced it. The detector ANDs two signals (a fold-coverage gap + "checkpoint framing present"); both are host-compaction-independent in this scenario, so the more folded / lower-retained a session is — i.e. the one most needing protection — the more likely the false positive. It is also self-reinforcing: investigating the false positive (reading the transcript) creates more carriers that keep it firing.Fix
Tighten the framing match to "a checkpoint just landed" with two gates (both facets of one mechanism — detector precision):
role="user"AND plain text (contentType="text"when typed). Tool results, reasoning blocks, tool-call arguments, and assistant prose are structurally incapable of being a checkpoint and are excluded. On the Anthropic lane atool_resultrides inside a wirerole:"user"message but flattens torole:"tool"/contentType:"tool-result", so the role gate alone already drops it; the contentType gate is belt-and-suspenders.Object.keys(session.state.messageRefs.byRaw)taken before the turn). A freshly-landed checkpoint is a NEW id; a historical quote/replay hits an OLD id. Closes the residual of gate 1 (a user who literally pasted the framing in an earlier turn).Both call sites pass the set:
prepare-openai.tsreuses its existingknownRefsBefore;prepare-responses.tsadds an equivalent pre-turn snapshot. When omitted (direct callers) the novelty gate is skipped and only the carrier gate applies.Behavior change (intended)
native-compactionconflict recorded.No config surface added or changed. No
kernel/changes (host-sidesrc/serveronly).Tests
tests/issue2432-dsh-local-compaction.test.ts): positive only on a user/text carrier; negative for assistant reasoning, tool result, assistant tool-call args, assistant prose, untyped messages, and the bare word "compacted"; plus a novelty test (old id ⇒ no match, fresh id ⇒ match, omitted set ⇒ carrier-only).98fb91cc2). Full suite left to CI.Closes #2621
Related: #2432/#2436 (the detector this targets); #2592/#2599 (anthropic/google lane wiring gap — unrelated).