Repository navigation
feat: surface identity-loss takeovers with an identity-orphan conflict event (#2791) - #2802
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3087-pr.2802.e7802dfThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2802.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review started on PR #2802 (detection-only |
…#2802 review) The new identity-orphan kind rendered through the generic non-plugin path of formatConflictSection, which is wrong for it: an orphan-only ledger got the [suspected]-plugin advice ('confirm each named plugin really compresses before removing anything') plus the per-client auto-compaction remediation footer and the #1206 third-party-plugin docs pointer — actively misleading guidance on exactly the session that lost fold continuity, since bili's own resolver produced the event and there is no second compressor to hunt for (honest-output guardrail, #155; #2545 tiering discipline). - new advice tier between nativePresent and pure-[suspected]: identity-loss framing (host lane stopped stamping identity, headerless replay minted the anonymous fork, restore the lane or start fresh), active + historical variants - Fix footer + docs pointer skipped for orphan-only ledgers (same precedent as the neutral-only skip) - gated strictly to orphan-only ledgers: mixed ledgers keep their existing tier verbatim - regression tests pin the orphan-only framing and the mixed-ledger non-change
[bot] 🏷 Review complete — recommend merge (human merge; feat-tier per §7.4). One review finding found and fixed directly on the branch: new commit 结构化八问1. 是什么问题 2. 什么原因导致的 3. 影响范围与严重程度 4. 怎么修复的 5. 是否回归问题 6. 是否破坏缓存 7. 是否改了设计方向 8. 是否引入了新的配置 测试有效性(质量关)正例在 master 上失败(A/B 3/5 → 5/5,真断言有牙);三个负例钉住误报边界(异内容同 shape churn / 匿名链 / 超出 64-append 界 80 转不标记);集成测试钉住 diagnostics-only(状态快照相等、恰好一个事件、detail 正则点名 本地定向验证(全量交 CI)conflict-remediation/lifecycle/web-conflict-banner/acp-status 43/43;prefix-affinity-orphan 5/5;prefix-affinity/simhash/issue2601×2/dsh-persona-fingerprint 邻接 69/69;typecheck clean。分支落后 master 2 个提交(#2795 merge、#2784 cache-ledger fix),均只碰 cache-ledger 测试文件,与本 PR 无热点冲突,rebase 干净,BEHIND 不构成阻塞。新 commit 推送后 CI 将全量把关。 判定:可合(merge 由人执行:https://github.com/ranxianglei/billion-context/pull/2802)。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.286-master.e013660 # this exact build
npm install -g billion-context@master # always the newest merged build
|
…ranxianglei#2969) - add the dsh ACP protocol adapter to the verified non-compressor list (its 'acp' suffix names Agent Client Protocol, not acp-kernel); exact token match, lookalikes still flagged; stock [suspected] records are neutralized at display time, no data migration - widen the path-segment matcher so scoped names match Windows paths too - pure [suspected] ledgers drop the imperative per-client fix footer / web hint block (acp_status + banner); confirmed and unconfirmed-signal tiers keep remediation, mixed ledgers stay verbatim (ranxianglei#2802 gate) - CONFIGURATION.md scanner section updated to match
…n events (#4141 review) Review of #4141 found that a session whose conflict ledger contains ONLY the new id-churn-adoption events (the exact shape this PR produces on a clean cross-build restart) fell through formatConflictSection into the [suspected]-plugin tier: header claimed 'something outside bili touched this conversation' and the advice told readers to 'confirm each named plugin really compresses' — both false, since the event is bili's own fully-handled re-mint adoption (#3642 D1). Same misframing class as #2802 (orphan-only) and #2912 (handled-native-only). Fix: dedicated adoptionOnly tier in the branch ladder (gated to pure ledgers so mixed ledgers keep their existing wording verbatim) with accurate header + active/historical advice; regression test pins the framing and the absence of plugin-hunt/remediation output. No behavior change beyond the panel/advice text.
A session whose stored folds expose no anchorable covered surface (the host resent history matching none of the folded originals — mass representation drift, #2431/#2847 family) hit the covered-empty early exit of reconcileFoldCoverage, which reset drift state and returned silently. The terminal state therefore showed healthy book values and ZERO log lines: the v0.1.195 retest in #2438 (floor 18) produced no drifted/destroyed/ tolerated line at all, leaving operators blind while the wire stayed fully unfolded/doomed. Now, when stored blocks exist but none exposes an anchorable covered id: - one ERROR line per session lifetime (persisted free-form metadata latch, deliberately outside resetFoldDriftState so it cannot re-fire on every request of the episode); - one 'fold-vacuum' entry in the per-session conflict ledger (recordConflict already marks dirty, so the latch rides the existing save); - a dedicated pure-case tier in formatConflictSection so a vacuum-only ledger is framed as bili's own terminal diagnostic (no second compressor, recovery = host resends matching bytes or fresh conversation) instead of falling into the [suspected]-plugin advice or the generic remediation footer. Mixed ledgers keep their existing tiers verbatim (.every() gating, same pattern as the #2802/#2912 pure-case tiers). Report-only by design: zero behaviour change beyond the report — no wire, config, persistence-format, or fold-state change. The behavioural response layer (bound/regime/retire facets) stays pending #3978 coordination.
Closes the SILENT half of #2791 (the layer that a headless proof CAN cover).
What #2791 exposed
When a host loses its client identity mid-conversation (observed case: dsh's anthropic-messages lane bypasses the native-intercept fetch patch — every request arrives with ZERO bili headers), the anonymous resolver mints a fresh
pfa-*session and the identified conversation's fold ledger is orphaned with no observable signal anywhere: the next request pays a full silent re-fold (#2733/#2741 measured a 263%-of-window replay).The root cause (host fetch-capture timing) is out of bili's reach. The silence is not: the resolver already held every signal needed to NOTICE the takeover — an identified chain whose depth the incoming anonymous history reaches, plus the #2601 normalized tail fingerprint that survives cross-wire re-serialization of the same turn. It just never reported it.
Change (detection-only, resolution untouched)
src/prefix-affinity.ts—resolve()grows an orphan-suspect scan on the new-mint path: for every IDENTified chain within the append window (entry.depth <= incomingDepth <= entry.depth + ALIGN_TAIL_APPEND_MAX), fingerprint the incoming list AT THE POSITION where the chain ended (normalizedTailHashOf(messages, entry.depth)— handles a replay with appended turns). Match => the chain id lands inAnonymousAffinity.orphanSuspect(diagnostics only; Claude 上 resume 导致消息错乱 #1486 stands — the anonymous world never adopts an identified session).src/server/handle.ts— the mint consumes the flag: awarnlog line ([prefix-affinity] anonymous <proto> replay carries the conversation tail of identified session(s) …) plus arecordConflict(suspect, "identity-orphan", …)event on the ORPHANED session, naming the freshpfa-*fork so the sessions UI shows why compression continuity broke.src/conflict-watch.ts— newidentity-orphanConflictKind (renders through the existing non-plugin generic path).Design notes:
chainContinues()semantics already shipped for [Bug] dsh 会话反复 model/provider 切换时主对话迁移到 |sub:<fp> persona fork,宿主盖章的 compress/decompress/acp_status 仍解析在陈旧父 id —— ref 跨空间不可解析直至熔断 #2601 persona migration — same fingerprint, same discipline (content leaves only, churn keys dropped). Foreign content hashes differently; verified by the negative tests.Proof (tests/prefix-affinity-orphan.test.ts)
via === "new", freshpfa-*mint);startServer— plugin-identified chat turns, then a headerless cross-shaped replay => exactly oneidentity-orphanevent on the orphaned session naming thepfa-*fork, session state untouched, fresh mint still served normally.Config surface
No changes: no new config keys, env vars, or CLI flags — the detection is always-on diagnostics with a bounded conflict ring, consistent with the existing conflict-watch kinds.
Kernel boundary
No changes under
kernel/— the scan consumes the host-side resolver's own fingerprint infrastructure (src/prefix-affinity.ts), no kernel touch.The remaining unreachable layer (host fetch timing itself) needs the native-intercept module-level regression + e2e cross-protocol-switch phase noted in the issue; the detection added here is what makes any future instance VISIBLE instead of silent.