Skip to content

[PR] fix(conflict-watch): stop native compaction landings from lighting the conflict banner (#5767, #5786) - #6355

Open
ranxianglei wants to merge 4 commits into
masterfrom
2026-11-12_claude-native-compaction-attribution
Open

ranxianglei wants to merge 4 commits into
masterfrom
2026-11-12_claude-native-compaction-attribution

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Fixes #5767
Fixes #5786

Root-cause batch for the recurring "Compression conflict banner" false alarms (aggregation thread #6264). One PR, two commits — the two source issues are the same user-visible symptom (banner lit for the client's own compaction housekeeping) with two distinct mechanisms, fixed here as a checklist of one mechanism each.

Commit 1 — cherry-pick of PR #5787 (authorship preserved, -x)

fix(conflict-watch): stop recovered id-churn-adoption from lighting the conflict banner

#5786: #4131 added the id-churn-adoption ConflictKind (fold-reconcile re-mints and re-anchors ids across builds, 0 unmatched, NO compaction boundary) but only wired the recording side. Both display classifiers still treated it as an unexplained signal: the web banner severity (bili_conflictSeverity) dumped it into the residual signalN (banner lit even though the event is fully recovered by design — #3235 policy: recovered stays quiet), and formatConflictSection framed a pure id-churn-adoption ledger as "something OUTSIDE bili touched this conversation", pointing the user at a phantom second compressor. The commit carves id-churn-adoption out of signalN (it joins the neutral/recovered bucket) and gives formatConflictSection a dedicated churnAdoptOnly header + advice. Mixed ledgers still alarm on genuine unannounced-rewrite/orphan signals.

Commit 2 — the #5767 fix

fix(conflict-watch): attribute Claude Code native compaction on the anthropic lane

#5767: Claude Code's auto-compact (CLAUDE_CODE_AUTO_COMPACT_WINDOW) rewrites the client history in place — the shadowed region is replaced by ONE continuation user message opening with the verbatim sentence "This session is being continued from a previous conversation that ran out of context", and the next request replays [continuation summary, retained tail…] against the same session id. The anthropic lane's compaction-landing detection knew only the dsh checkpoint framing, so the landing fell through to detectUnannouncedHistoryRewrite and recorded "unannounced-rewrite" (signal tier) — the banner alarmed for the client's own auto-compact. The #5767 ledger shows the shape: 19–24 incoming messages, 5–9 carrying pre-turn refs, of 415–2312 known.

The anthropic lane now detects the CC continuation framing with the same three-gate discipline as the dsh detector (#2621/#4438): carrier (user/text), novelty (fresh id vs the pre-turn ref map), standalone (sentence opens the message). On a hit it records "native-compaction" (handled tier) and rebases the ACP state onto the compacted history — the same marker+rebase treatment as the dsh lane (#2432/#2658) and the codex lane (#2373). The framing check is lane-scoped (dsh profile or claude identity/client); the sentence is version-pinned like DSH_CHECKPOINT_PREAMBLE_PREFIX (#970) — if Claude Code rewords it, detection degrades to the pre-#5767 archive path, never a false positive.

Behavior changes (disclosed, old → new)

  1. Claude native-compaction landings, anthropic lane (Compression conflict banner (bili v0.1.208, node v26.8.2, darwin-arm64) #5767): old = "unannounced-rewrite" (signal tier) + applyCompactionArchive path → conflict banner lit. New = "native-compaction" (handled tier) + markNativeCompactionBoundary + reconcileNativeCompactionBoundary rebase → no banner, ACP state rebased onto the compacted history (the dsh/codex lanes already settle the identical shape this way). Why: the landing is the client's own announced auto-compact, not a foreign compressor.
  2. Recovered id-churn-adoption ledgers (Compression conflict banner (bili v0.1.212, node v24.19.0, win32-x64) #5786): old = web alarm banner + "/acp panel framed as an outside rewrite". New = quiet (banner hidden), framed as "bili itself re-minted and fully re-anchored the ids; no second compressor, nothing to act on". Still recorded in acp_status/stats.

Supersedes

Supersedes PR #5787 — its commit is cherry-picked here with authorship preserved (-x). #5787 remains open for the owner to close.

Tests

  • tests/issue5767-claude-native-compaction.test.ts (new, 8 tests): drift pin on the pinned sentence; carrier/novelty unit gates; e2e positive (claude session rebases, no unannounced-rewrite, replayed continuation does not re-trigger) + four e2e negatives (no framing / assistant quote / old id / non-claude lane)
  • cherry-picked PR's tests: tests/web-conflict-banner.test.ts, tests/conflict-lifecycle.test.ts
  • regression: dsh-lane compaction suites issue2432/2658/2709/4438 (31/31), conflict suite (73/73), verif-conflict-watch (4/4), typecheck clean

@ranxianglei ranxianglei changed the title fix(conflict-watch): stop native compaction landings from lighting the conflict banner (#5767, #5786) [PR] fix(conflict-watch): stop native compaction landings from lighting the conflict banner (#5767, #5786) Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-12_claude-native-compaction-attribution (67638d6)

Latest build — install this exact version

npm install -g billion-context@0.0.10767-pr.6355.3fdf415

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
67638d6 billion-context@0.0.10767-pr.6355.3fdf415 build
6fb8805 billion-context@0.0.10745-pr.6355.e9d089d build
ff5c196 billion-context@0.0.10143-pr.6355.b480b4b build
88b7dcb billion-context@0.0.9354-pr.6355.c00afed build
1222da6 billion-context@0.0.9351-pr.6355.0200653 build
f2be844 billion-context@0.0.9348-pr.6355.cfd7d27 build
d79be66 billion-context@0.0.9326-pr.6355.3088769 build
b537587 billion-context@0.0.9325-pr.6355.8c655a8 build
0d9231c billion-context@0.0.9276-pr.6355.5665df9 build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr6355.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

Duplicate check: not a duplicate — this is the fix PR for the root-cause batch (aggregation thread #6264), covering two source issues with one user-visible symptom (conflict banner lit for the client's own compaction housekeeping) and two distinct mechanisms (#5767 Claude Code native compaction attribution, #5786 recovered id-churn-adoption framing). It supersedes PR #5787 (cherry-picked with authorship preserved).

This is a [PR] thread — the work is already done upstream. I'm now pulling the branch, verifying the code, and checking CI status. Will report the full review conclusion shortly.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

PR #6355 review — code verified clean; branch state is broken (force-pushed backwards).

Code (both commits reviewed against current master):

  • Commit 1 e919a395ff (Compression conflict banner (bili v0.1.212, node v24.19.0, win32-x64) #5786) — id-churn-adoption (fold-reconcile re-minting ids, 0 unmatched, no compaction boundary) was only wired on the recording side; both display classifiers treated it as an unexplained signal. Fix: src/web/client.ts bili_conflictSeverity carves churnAdoptN out of signalN and adds it to neutralOnly; src/conflict-watch.ts formatConflictSection adds a churnAdoptOnly gate → dedicated neutral header ("bili itself re-minted message ids across builds and fully re-anchored them — no second compressor, no data loss"). Mixed ledgers keep the existing tier verbatim (gated to the pure case, same discipline as handledNativeOnly).
  • Commit 2 14b83cab15 (Compression conflict banner (bili v0.1.208, node v26.8.2, darwin-arm64) #5767) — Claude Code auto-compact rewrites client history in place (one continuation user message opening with the verbatim "This session is being continued from a previous conversation that ran out of context"). Old: anthropic lane only knew dsh checkpoint framing → fell through to detectUnannouncedHistoryRewrite → "unannounced-rewrite" (signal tier) → banner. Fix: new src/server/claude-compaction-guard.ts with carriesClaudeNativeCompactionSummary — three gates identical in structure to carriesDshLocalCompactionSummary (carrier role user+text, novelty via knownIds, standalone prefix match on the pinned sentence). src/server/prepare-anthropic.ts routes the claude lane through the native-compaction path (markNativeCompactionBoundary + reconcileNativeCompactionBoundary), so it gets the FULL rebase treatment identical to the dsh lane by construction, instead of the unannounced-rewrite signal.
  • Tests — tests/issue5767-claude-native-compaction.test.ts (8 tests: sentence drift-pin, carrier unit gate 11 assertions both directions, novelty unit gate both directions, e2e positive through a real server + 4 e2e negatives), tests/conflict-lifecycle.test.ts +2, tests/web-conflict-banner.test.ts +2. All assertive, both gate directions covered per the gate-test discipline.
  • Behavior changes (disclosed in PR): (1) claude native-compaction landings on the anthropic lane: old "unannounced-rewrite" (signal) + applyCompactionArchive → banner; new "native-compaction" (handled) + markNativeCompactionBoundary + reconcile rebase → no banner. (2) pure id-churn-adoption ledgers: old web alarm + "outside rewrite" framing; new quiet + correct framing (still visible in acp_status/stats).

CI / branch state (live-verified):

  • CI has NEVER run on the current head 14b83cab — zero check suites / check runs for that sha.
  • Timeline: PR opened 05:40Z; CI runs on the OLD head d79be666 all succeeded at 13:10:06Z; at 13:11:43Z the branch was force-pushed BACK to 14b83cab.
  • d79be666 (the green head) contained: a merge of origin/master (9674cfa = current master tip) plus docs(architecture): register src/server/claude-compaction-guard.ts in the file map. The current head 14b83cab is 43 commits behind master, conflicts in src/server/prepare-anthropic.ts (mergeable_state: dirty, verified via git merge-tree), and is missing the required architecture file-map registration (AGENTS.md Documentation Layout — a new src/ module must be registered in reference/architecture.md + the docs/architecture hub; the architecture-docs CI lane enforces it).
  • Master is green: per CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599, ci-fixes was ff'd to master tip 9674cfafb with all functional/test lanes green (11/11). So the branch red/conflict is branch-side, not inherited.

Verdict: the code is merge-ready in content (coherent, mirrors the dsh-lane discipline exactly, real tests), but the branch state is broken — the 13:11:43Z force-push reverted the branch from the green, master-merged d79be666 back to the stale 14b83cab. It needs to be re-synced to master (restore the d79be666 state, or re-merge master + re-add the architecture file-map registration) and CI re-run before it can merge.

八问(中文):

  1. 是什么问题:PR 代码本身没问题,但分支在 13:11:43Z 被 force-push 回退到旧状态(落后 master 43 个提交、有冲突),当前 head 从未跑过 CI。
  2. 什么原因导致的:分支从 d79be666(含 master 合并 + 架构文档登记、CI 全绿)被 force-push 回退到 14b83cab(旧的 2-commit 状态),丢失了 master 同步和架构文档登记。
  3. 影响范围与严重程度:仅影响本 PR 的可合并性;master 不受影响(全绿)。PR 当前不可合并(冲突 + 无 CI)。
  4. 怎么修复的:需把分支重新同步到 master——恢复 d79be666 状态(已含 master 合并 + 架构文档登记且全绿),或重新 merge master + 补架构文档登记,然后让 CI 重跑。
  5. 是否有回归问题:无——代码本身是干净的修复,严格镜像 dsh-lane 纪律;分支状态问题是流程问题,不是代码问题。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

判定:代码内容可合并,但分支需先重新同步到 master 才能合并。

@ranxianglei
ranxianglei force-pushed the 2026-11-12_claude-native-compaction-attribution branch 2 times, most recently from 1222da6 to 88b7dcb Compare November 12, 2026 15:33
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Merge conflict resolved + red architecture-docs lane fixed — PR is now mergeable (state moved dirty → blocked, i.e. awaiting required human review, not a conflict).

What I did this run (CI engineer lane, attempt 1/3):

  1. Rebased the PR branch onto live master. 2026-11-12_claude-native-compaction-attribution was based on an old master (33104b1f95); master had advanced ~70 commits. Rebased the 2 PR commits onto the current master tip (259cd87674). None of the intervening master commits touched any file this PR modifies, so the rebase was clean apart from one import collision.

  2. Resolved the single conflict in src/server/prepare-anthropic.ts — a pure import-section collision: master added import { getStore } from "../persist.js" (durability-before-render, Compression fails in long sessions while new sessions work fine | 压缩失败.新会话反而没事 #3397) and the PR added import { carriesClaudeNativeCompactionSummary } from "./claude-compaction-guard.js" (Compression conflict banner (bili v0.1.208, node v26.8.2, darwin-arm64) #5767). Both symbols are used in the file, so I kept both lines. No semantic change to either side's logic.

  3. Fixed the red architecture-docs CI lane (the blocker from the earlier "CI 失败(architecture-docs)" pickup). The PR adds src/server/claude-compaction-guard.ts but never listed it in reference/architecture.md, so the lane failed with missing: src/server/claude-compaction-guard.ts. Added the map entry next to its sibling dsh-compaction-guard.ts (doc-only, matching the sibling's style). node tools/check-architecture-docs.mjs → all green.

  4. Verified: local tsc --noEmit exit 0; the CI gate suite on the pushed sha 88b7dcb641 is green (24 checks: 0 failed, 0 pending — build-artifact + all static gates pass, e2e lanes skipped as gated).

Final branch: 88b7dcb641 (3 commits: 2 PR commits + 1 architecture-docs entry), linear on current master, working tree clean.


结构化八问(中文)

  1. 是什么问题:PR 分支与 master 产生合并冲突(merge state dirty),且 architecture-docs CI 车道红(PR 新增的 src 文件漏登进架构地图)。
  2. 什么原因导致的:① 冲突——PR 基于旧 master,期间 master 前进了 ~70 个提交,src/server/prepare-anthropic.ts 的 import 区被两边各自新增(master 加 getStore、PR 加 claude-compaction-guard 导入)撞在一起;② 红 CI——PR 新增 src/server/claude-compaction-guard.ts 但漏登 reference/architecture.md,该车道强制要求 src/ 全量覆盖、无幽灵条目。
  3. 影响范围与严重程度:仅本 PR 的合并与 CI 门禁,不影响任何已发布行为。冲突不解决则 PR 无法合并;architecture-docs 红则 CI 不过。属「合并被卡」级,非功能/数据缺陷。
  4. 怎么修复的:rebase 到最新 master;import 冲突两边都保留(两个导入都在用,无语义改动);补登架构地图条目(纯文档,与兄弟条目 dsh-compaction-guard.ts 同风格、同位置)。
  5. 是否有回归问题:无。rebase 无语义改动(仅 import 合并,两侧逻辑原样保留),新 master 提交未触碰本 PR 任何文件;本地 typecheck 与 CI gate 套件(含 typecheck/build/architecture-docs/kernel-guard)在推送 sha 上均绿。
  6. 是否破坏缓存:不涉及(未触碰缓存/重试/增量游标/去重键逻辑)。
  7. 是否改了设计方向:不涉及(无架构/边界/数据流变更,纯合并 + 文档补登)。
  8. 是否引入了新的配置:不涉及(无新 env/config/默认值)。

判定:冲突已解、红项已修,PR 处于可合并状态(blocked = 等人工 review,非冲突),收工。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

Status update — the branch has since been fixed; my earlier "branch is broken" claim is now stale.

While I was reviewing, the branch was re-synced to master (rebased, not merge — cleaner linear history). Live-verified current state:

Net verdict: the code is correct and the branch is now properly synced to master and mergeable. Once the last 6 CI lanes land green, this is ready for human merge. No further action needed from me on the branch.

八问(更新):

  1. 是什么问题:(前一条已述)PR 代码本身正确;此前分支被 force-push 回退到落后 master 的旧状态导致冲突 + 无 CI。
  2. 什么原因导致的:分支同步流程一度把分支退回旧 head;现已通过 rebase 到当前 master tip 修复。
  3. 影响范围与严重程度:仅本 PR 可合并性;master 不受影响。现已解除(mergeable=true)。
  4. 怎么修复的:rebase 两个 fix commit 到当前 master tip 259cd87674,并补上 reference/architecture.md 文件地图登记(architecture-docs guard 要求)。
  5. 是否有回归问题:无——代码是干净的修复,严格镜像 dsh-lane 纪律;冲突解决只保留了双方 import(carriesClaudeNativeCompactionSummary + getStore),未改变任何语义。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

判定:代码正确、分支已同步到 master 且可合并;等最后 6 条 CI 车道全绿后即可由人工合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Merge conflict resolved — PR is back to mergeable (state dirty → blocked, i.e. awaiting required human review, not a conflict).

What I did this run (CI engineer lane, attempt 1/6):

  1. Rebased the PR branch onto live master. 2026-11-12_claude-native-compaction-attribution was based on master 259cd87674 (Nov 12); master had advanced 272 commits to e7a42babec. Rebased the 3 PR commits onto the new tip.

  2. Resolved the single conflict in src/server/prepare-anthropic.ts. It was a semantic collision in the native-compaction area: master's new commit 1559254ff7 (Compression nudges reference a different ledger than compress tool #6061, generation-boundary) added a head-of-lane reconcileNativeCompactionBoundary(session) call (honouring a boundary armed on an earlier request by the stale-ref-ledger detector) and kept the old dshRebased naming; my PR (Compression conflict banner (bili v0.1.208, node v26.8.2, darwin-arm64) #5767) had generalized that same block to a dsh+claude lane with nativeRebased naming. The two changes are orthogonal — one adds a head-of-lane rebase, the other extends the framing-based detection to claude — so I kept both: the #6061 head-of-lane block (new master's feature, preserved verbatim) plus my PR's #5767 claude-lane block, using my PR's nativeRebased variable (consistent with the rest of the block, which auto-merged to my version). Also corrected the #6061 comment's "the dsh branch below" → "the dsh/claude branch below" since my PR makes that branch fire on both signatures (comment-accuracy fix, no behavior change).

  3. Verified locally: tsc --noEmit exit 0; node tools/check-architecture-docs.mjs all green (my claude-compaction-guard.ts map entry survived the rebase alongside master's new rejection-diagnostics.ts entry); targeted suites green — issue5767-claude-native-compaction + generation-boundary (20/20) and conflict-lifecycle (6/6).

  4. Pushed with --force-with-lease (authorized for this conflict-rebase; remote head was still the pre-rebase 88b7dcb641, no concurrent agent). New head: ff5c1961ab, linear on master.

CI status (honest): the mirror cache is stale in this run (frozen at 09:17:09, no gh CLI available to cross-check), so I could not confirm the final verdict. Last cached snapshot on ff5c1961ab: 0 failed, 13 pending — build-artifact, version-guard, docs-sync and 5 gate shards already green; architecture-docs / kernel-guard / test shards still queued. The two gates this PR actually touches (architecture-docs, typecheck) are verified green locally, and the PR touches no kernel/ path, so kernel-guard is expected to pass. If any shard goes red it will surface on the next trigger.


结构化八问(中文)

  1. 是什么问题:PR 分支与 master 再次产生合并冲突(dirty)——master 在 PR 基线之后前进了 272 个提交,其中 1559254ff7(Compression nudges reference a different ledger than compress tool #6061 generation-boundary)改到了本 PR 同一段 native-compaction 代码。
  2. 什么原因导致的:两边各自改了 src/server/prepare-anthropic.ts 的 native-compaction 区——master 的 Compression nudges reference a different ledger than compress tool #6061 在车道头部新增了一个「上一请求已武装的边界」rebase 调用并沿用旧变量名 dshRebased;本 PR 的 Compression conflict banner (bili v0.1.208, node v26.8.2, darwin-arm64) #5767 把同一段泛化成 dsh+claude 车道并改名 nativeRebased。两处改动正交(一个加头部调用、一个扩检测面),但落在同一段文本上,rebase 时撞出冲突。
  3. 影响范围与严重程度:仅本 PR 的合并与 CI 门禁,不影响已发布行为。冲突不解决则 PR 无法合并。属「合并被卡」级,非功能/数据缺陷。
  4. 怎么修复的:rebase 到最新 master;冲突按「并集意图」解——保留 master 的 Compression nudges reference a different ledger than compress tool #6061 头部 rebase 块(新功能,逐字保留)+ 保留本 PR 的 Compression conflict banner (bili v0.1.208, node v26.8.2, darwin-arm64) #5767 claude 车道块,统一用 nativeRebased 变量名(与已自动合并到本 PR 版本的其余部分一致);顺手把 Compression nudges reference a different ledger than compress tool #6061 注释里过时的「the dsh branch」改为「the dsh/claude branch」(纯注释,无行为变更)。
  5. 是否有回归问题:无。Compression nudges reference a different ledger than compress tool #6061 块逐字保留(master 行为不变);本 PR 的 claude 车道逻辑原样保留;reconcileNativeCompactionBoundary 在头部块与检测块各调一次的模式与 master 原设计一致(非新引入的双重 rebase)。本地 typecheck 0 退出、architecture-docs 全绿、定向套件(Compression conflict banner (bili v0.1.208, node v26.8.2, darwin-arm64) #5767 + generation-boundary 20/20、conflict-lifecycle 6/6)全过。
  6. 是否破坏缓存:不涉及(未触碰缓存/重试/增量游标/去重键逻辑;rebase 不改变任何运行时行为)。
  7. 是否改了设计方向:不涉及(无架构/边界/数据流变更,纯合并 + 一处注释措辞修正)。
  8. 是否引入了新的配置:不涉及(无新 env/config/默认值)。

判定:冲突已解、PR 回到可合并状态(blocked = 等人工 review,非冲突);CI 在本 run 因镜像缓存陈旧未能确认最终绿,但本 PR 实际触碰的两个门禁(architecture-docs、typecheck)已本地验证绿、且未触碰 kernel/,预期全绿;若有 shard 红会在下次触发暴露。收工。

ci-check added 3 commits November 18, 2026 12:48
…he conflict banner

#4131 added the `id-churn-adoption` ConflictKind (fold-reconcile re-mints and
re-anchors ids across builds, 0 unmatched, NO compaction boundary) but only
wired the recording side. Both display classifiers still treated it as an
unexplained signal:

- web banner severity (bili_conflictSeverity) dumped it into the residual
  signalN, so a pure id-churn-adoption ledger read landed=true and lit the
  alarm banner even though the event is fully recovered by design (#3235
  policy: recovered stays quiet).
- formatConflictSection framed a pure id-churn-adoption ledger as "something
  OUTSIDE bili touched this conversation" + "[suspected] confirm each named
  plugin", pointing the user at a phantom second compressor.

Carve id-churn-adoption out of signalN (it joins the neutral/recovered
bucket) and give formatConflictSection a dedicated churnAdoptOnly header +
advice ("bili itself re-minted and fully re-anchored the ids; no second
compressor, nothing to act on"). Mixed ledgers still alarm on genuine
unannounced-rewrite/orphan signals.

Behavior change (old -> new): a session whose only conflict evidence is a
recovered id-churn-adoption event PREVIOUSLY showed the web alarm banner and
the /acp panel framed it as an outside rewrite; NOW it stays quiet (banner
hidden) and is framed correctly. Still recorded in acp_status/stats.

Scope: this PR is deliberately limited to the id-churn-adoption variant of
the recurring "Compression conflict banner" symptom. The unannounced-rewrite
variant (dsh/claude native-compaction landings) is a different mechanism and
still alarms by design pending separate attribution work -- untouched here.

Closes #5786

(cherry picked from commit 4a96bad)
(cherry picked from commit 3c7adee)
…nthropic lane

rewrites the client history in place; the next request replays
[continuation summary, retained tail...] against the same session id.
The anthropic lane's compaction-landing detection knew only the dsh
checkpoint framing, so the landing fell through to
detectUnannouncedHistoryRewrite and recorded "unannounced-rewrite"
(signal tier), lighting the conflict banner for the client's own
auto-compact.

The anthropic lane now detects the CC continuation framing with the
same three-gate discipline as the dsh detector (#2621/#4438): carrier
(user/text), novelty (fresh id vs the pre-turn ref map), standalone
(sentence opens the message). On a hit it records
"native-compaction" (handled tier) and rebases the ACP state onto
the compacted history - the same marker+rebase treatment as the dsh
lane (#2432/#2658) and the codex lane (#2373). The framing check is
lane-scoped (dsh profile or claude identity/client); the sentence is
version-pinned like DSH_CHECKPOINT_PREAMBLE_PREFIX (#970) - if Claude
Code rewords it, detection degrades to the pre-#5767 archive path,
never a false positive.

Tests: drift pin on the pinned sentence; carrier/novelty unit gates;
e2e positive (claude session rebases, no unannounced-rewrite, replay
does not re-trigger) + four e2e negatives (no framing / assistant
quote / old id / non-claude lane).

Fixes #5767

(cherry picked from commit 0d9231c)
…5767)

The PR added src/server/claude-compaction-guard.ts but the architecture map
(reference/architecture.md) did not list it, so the architecture-docs CI lane
failed with 'missing: src/server/claude-compaction-guard.ts'. Add the entry
next to its sibling dsh-compaction-guard.ts.
@ranxianglei
ranxianglei force-pushed the 2026-11-12_claude-native-compaction-attribution branch from ff5c196 to 6fb8805 Compare November 18, 2026 05:09
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Rebased PR #6355 onto current master and resolved the merge conflict.

What happened

  • The PR branch 2026-11-12_claude-native-compaction-attribution was cut from master at e7a42babec; master moved 227 commits ahead, so the merge state was dirty.
  • Rebased the 3 PR commits onto origin/master (4b77eab409). One conflict, in the import block of src/server/prepare-anthropic.ts:
    • master side had grown the loop/cache-control.js import (countAnthropicSystemCacheControls, countAnthropicToolsCacheControls, pinClientMessageMarks);
    • PR side had added conflictClientOf to the conflict-watch.js import.
    • Resolved as the union of both import lists — verified every symbol exists on master and is used in the file.
  • Post-rebase diff vs master is shape-identical to the original PR (8 files, +545/−22) — the rebase itself introduces no semantic change.

Verification on the rebased head (local, targeted)

  • npm run typecheck: clean.
  • PR-touched tests: tests/conflict-lifecycle.test.ts, tests/issue5767-claude-native-compaction.test.ts, tests/web-conflict-banner.test.ts — 45/45 pass.
  • Adjacent family: tests/conflict-remediation.test.ts, tests/issue2709-dsh-native-compaction-attribution.test.ts, tests/issue2432-dsh-local-compaction.test.ts, tests/issue2658-dsh-anthropic-google-compaction.test.ts, tests/verif-conflict-watch.test.ts, tests/issue5432-trailing-system-tails.test.ts, tests/issue5604-anthropic-egress-user-tail.test.ts — 57/57 pass.
  • Full-suite verdict left to CI on the pushed head (this push is the final head, no [ework:ci-held] marker).

Push

  • Re-fetched the remote head before pushing (no concurrent work — still ff5c1961ab), force-pushed with --force-with-lease: ff5c1961ab → 6fb8805ef9.
  • Verified live afterwards: mergeable: true, mergeable_state: blocked (branch protection / pending CI+review — not a conflict), head sha 6fb8805ef9; CI running (22 checks queued at last refresh).

七问:

  1. 是什么问题:PR 分支落后 master 227 个提交,src/server/prepare-anthropic.ts 的 import 块与 master 新增的 cache-control 导入冲突,merge state 为 dirty,PR 无法合并。
  2. 什么原因导致的:PR 基于旧 master(e7a42ba)切出,其后 master 合入了触碰同一 import 行的多个 PR(cache-control 新增导出)。属于长期分支漂移,不是代码缺陷。
  3. 影响范围与严重程度:仅本 PR 被阻塞,无用户侧影响;修复前 PR 不可合并,修复后可合并。
  4. 怎么修复的:把 PR 的 3 个提交 rebase 到最新 master;唯一冲突按两侧 import 取并集处理(保留 master 的 3 个 cache-control 新导出 + PR 新增的 conflictClientOf),并逐一确认符号存在且被使用,无语义变更。
  5. 是否有回归问题:无。rebase 后对 master 的 diff 与原 PR 逐文件一致(8 文件,+545/−22);typecheck 干净;定向测试 102 个全过(PR 触碰的 3 个测试文件 + conflict-watch/anthropic 车道家族 7 个)。全量结论以新 head 的 CI 为准。
  6. 是否破坏缓存:不涉及。本轮只做 rebase + import 并集,未触碰缓存/重试/游标/去重键逻辑。
  7. 是否改了设计方向 / 是否引入了新的配置:不涉及。无架构变更,无新增配置项。

结论:冲突已解决并推送,CI 正在新 head(6fb8805)上跑,等 CI 绿 + 人工合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

The red test (windows-latest, 22, 4) is an inherited master failure, not a defect in this PR — fixed by merging current master into the branch.

Diagnosis

Fix

七问:

  1. 是什么问题:test (windows-latest, 22, 4) 分片失败,唯一挂的是 tests/server-process-listeners.test.ts(CI flake:test (windows-latest, 24) 单文件文件级失败:子测试零执行、异常被吞为 'test failed' #3029)——文件级 exit 1、零 TAP 子测试,隔离复现 + 全量重试同形,CI 判定真失败。
  2. 什么原因导致的:继承性失败。该测试第 4 例(894835a,[PR] fix: release process handlers when an embedded server closes #7026 review 引入)假设 POSIX 信号语义,process.kill(self, SIGINT) 在 Windows 上直接终止进程而不走 handler,win32 CI 子进程在第一行 kill 就死。master 已在 3186e54ad2 修复(win32 直接调用已注册的 handler),合入 master 的时间(14:08 +0800)晚于本分支 rebase base(12:27 +0800)——本 PR 的 diff 完全不碰该文件与进程监听路径。
  3. 影响范围与严重程度:仅阻塞本 PR 的 Windows 分片;无用户侧影响。master 侧该修复已就位,任何 base 早于 548e396022 的分支都会继承此红(同 [PR] fix(dsh): replace the fail-closed preset gate with a post-load reconcile (#7111) #7117)。
  4. 怎么修复的:merge origin/master(548e396022)进 PR 分支,干净合入无冲突;不自行改测试(修复必须收敛在 master/ci-fixes,不在 PR 分支重复修)。
  5. 是否有回归问题:无。merge 后对 master 的 diff 与原 PR 逐文件一致(8 文件,+545/−22);typecheck 干净;PR 触碰的 45 个测试 + server-process-listeners 4 个全过。master 带入的 [PR] fix(lanes): demote the wire clients' auxiliary calls to the side lane (discussions/6884) #7083(wire-client-sidecars)变更本身已在 master CI 验证过。
  6. 是否破坏缓存:不涉及。未触碰缓存/重试/游标/去重键逻辑。
  7. 是否改了设计方向 / 是否引入了新的配置:不涉及。无架构变更,无新增配置项。

结论:继承红已消除,新 head 67638d6d55 的 CI 重跑中,等 Windows 分片复绿。

@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: vllm-qwen/qwen3.8-27b)

Review verdict: APPROVE (posted as a comment — GitHub blocks a formal self-approve on the author's own PR; this is the review record for the human merge).

Reviewed end-to-end: PR body, linked issues (#5767, #5786), full diff, and cherry-pick provenance.

Correctness

Tests — all run locally on the PR head, green:

  • tests/issue5767-claude-native-compaction.test.ts: 8/8 (drift pin, carrier/novelty unit gates, e2e positive + 4 negatives: no framing / assistant quote / old id / non-claude lane)
  • tests/web-conflict-banner.test.ts + tests/conflict-lifecycle.test.ts: 37/37 (pure id-churn stays quiet; mixed ledgers still alarm)
  • Regression: dsh compaction suites (issue2432/2658/2709/4438) + verif-conflict-watch: 35/35
  • typecheck clean, build OK, tools/check-architecture-docs.mjs green (new module in the map)

Regression / behavior — no kernel/ changes, no config surface, no wire/persistence changes. Both behavior changes are disclosed in the PR body (old→new): (1) claude native-compaction landings on the anthropic lane: unannounced-rewrite (signal, banner) → native-compaction (handled, rebased, quiet); (2) pure id-churn-adoption ledgers: banner lit → quiet, framed as bili's own recovery. The rebase path is the established dsh/codex machinery, not new. The version-pinned sentence degrades to a miss (never a false positive) if Claude Code rewords it; the drift-pin test makes that visible in CI.

One note for the record: the new formatConflictSection header/advice strings and the new recordConflict detail are model-visible via the acp_status tool. They are a correction on that established surface (they stop the model from being sent on a phantom-second-compressor errand, consistent with the #2709/#2912 policy) and introduce no new numbers/refs/positions for the model to propagate. The PR body discloses the behavior change.

#5787 is superseded and can be closed by the owner after merge.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

Review complete — verdict APPROVE. (Full review posted on the PR as a comment — GitHub blocks a formal self-approve on the author's own PR, so the verdict is a comment for the human merge.)

结构化八问 (PR review 结论)

  1. 是什么问题: 同一个「Compression conflict banner 误报」症状、两个机制——(a) Compression conflict banner (bili v0.1.208, node v26.8.2, darwin-arm64) #5767: Claude Code 自身 auto-compact 在 anthropic 车道落地被记成 unannounced-rewrite(signal 档)点亮告警横幅,把用户指向一个并不存在的第二压缩器;(b) Compression conflict banner (bili v0.1.212, node v24.19.0, win32-x64) #5786: 已完全恢复的跨构建 id 重铸(id-churn-adoption, [Bug][opencode lane] Cross-version restart replays the whole session: old v0.1.197 and new v0.1.202 write the same sessions dir, 212 folded refs re-anchor onto churned bytes and the ref map is pruned to 392 raw ids #4131)被算进横幅残留 signal 计数,并被框成「bili 之外的东西动了这段对话」。
  2. 什么原因导致的: (a) anthropic 车道的压缩落地检测只认 dsh checkpoint 框架,Claude 的续写框架不认识,落地落进了通用 rewrite 检测器 → unannounced-rewrite;(b) [Bug][opencode lane] Cross-version restart replays the whole session: old v0.1.197 and new v0.1.202 write the same sessions dir, 212 folded refs re-anchor onto churned bytes and the ref map is pruned to 392 raw ids #4131 只接了 id-churn-adoption 的记录侧,两个展示分类器(web 横幅严重度 + formatConflictSection)仍把它当未解释信号。
  3. 影响范围与严重程度: 仅误报、无数据丢失。(a) 任何在 anthropic 车道持有活跃折叠块时 auto-compact 的 Claude Code 会话 → 假告警 + acp_status 误框;(b) 唯一冲突证据是已恢复 id-churn 的会话 → 假告警 + 误框。均 p2(能用但有明显噪音/误导)。
  4. 怎么修复的: (a) 新增 src/server/claude-compaction-guard.ts,三闸检测(carrier user/text、novelty 对 pre-turn ref map、standalone 句首),与 dsh 检测器同纪律([Bug] dsh 原生压缩检测误报:历史里引用过 <compacted-summary> 即判为宿主压缩落地并 rebase ACP 状态(0.1.190) #2621/[Bug][dsh] 0.1.204: auto-review side request collides with the main session → false native-compaction rebase → aux usage skips #453 clamp → permanent upstream 400 #4438);命中记 native-compaction(handled 档)并走既有 markNativeCompactionBoundary+reconcileNativeCompactionBoundary 重基——与 dsh/codex 车道同处理([bug] DSH 桌面端 0.1.188:宿主原生压缩落地摧毁折叠基底 → 同一区间永久不可锚定、compress 连片失败并熔断(compaction-basic auto:false 仍无效) #2432/fix: rebase fold substrate on Codex local auto-compaction (#2372) #2373),车道限定(dsh profile 或 claude identity/client)。(b) 把 id-churn-adoption 从横幅 signalN 剥出(并入 neutral/recovered 桶),给 formatConflictSection 专门的 churnAdoptOnly 头 + 建议;纯例门控,混合台账原档逐字不变。
  5. 是否有回归问题: 无。无 kernel/ 改动、无 config 面、无 wire/persistence 改动;两处行为变更已在 PR 正文披露(旧→新)。重基路径是既有 dsh/codex 机器,非新造。混合台账(含真 rewrite/orphan 信号)仍按原档告警。版本钉死的续写句若被 Claude Code 改写,检测退化为 miss(绝不假阳),drift-pin 测试让该漂移在 CI 可见。定向 + 回归套件本地全绿(8 新 + 37 banner/lifecycle + 35 dsh/verif);全量以 CI 为准。
  6. 是否破坏缓存: 无。重基(resetSessionCompression)在真实压缩落地时有意重置前缀缓存基线——这是既有 dsh/codex 行为,非新失效;其余缓存/重试/增量游标/去重键策略未动。
  7. 是否改了设计方向: 否。把既有 marker+rebase 机器扩到 claude 车道,并把展示分类器校正到 (bug)压缩冲突 #3235/网页警告问题 #2912 策略(已恢复保持安静);无架构/边界/数据流转向。
  8. 是否引入了新的配置: 无。无新 env/config/CLI flag;检测器常开(车道门控),与 dsh 检测器一致。

Coordination: PR #6355 reviewed end-to-end — APPROVE, review posted (comment 6972861211); targeted + regression suites green locally, full-suite verdict on CI. #5787 is superseded (owner may close after merge). Ready for human merge.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compression conflict banner (bili v0.1.212, node v24.19.0, win32-x64) Compression conflict banner (bili v0.1.208, node v26.8.2, darwin-arm64)

1 participant