Repository navigation
fix(#2709): attribute framing-absent dsh native compaction via refusal ledger (inferred tier) - #2715
Conversation
[bot] 🏷 收到,开始按 PR Review 规范审查本 PR(方向关→回归关→代码关→测试关→diff 整洁度)。先核对分支代码与 CI 状态,结论稍后按结构化八问给出。 |
06b40f5 to
e39f3cb
Compare
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2957-pr.2715.ad670edThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2715.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 冲突已解决 + 审查完成。PR 现已 mergeable(与 master 无冲突),CI 在新 head 上运行中。 按结构化八问给出结论。 冲突处理(本次唤醒的直接任务)
八问
审查发现与处置(小问题直接修)
判定可合并——冲突已解、方向关/回归关/代码关/测试关/diff 关全过,CI 转绿后即可由你合并(合并权限在你)。遗留待裁决项维持 #2709 线程原状:P3 bili 侧开关(owner-gated 新配置面)、P2 CONFIGURATION.md 文档半(refusal≠prevention + DIRECT 旁路说明,follow-up commit)、#2709↔#2592 归并与 F2 方向统一(归因 only vs rebase 升级,需你定调)。 |
…l ledger (inferred tier) When a client-native (dsh) compaction lands WITHOUT its checkpoint marker in the resent history, the #1001/#2193 detectors classify it as a generic unannounced rewrite and the banner sends the user hunting for a phantom second compressor. bili already witnesses such landings indirectly: it refuses the client's own compaction calls (#1729/#2028) and counts them in metadata.dshCompactionRefusals. Add a native-compaction-inferred conflict tier: when a dsh-bound session has a non-zero refusal count AND a bulk rewrite is detected, attribute it to client-native compaction instead of leaving it unconfirmed. Attribution ONLY - without the marker bili cannot identify the checkpoint, so no rebase (recovery stays markCompactionBoundary, byte-identical to before). Wired at both #1001 sites (prepare-openai/prepare-anthropic) and the #2193 destruction escalation (fold-reconcile); classified as confirmed-native on the server ladder and mirrored in the web banner so the two surfaces agree. Regression test tests/issue2709-dsh-native-compaction-attribution.test.ts.
…uction point The original PR pinned the witness predicate and banner tiering but left the two decision-point wirings untested at call-site level: removing the dshNativeCompactionWitness branch in fold-reconcile.ts would have stayed green. Adds two regression tests to the existing #2193 escalation scaffolding: witnessed dsh total-loss drift records exactly ONE native-compaction-inferred event (ESCALATED latch), unwitnessed variants (no binding / zero refusals / non-dsh) record none.
e39f3cb to
aa1bde8
Compare
冲突已解,已重推。 根因:PR 分支停在旧基线 处理:把 PR 分支 rebase 到当前 master( import { coveredRealHistoryIds, isResponsesTurnSeparatorId } from "./session.js";
import { dshNativeCompactionWitness, recordConflict } from "./conflict-watch.js";无任何其它语义改动;两个提交(fix + test)原样保留在新基线上。 重推后本地已验:typecheck 干净;定向套件 170/170 通过(fold-reconcile 家族 + #2658/#2451/#2432/#2709)。 CI:新 head |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.251-master.76143a8 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Follows #2709 (core attribution gap; P3 bili-side switch + CONFIGURATION.md doc note deferred to owner decision — see issue thread)
Problem
When a client-native (dsh) compaction lands without its
<compacted-summary>checkpoint marker in the resent history, the existing detectors classify it as a generic unannounced rewrite:#1001(detectUnannouncedHistoryRewrite, prepare-openai/prepare-anthropic) → recordsunannounced-rewrite;#2193total-loss drift escalation (fold-reconcile) → logs only, no ledger action.The banner then tells the user there is an "unconfirmed signal / reason unknown" and points them at disabling auto-compaction or hunting a second compressor — but bili already witnessed the real cause: it refused the client's own compaction calls this session (
metadata.dshCompactionRefusals, #1729/#2028) and never used that witness for attribution.Fix (attribution only — no rebase)
Add a
native-compaction-inferredconflict tier. When a dsh-bound session has a non-zerodshCompactionRefusalsAND a bulk rewrite is detected, attribute the event to client-native compaction [inferred] instead of leaving it unconfirmed.Key design decision: attribution ≠ rebase. Without the checkpoint marker bili cannot identify the new baseline/checkpoint, so it must NOT
reconcileNativeCompactionBoundaryonto a guessed view. Recovery stays exactlymarkCompactionBoundary(archive+prune) — byte-identical to before. Only the classification label and user-facing wording change.Wired at:
#1001sites (prepare-openai.ts,prepare-anthropic.ts) — responses/google have no 模型切换后压缩块跨模型失配,新模型收到 61.3 万 token 全量上下文 #1001 site;#2193destruction escalation (fold-reconcile.ts) — once per episode (guarded by the existingESCALATEDlatch).The server classification ladder treats inferred as confirmed-native (
isConfirmedConflictEvent), and the web banner mirrors it (src/web/client.ts) so the two surfaces agree.Behavior changes (old → new) — flagged per policy
unannounced-rewrite→ now recordsnative-compaction-inferred. Non-dsh sessions and dsh sessions with zero refusals are unchanged (stillunannounced-rewrite).#1001): when witnessed, the warn line reads "client-native compaction landing (framing absent; attributed from refusal ledger)" instead of "unannounced client history rewrite".summarizeConflicts.kindsnow surfaces anative-compaction-inferredcount (serves [Bug] #1001 归因缺口:客户端原生压缩落地后只剩「未确认档」——bili 已记录的 17 次拒绝(dshCompactionRefusals)与 10 次 DIRECT 旁路未被用于归因 #2709 P2 quantification); no new field added.No wire/message-shape change, no config-schema change, no kernel change, no rebase path touched.
Tests
tests/issue2709-dsh-native-compaction-attribution.test.ts: witness predicate (dsh / non-dsh / zero / string), inferred-only → confirmed-native advice ("did NOT see the checkpoint marker", not "rebuilds the fold state"), confirmed keeps old wording, unannounced stays UNCONFIRMED, mixed → rebuild wording wins.tests/web-conflict-banner.test.ts: inferred counts as CONFIRMED on the client-side severity mirror (not an unconfirmed signal).Out of scope (owner decision, tracked in #2709)