Skip to content

[PR] cache-seam: attribute prefix breaks caused by a tools-array change (#5466) - #5476

Open
ranxianglei wants to merge 10 commits into
masterfrom
2026-11-01_cache-seam-tools-attribution
Open

ranxianglei wants to merge 10 commits into
masterfrom
2026-11-01_cache-seam-tools-attribution

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

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

Problem

The cache-seam monitor attributes a provider prefix break by fingerprinting only the message list. But on the Anthropic wire the prompt prefix is system + tools + messages, so a mid-session change to the request's tools array invalidates the cached span without touching any message. The monitor then reported the first incidental message-level divergence — blaming the client (#3023) or an unexplained seam — while the real cause sat hidden behind the wrong attribution. This is exactly what masked the root cause in #5459 (pi-native first round missing bili's tools): the seam line pointed at message[1] while the true break was the tools array gaining 6 entries.

Fix

  • New exported toolsArrayFps() helper captures a per-entry tool fingerprint (name + canonical-json hash, order-sensitive) from the fully-parsed request body at both send chokepoints (src/server/relay.ts, src/loop/core.ts), mirroring how generationParamFp already rides the full parse.
  • detectSeam gains a dedicated arm that runs ahead of the message-shape arms (tools precede messages in the prefix, so it's the earliest break). When the prev/cur tool tables differ it books the residual into a new prov:"tools" bucket and names which entries appeared/disappeared/were redefined/reordered.
  • Fail-soft discipline matches the message ladder: stable tools (identical fingerprints) skip the arm entirely; a missing capture on either side, or no tools array, falls through to the legacy arms unchanged.
  • Surfaces in /acp-cache text and the web report as a distinct "TOOLS-ARRAY CHANGE" section (report.seam.tools).

Behavior change (diagnostic only)

Misses induced by a mid-session tools-array change were previously mis-booked as prov:"client" / seam-suspect / provider-side; they now book into the new prov:"tools" bucket. No change to closure math, compression, billing, or actual caching behavior — detectSeam is purely diagnostic. Frequency is low (only when the tool set changes mid-session: late plugin registration, dynamic tool enable/disable).

Tests

New tests/cache-seam-tools-change.test.ts (7 cases): the fix, the #5459 shape (tools gained + turn appended → still attributed to tools, not provider-side/client), plus no-regression guards (stable tools keep client/seam attribution) and fail-soft boundaries (no tools / one-sided capture). Re-ran the existing seam suites (cache-seam-detector, client-insert, orphan-sweep, nobaseline, capped-body, suspect-vs-client, context-view, cache-ledger, capture-pairing) — all green. Typecheck + build green on the rebased head.

Closes #5466

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-01_cache-seam-tools-attribution (90db1de)

Latest build — install this exact version

npm install -g billion-context@0.0.10979-pr.5476.1cd17a2

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
90db1de billion-context@0.0.10979-pr.5476.1cd17a2 build
ddc2ca6 billion-context@0.0.10893-pr.5476.e242e6e build
fee9e9b billion-context@0.0.10642-pr.5476.a0584fa build
44bf3d2 billion-context@0.0.10505-pr.5476.08ed5d7 build
b6d19f1 billion-context@0.0.10503-pr.5476.79cba75 build
b43b71e billion-context@0.0.10265-pr.5476.1377bd1 build
c157dd6 billion-context@0.0.8936-pr.5476.df5c1f5 build
2288220 billion-context@0.0.8932-pr.5476.0565540 build
6e22c7b billion-context@0.0.7769-pr.5476.7462c64 build
f2cd5f7 billion-context@0.0.7760-pr.5476.c2c80d5 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title cache-seam: attribute prefix breaks caused by a tools-array change (#5466) [PR] cache-seam: attribute prefix breaks caused by a tools-array change (#5466) Nov 1, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复。 本 PR 是 #5466(诊断归属缺口)的修复 PR,与 #5459(根因发现源)、#3023(client 归属臂)相关但机制不同:#5466 修的是 seam 指纹只看 messages、看不见 tools 数组变更这一盲区,现有 issue/PR 均未覆盖该修复本身。

标签: bug / pi / scope/ui / p3 —— 缺陷类(诊断误归属);触发案例来自 pi-native(#5459),但机制跨车道;改动面是 /acp-cache 监控/报告面;纯诊断信号修正,无可用性影响。

审核进行中。先行报告一个已确认的事实:head d86c3f7 的 CI unused-exports 门禁红了——src/cache-ledger.ts 新导出的 ToolEntry 类型在文件外无引用,本地复现一致。这是几行级小修(去掉 export 前缀即可,门禁的 INTERNAL_ONLY 处置),我直接在 PR 分支上补 commit 修掉,不另开 issue。完整八问结论随后给出。

@ranxianglei ranxianglei added bug Something isn't working p3 pi scope/ui labels Nov 1, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Review 结论:APPROVE(建议合入)。 核心修复正确、测试有牙、无回归、无 kernel 改动,CI 绿。同一账号无法对本人 PR 走 GitHub 正式 approve(API 返回 422「不能 approve 自己的 PR」),正式 approve / merge 由 owner 执行;本条是专职 reviewer 的完整审核结论。审完发现一处非阻塞小缺口(web 报告没接新桶),已在 PR 分支顺手修掉。

结构化八问

  1. 是什么问题:cache-seam 监控只按消息列表指纹归因 provider 前缀断裂;Anthropic 线上前缀是 system + tools + messages,会话中途改 tools 数组会在不碰任何消息时让缓存缝断在工具边界,监控却把它误记到第一个顺带的消息级分叉(client [Enhancement][cache-ledger] attribute client-side mid-history insertions to a client bucket — seam forensics currently blame bili for host churn (found in #2997) #3023 或未知 seam)——正是 pi native: bili's tools join the request only from the 2nd request, so each pi session re-writes ~20k cache tokens once #5459 里根因被掩盖的方式。
  2. 什么原因导致:detectSeam 的指纹只看 messages,缺了 tools 这一维(prefix 里工具表先于消息)。
  3. 影响范围与严重程度:仅诊断/报告面(/acp-cache 文本 + web),无可用性影响;触发低频(会话中途变工具集:插件晚注册 / 动态开关);纯误归属,p3。
  4. 怎么修复的:两个发送咽喉点(src/server/relay.ts、src/loop/core.ts)对完整解析体补采 per-entry 工具指纹(toolsArrayFps,镜像既有 generationParamFp);detectSeam 加一条先于消息臂运行的 tools 臂,prev/cur 工具表不同就把残差计入新 prov:"tools" 桶并点名 appeared/disappeared/redefined/reordered;稳定 / 缺失 / 无 tools 全部 fail-soft 落回旧臂。
  5. 是否有回归问题:无。审过既有行为——稳定 tools 保持 client/seam 归属(负例钉住)、无 tools / 单边捕获落回旧桶、closure math / 压缩 / 计费 / 实际缓存零改动(detectSeam 纯诊断);高危模式逐项过(无语义漂移、无吞错、阈值/时序/输出格式不变)。
  6. 是否破坏缓存:不涉及(只读账本做归因,不改任何缓存/重试/去重策略)。
  7. 是否改了设计方向:不变(仍是账本诊断归属面,新增一个桶)。
  8. 是否引入新配置:无(无新 env/config/默认值)。

已顺手修(非阻塞,已在 PR 分支修掉)

已顺手修:web 报告硬编码 miss 归因桶,新增 prov:"tools" 后未接线——uRest 残差没减 seam.tools.missed(工具断裂会虚高进「未解释」)、且无 TOOLS chip/图例,与 PR 正文 “Surfaces in the web report” 不符 + commit f2cd5f7
把该桶接进 detailSeam 归一化 / active 判定 / 图例 / chip / 残差计算,并在双语 i18n 加 det.attr_tools / det.attr_tools_tip / det.leg_tools(色 #0e7490)。typecheck 干净,web-i18n(#1024 parity/dead-key)+ cache-seam-tools-change 共 17/17 绿。纯展示层修正,不动计费/缓存/压缩。

收工

本 review lane 完成:核心修复 + 一处非阻塞 web 展示缺口已在 PR 分支收敛(head 现为 f2cd5f7),typecheck 干净、定向 17/17 绿,全量回归交远程 CI。等 owner 正式 approve / merge。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

审核结论:代码侧 ready,唯一阻塞是继承自 master 的红(存储 golden 族,已报到 #4599)。 这是 agent 提交的 PR,我没有重做,而是拉分支核码 + 修掉一处真缺陷 + 把分支同步到最新 master/ci-fixes。

结构化八问

  1. 是什么问题:cache-seam 监控只比对消息列表来归因前缀缓存断点;而 Anthropic 线上前缀是 system + tools + messages,会话中途 tools 数组一变(插件晚注册、动态开关工具),缓存就断了,但消息一条没动——监控只能把账记到最近的消息级分叉上(误报「客户端中段改写」或不明 seam)。pi native: bili's tools join the request only from the 2nd request, so each pi session re-writes ~20k cache tokens once #5459 的真实根因(pi-native 首轮丢了 bili 的 tools)就是这样被掩盖、seam 行一直指着 message[1] 的。
  2. 什么原因导致的:detectSeam 的指纹维度缺了 tools 这一维——它按「消息列表」建指纹,而线上前缀里 tools 排在消息之前,是更早的断裂点;tools 变化产生的重计费残差被就近归给了错误的桶。
  3. 影响范围与严重程度:纯诊断归因面——计费、压缩、缓存行为零影响。触发条件窄(仅会话中途工具集变化),低频;后果是 forensics 误导(把宿主自担的重计费错记成客户端改写/未解释缝),属 p3 级诊断缺陷。
  4. 怎么修复的:在两个发送咽喉(relay.ts / loop/core.ts)对完整解析体抓 per-entry 工具指纹(name + canonical-json hash,顺序敏感),走与 generationParamFp 相同的捕获继承规则;detectSeam 新增专用臂,放在消息形状各臂之前跑(tools 在前缀里更靠前),prev/cur 工具表不同即记入新 prov:"tools" 桶并点名新增/移除/重定义/重排的条目。fail-soft 纪律与消息 ladder 一致:工具表稳定则整臂跳过,任一侧无捕获或无 tools 数组则原样落回旧臂。
  5. 是否有回归问题:审过——closure math/压缩/计费路径未触碰(detectSeam 纯诊断);105 个定向 seam 用例全绿(cache-seam-detector/client-insert/orphan-sweep/nobaseline/capped-body/suspect-vs-client/context-view/cache-ledger/capture-pairing + 本 PR 7 例);typecheck+build 绿。行为变更披露(诊断口径):此前由中途 tools 变化诱导的 miss 会被记进 prov:"client"/seam-suspect/provider-side,现在改记入新 prov:"tools" 桶——只改诊断记账,不改任何实际行为。全量回归以 CI 为准(见下)。
  6. 是否破坏缓存:不涉及——未触任何缓存/重试/增量游标逻辑,出站字节不变。
  7. 是否改了设计方向:没有;沿用既有归因 ladder 的 fail-soft 纪律加一个桶,JSON 面(report.seam.tools)为附加字段。
  8. 是否引入了新的配置:无。

我在这条 PR 上做的

判定:PR 本身可合;等存储 golden 族在 #4599 收敛、CI 转绿后即可由 owner 合入。我不关单不合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Merge-conflict fix complete — PR #5476 rebased onto current master and force-pushed: 6e22c7b6b9 → 2288220e2e.

七问 summary:

  1. What was blocked? The PR conflicted with its base branch (mergeable_state: dirty, verified live via GitHub API at start of run). Master had moved 879 commits past the branch's merge base since the branch last merged master (Nov 1).

  2. Why? Both sides added fields/calls to the same cache-ledger send chokepoints independently: master landed Compression breaks Responses assistant history ordering, causing repeated invalid_assistant_history 400s #564/[Bug][Responses] acp_turn_sep 合成分隔符进入持久压缩覆盖集合,导致重复历史漂移误报 #2627 (ownedSeparatorCores separator-provenance tracking) and the # [Feature] Support user-registerable egress request body rewriting plugin pipeline | # [Feature] 支持用户可注册的出站(egress)请求体改写插件管线 #6003 phase-2 egress-envelope widening (wireBodyStr: string | Buffer) while this PR (cache-seam monitor blames the client when the prefix break is a tools-array change (messages-only comparison) #5466) added tools-array seam attribution (tools fps + toolsArrayFps() capture) to the same SeamSlot interface, noteForwardedBody(), and its two call sites.

  3. What did I do? Rebased the branch onto origin/master (dropped the two stale in-branch merge commits, kept the 3 real fix commits linear). Resolved 4 conflict hunks across 3 files. No red-CI fixing needed this run — the trigger was purely the merge conflict.

  4. How were the conflicts resolved (all additive merges, no semantic choice involved)?

    • src/cache-ledger.ts ×2: kept BOTH new interface/object fields — master's ownedSeparatorCores?: ReadonlySet<number> and this PR's tools?: ToolEntry[] (and both corresponding lines in noteForwardedBody's slot literal with their same-payload inheritance rules).
    • src/server/relay.ts ×1: import-line union — master's lastForwardedBody + this PR's toolsArrayFps.
    • src/loop/core.ts ×1: kept master's structure verbatim (egress-aware string coercion for noteForwardedBody, the extended 7-arg maybeJudgeContinuity call with ownedSeparatorCores bookkeeping) and grafted in the PR's one addition: toolsArrayFps(wireObj) as the 6th noteForwardedBody argument. This mirrors how generationParamFp(wireObj) already behaves (captured from the pre-egress parsed object, advisory-only, fail-soft) — consistent with the PR's "purely diagnostic" contract.
  5. What did I verify? Full npm run typecheck (tsc --noEmit, src + tests) green on the rebased head after a fresh npm ci. Confirmed no conflict markers remain anywhere in the tree. Confirmed the final diff vs current master is exactly the PR's intended scope: 6 files (+341/−20) — the two extra files in the old diff (scripts/update-storage-render-goldens.ts, tests/wire-exit-matrix.test.ts) byte-match current master; they had entered the branch via its earlier in-branch master merge, not this PR's work.

  6. Current state (live-verified after push): GitHub reports mergeable: true, mergeable_state: blocked (i.e. mergeable, waiting on checks/approval) at head 2288220e2e. Check runs are starting against the new head; final verdict comes from remote CI per §7.2. Push used --force-with-lease pinned to the exact pre-push sha; remote head was unchanged between my fetch and push (no concurrent writers detected).

  7. Risks / follow-up: None identified. All resolutions were unions of additive code paths — no behavior change beyond what the PR itself ships (its disclosed behavior change: mid-session tools-array misses re-booked into the new prov:"tools" bucket, diagnostic-only). No kernel/, release, updater, or config-surface involvement; no authorization gate hit. If any CI test lane goes red on the new head, that will be handled in the next auto-fix pass.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Red CI fixed — pushed c157dd6463 to the PR branch; full CI run 42816979709 on that head is completed / success (verified live via the Actions API after the mirror cache went stale). All three previously red shards are now green: test (ubuntu-latest, 22, 3), test (ubuntu-latest, 24, 3), test (windows-latest, 22, 5).

七问 summary:

  1. What was broken? Three test shards failed on head 2288220e2e (re-verified live before acting). Inside them, exactly four tests failed: storage-render golden (chat|anthropic|responses|google) in tests/golden-storage-render.test.ts — "render/state drifted", with only the metadata section digest differing from the committed golden (state/blockContents/stats identical on all four wires).

  2. Why? This PR (cache-seam monitor blames the client when the prefix break is a tools-array change (messages-only comparison) #5466) adds two counters (toolSeams, toolSeamMissed) to the cache-ledger agg, which is persisted in session.metadata.cacheLedger. The storage-render goldens pin the sha256 of session.metadata, so the two new zero-initialized fields moved the metadata digest on every wire. The scenario's tools array is stable across turns (verified in tests/golden-storage-drive.ts:356), so the tools attribution arm never fires — the drift comes purely from the new persisted fields, i.e. an intentional, disclosed part of the PR's design (same class as every prior counter addition to this ledger, each of which regenerated these goldens). Not inherited: the same test file passes on plain master (ran it locally on both heads).

  3. What did I do? Ran the sanctioned regeneration node --import tsx scripts/update-storage-render-goldens.ts, reviewed the diff, committed it as a clearly-labeled test(#5466) commit, and pushed (fetch-first per push discipline; remote head was untouched by others; fast-forward, no force-push).

  4. How was the fix verified? Diff review first: per golden file only 2 lines changed — the metadata section digest and the derived full stateDigest; state, blockContents, stats section digests and all stateKeyDigests are byte-identical, proving the drift is confined to the two new counter fields and nothing else moved. Then targeted local run of tests/golden-storage-render.test.ts: 5/5 pass on the fixed head (was 1/5). Then remote CI: the whole workflow green on c157dd6463.

  5. Is there any regression risk? No behavior change — this commit touches only committed snapshot files under tests/golden/storage-render/, no source. The pinned digests now reflect the ledger shape the PR ships; wire bodies and persisted state/block contents remain byte-pinned as before.

  6. Cache impact? None — no code path, fingerprint, or persistence-layout change beyond what the PR itself already ships (the two counters were already in the code before this golden regen; this commit only updates the test references to match).

  7. Current state / follow-up? Live-verified: run 42816979709 (CI, head c157dd6463) = completed/success, all 11 test shards + static gates green. Nothing further needed from me on this PR; it awaits normal review/merge. Note for the reviewer: the golden regen is justified by the PR's disclosed addition of the prov:"tools" bucket and its persisted counters (per the test file's own regen protocol: run script, review diff, justify in PR body — justification recorded in the commit message here).

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Closing note for this lane (my full 七问 summary is already posted above): work here is done and verified. Final state, live-checked in this run:

  • PR branch head: c157dd6463 (rebase 2288220e2e + golden-regen commit)
  • CI run 42816979709 on that head: completed / success — all 11 test shards + static gates green, including the three shards that were red (ubuntu 22/3, ubuntu 24/3, windows 22/5)
  • Failure was PR-caused, not inherited: the new persisted ledger counters (toolSeams/toolSeamMissed) moved the metadata digest pinned by the storage-render goldens; fixed via the sanctioned regen script, diff-reviewed (only metadata + derived stateDigest lines changed per wire file), same test file passes on plain master.

No open items from the CI lane: the PR awaits normal review/approval and owner merge. Nothing further needed from me unless a new blocker appears.

@ranxianglei
ranxianglei force-pushed the 2026-11-01_cache-seam-tools-attribution branch from c157dd6 to b43b71e Compare November 15, 2026 21:46
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Re-review at head b43b71e0c — verdict: APPROVE (recommended).

Re-reviewed after the branch was rebased onto a newer master. I diffed the PR-only patch (the 4 PR commits) between the previously-reviewed head c157dd646 and this head b43b71e0c: the code content is byte-identical — the only differences are hunk line-offsets (master moved) and the 4 storage-render golden digest values.

What changed since my last review:

Verification at this head:

  • PR-only diff = 10 files: src/cache-ledger.ts, src/loop/core.ts, src/server/relay.ts, src/web/client.ts, src/web/i18n.ts, tests/cache-seam-tools-change.test.ts (new) + 4 golden JSON. No kernel/ or pi-subagents/ touched; the PR body carries no kernel-change: line → no authorization gate.
  • Core logic unchanged from my prior review: the tools arm runs ahead of the message arms, fail-soft on stable/missing/no-tools, and is purely diagnostic (no billing/caching/compression/wire mutation). The 7-case test file is intact.
  • Mirror cache: 30 checks, 0 failed (4 test shards still in progress), gate / mysql-contract / static-gates / test green.
  • No new findings. My prior non-blocking finding (web report missing the prov:"tools" bucket) was already fixed on the branch — no open ends.

Verdict: APPROVE (recommended). The core fix is correct, regression-guarded, and purely diagnostic; the rebase is clean and the golden regen is minimal and correct. (Formal GitHub approve is owner-only and blocked for a self-authored PR, so this is the reviewer's recommendation for your final approve + merge.)


中文八问

  1. 是什么问题:cache-seam 监控只按“消息列表”指纹归因 provider 前缀断裂;但 Anthropic 线上前缀是 system + tools + messages,会话中途改 tools 数组会在不碰任何消息的情况下让缓存缝断在工具边界,监控却把它误归到第一个顺带的消息级分叉(client [Enhancement][cache-ledger] attribute client-side mid-history insertions to a client bucket — seam forensics currently blame bili for host churn (found in #2997) #3023 或未知 seam),掩盖了 pi native: bili's tools join the request only from the 2nd request, so each pi session re-writes ~20k cache tokens once #5459 的真正根因。
  2. 什么原因导致:detectSeam 的指纹维度缺一维——只看 messages,看不见 tools 数组。
  3. 影响范围与严重程度:仅诊断/报告面(/acp-cache 文本 + web 报告),无可用性影响;触发条件低频(会话中途变工具集:插件晚注册、动态开关工具)。纯误归属,p3。
  4. 怎么修复:在两个发送咽喉点(src/server/relay.ts、src/loop/core.ts)对完整解析体补采 per-entry 工具指纹(toolsArrayFps),detectSeam 加一条先于消息臂运行的 tools 臂,prev/cur 工具表不同就把残差计入新 prov:"tools" 桶并点名 appeared/disappeared/redefined/reordered;稳定/缺失/无 tools 全部 fail-soft 落回旧臂。
  5. 是否有回归问题:审过既有行为——稳定 tools 保持 client/seam 归属(有负例钉住)、无 tools/单边捕获落回旧桶、closure math/压缩/计费/实际缓存零改动(detectSeam 纯诊断)。高危模式逐项过:无语义漂移、无吞错、阈值/时序/输出格式不变 → 无回归。
  6. 是否破坏缓存:不涉及(detectSeam 只读账本做归因,不改任何缓存/重试/去重)。
  7. 是否改了设计方向:不变(仍是账本诊断归属面,加一个桶)。
  8. 是否引入新配置:无(无新 env/config/默认值)。

收工:head b43b71e0c,PR-only 内容与上轮审核逐字节一致(纯 rebase + 4 个 storage-render golden 摘要按新 base 重生成),无 kernel 改动、无新发现、无 open ends。建议 owner 批准并合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Merge-conflict fix complete — PR rebased onto current master and force-pushed: c157dd6463 → b43b71e0c0. Live-verified after push: mergeable: true, state blocked (awaiting checks/approval), and full CI on the new head is green: 30/30 checks passed, 0 failures (verified via the mirror check cache, which transitioned to the new sha during this run).

七问 summary:

  1. What was blocked? The PR conflicted with its base again (this wake's trigger; master had moved 690 commits past the branch's merge base since the last rebase — Nov 10 → Nov 16).

  2. Why? Single conflict, in tests/golden/storage-render/chat.json: while this PR was pending, master itself regenerated/changed that golden (its stats and metadata section digests moved — other merged PRs changed the persisted chat-wire scenario state), so both sides had rewritten the same digest lines. The three source-file conflicts from the last rebase did not recur — the 3 fix commits applied cleanly onto current master.

  3. What did I do? Rebased the branch onto origin/master (linear: 3 fix commits + golden commit on top of f648217cb8). For the golden conflict I did NOT hand-merge digest lines: I took master's golden as the base and re-ran the sanctioned scripts/update-storage-render-goldens.ts on the rebased head, which deterministically recomputes every digest from the actual code.

  4. How was the resolution verified? Reviewed the resulting diff vs master: per golden file only 2 lines differ — the metadata section digest and the derived full stateDigest (the PR's two new persisted counters toolSeams/toolSeamMissed); state, blockContents, stats section digests and all stateKeyDigests are byte-identical to master's goldens. Then on the rebased head: full npm run typecheck green; targeted tests/golden-storage-render.test.ts + tests/cache-seam-tools-change.test.ts = 12/12 pass; no conflict markers anywhere; final diff vs master is exactly the intended 10 files (5 source + PR test + 4 goldens).

  5. Is there any regression risk? No behavior change from this rebase — resolutions were either clean application of the PR's own commits or deterministic golden recomputation. The PR's only disclosed behavior change remains the diagnostic re-booking of mid-session tools-array misses into the prov:"tools" bucket (unchanged from prior runs).

  6. Cache impact? None — no code path, fingerprint, or persistence-layout change beyond what the PR itself ships; this run only moved the branch base and refreshed the test snapshots to match.

  7. Current state / follow-up? Live-verified: head b43b71e0c0, mergeable, CI 30/30 green (all 11 test shards + static gates, including the gate-coverage additions that landed on master since the last run). Nothing further needed from the CI lane; the PR awaits normal review/approval and owner merge.

ci-check added 4 commits November 17, 2026 04:55
#5466)

The cache-seam monitor fingerprinted only the message list, but on the
Anthropic wire the prompt prefix is system + tools + messages. A mid-session
change to the request's tools array invalidates the cached span without
touching any message, so detectSeam blamed the first incidental divergence --
the client (#3023) or an unexplained seam -- while the real cause sat hidden.

Capture per-entry tool fingerprints at the two send chokepoints via a new
toolsArrayFps() helper (name + canonical-json hash, order-sensitive). When the
prev/cur tool tables differ, detectSeam books the residual into a dedicated
prov:"tools" bucket ahead of the message-shape arms (tools precede messages in
the prefix), naming which entries appeared/disappeared/were redefined/reordered.
Stable tools, a missing capture on either side, and no-tools lanes keep the
legacy arms untouched (fail soft, like the message ladder).

Behavior change: misses induced by a mid-session tools-array change were
previously mis-booked as prov:"client" / seam-suspect / provider-side; they now
book into the new prov:"tools" bucket (+ report.seam.tools). Purely diagnostic
-- no change to closure math, compression, billing, or caching behavior.

Closes #5466
…ts export as unreferenced outside cache-ledger.ts
The #5466 fix adds prov:"tools" to the diagnostic ledger and the /acp-cache text report, but the web UI hardcodes its miss-attribution buckets, so a mid-session tools break was left out of every bucket: the unexplained residual did not subtract seam.tools.missed and no TOOLS chip or legend swatch rendered. Wire the new bucket through the detailSeam normalizer, the active-check, the legend, the chip list and the residual math, and add det.attr_tools / det.attr_tools_tip / det.leg_tools to both locales. Diagnostic display only - no billing, caching or compression change.
…toolSeamMissed ledger counters

The #5466 tools-array seam bucket persists two new zero-initialized
counters (toolSeams/toolSeamMissed) in session.metadata.cacheLedger.
The storage-render goldens pin the sha256 of session.metadata, so all
four wires' metadata section digest moves even though wire bodies,
state, block contents, stats and every state-key digest stay
byte-identical (section digests confirm: only 'metadata' and the
derived full stateDigest changed). Sanctioned regen via
scripts/update-storage-render-goldens.ts; reviewed diff — no drift
beyond the two new counter fields.
@ranxianglei
ranxianglei force-pushed the 2026-11-01_cache-seam-tools-attribution branch from b43b71e to b6d19f1 Compare November 16, 2026 20:58
Master 301e1a5 is red on the same 3 test shards (ubuntu 22/24 shard 3, windows 22 shard 4). The #2929 fold-probe test (tests/issue2929-codex-fold-double-miss.test.ts) is schedule-dependent and flaky; ci-fixes makes it deterministic (schedule-independent + hermetic wire shape). Also brings the architecture module-map fix (#6922). Per CI-failure coordination policy (#4599), merge ci-fixes into the PR branch to clear the inherited red.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 CI fix for PR #5476 (cache-seam tools attribution) — inherited red cleared.

Diagnosis. The 3 failing checks — test (ubuntu-latest, 22, 3), test (ubuntu-latest, 24, 3), test (windows-latest, 22, 4) — are inherited from master, not caused by this PR. I verified the master head commit 301e1a5459 (which is this PR's exact merge-base) is red on the same 3 shards (plus windows 24 4 and architecture-docs). Root cause: tests/issue2929-codex-fold-double-miss.test.ts — a fold-probe test that is schedule/timing-dependent (flaky), unrelated to the cache-seam changes.

Fix. Per the CI-failure coordination policy (#4599), I merged origin/ci-fixes (the sentinel's converged master fixes) into the PR branch. ci-fixes makes the #2929 fold-probe test deterministic (schedule-independent + hermetic wire shape) and also brings the architecture module-map fix (#6922). The merge was clean — no file overlap with the PR's own changes; all of the PR's cache-seam work (cache-ledger/loop/relay/web + new test + goldens) is preserved byte-for-byte.

Verification. Ran the targeted test locally after the merge: node --import tsx --test tests/issue2929-codex-fold-double-miss.test.ts → pass 1, fail 0 ("probe OK: summary anchored at item[6]; re-request(26 items) and next turn(25 items) byte-identical through the anchor").

Push. b6d19f113c..44bf3d284d — merge commit, no CI-hold marker (this is the branch's one full CI pass). CI is now running on the new head.

八问:

  1. 是什么问题: PR [PR] cache-seam: attribute prefix breaks caused by a tools-array change (#5466) #5476 的 3 个 test shard(ubuntu 22/24 shard 3、windows 22 shard 4)CI 红,挡住合并。
  2. 什么原因导致的: 继承性失败,非本 PR 改动。master head(301e1a5,即本 PR merge-base)同样红在这 3 个 shard;根因是 tests/issue2929-codex-fold-double-miss.test.ts 的 fold-probe 测试对调度/时序敏感(偶发失败),与 cache-seam 改动无关。
  3. 影响范围与严重程度: 仅 CI 门禁(3 个 test shard);PR 本身 mergeable,功能不受影响;属继承红,非本 PR 引入。
  4. 怎么修复的: 按 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 协调政策 merge origin/ci-fixes 进 PR 分支——ci-fixes 已把 codex 命中率问题分析 #2929 fold-probe 改为 schedule-independent + hermetic(确定性),并带 architecture module-map 修复([Bug] Inconsistent system prompt separator in Responses internal re-request breaks cache prefix | [Bug] Responses 内部重请求的系统提示分隔符不一致,破坏缓存前缀 #6922);本地定向跑该测试通过(pass 1, fail 0)。
  5. 是否有回归问题: 无。merge 仅带入 ci-fixes 的两处修复(测试文件 + reference/architecture.md),PR [PR] cache-seam: attribute prefix breaks caused by a tools-array change (#5466) #5476 的 cache-ledger/loop/relay/web 改动全部原样保留,无文件重叠。
  6. 是否破坏缓存: 不涉及(纯 CI/测试修复,不改缓存、重试、游标、去重逻辑)。
  7. 是否改了设计方向: 不涉及(纯 CI 修复)。
  8. 是否引入了新的配置: 不涉及。

判定:继承红已清,等 CI 全绿即可合并;本 PR 的 cache-seam 功能改动未动。

Note: I attempted to post the one-line note to the #4599 CI-coordination thread per policy, but the mirror search did not surface that thread's internal number from this lane; the diagnosis + fix + sha are recorded here for the 总控.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Update: CI is now fully green on the new head 44bf3d284d — all 30 checks passed (failed: 0, pending: 0), including the 3 previously-failing shards (ubuntu 22/24 shard 3, windows 22 shard 4). The inherited red is cleared. PR #5476 is now mergeable (pending human merge).

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Re-review at head 44bf3d284 — verdict: APPROVE (recommended).

The new head is a ci-fixes merge ("Merge ci-fixes into PR #5476 branch (clear inherited red)") on top of a rebase onto newer master. I verified the PR's actual contribution vs current master: the core feature is unchanged and correct.

What the net diff (PR head vs current master) actually contains:

Disambiguation worth noting: src/cache-ledger.ts also shows a #6729 nudge-vs-fold recovery ledger (RecoveryEvent / recordFoldRecovery) in the branch-vs-previous-head diff — but that is current master's own change (present on origin/master), pulled in by the rebase, not part of this PR's contribution. The net diff vs master contains 0 #6729 lines.

Verification:

  • No kernel/ or pi-subagents/ touched; the PR body carries no kernel-change: line → no authorization gate.
  • Mirror cache at 44bf3d284: 30 checks, 0 failed, 0 pending — fully green.
  • No new findings on the core feature; no open ends.

Verdict: APPROVE (recommended). The core fix is correct, regression-guarded, and purely diagnostic; the only additions are sanctioned ci-fixes convergence plus master's own rebase context. (Formal GitHub approve is owner-only and blocked for a self-authored PR, so this is the reviewer's recommendation for your final approve + merge.)


中文八问

  1. 是什么问题:cache-seam 监控只按“消息列表”指纹归因 provider 前缀断裂;Anthropic 线上前缀是 system + tools + messages,会话中途改 tools 数组会在不碰任何消息的情况下让缓存缝断在工具边界,监控却把它误归到顺带的消息级分叉(client [Enhancement][cache-ledger] attribute client-side mid-history insertions to a client bucket — seam forensics currently blame bili for host churn (found in #2997) #3023 或未知 seam),掩盖了 pi native: bili's tools join the request only from the 2nd request, so each pi session re-writes ~20k cache tokens once #5459 的真正根因。
  2. 什么原因导致:detectSeam 的指纹维度缺一维——只看 messages,看不见 tools 数组。
  3. 影响范围与严重程度:仅诊断/报告面(/acp-cache 文本 + web 报告),无可用性影响;触发条件低频(会话中途变工具集)。纯误归属,p3。
  4. 怎么修复:在两个发送咽喉点(src/server/relay.ts、src/loop/core.ts)对完整解析体补采 per-entry 工具指纹(toolsArrayFps),detectSeam 加一条先于消息臂运行的 tools 臂,prev/cur 工具表不同就把残差计入新 prov:"tools" 桶并点名 appeared/disappeared/redefined/reordered;稳定/缺失/无 tools 全部 fail-soft 落回旧臂。
  5. 是否有回归问题:核心功能与上轮审核逐字节一致,无回归。高危模式逐项过:无语义漂移、无吞错、阈值/时序/输出格式不变。ci-fixes 带入的 [Bug] Inconsistent system prompt separator in Responses internal re-request breaks cache prefix | [Bug] Responses 内部重请求的系统提示分隔符不一致,破坏缓存前缀 #6922(文档)与 codex 命中率问题分析 #2929(测试健壮性)均为 master-bound 的良性收敛,不触碰本功能行为。
  6. 是否破坏缓存:不涉及(detectSeam 只读账本做归因,不改任何缓存/重试/去重)。
  7. 是否改了设计方向:不变(仍是账本诊断归属面,加一个桶)。
  8. 是否引入新配置:无(无新 env/config/默认值)。

收工:head 44bf3d284,核心 cache-seam 功能与已批准版本逐字节一致;HEAD 的 ci-fixes 合并带入 #6922/#2929(均在 ci-fixes 上,master-bound 良性收敛),#6729 为 master 自身变更(rebase 上下文,非本 PR 贡献)。无 kernel 改动、无新发现、无 open ends,CI 30/30 全绿。建议 owner 批准并合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷

Conflict-resolution check for PR #5476 — no action needed (claim was stale)

This run was triggered by a system forward claiming "The PR conflicts with its base branch (merge state: dirty): rebase (or merge) the target branch into your branch, resolve ALL conflicts, force-push (rebase) or push (merge)." I re-verified the live state before acting:

Live state (GitHub API, this run):

  • Master head: 301e1a5459 (unchanged since the previous run)
  • PR head: 44bf3d284d (unchanged)
  • mergeable: True, mergeable_state: blocked — no conflict; "blocked" means CI/review gates, not a merge conflict
  • Verified locally: git merge-base --is-ancestor 301e1a5459 44bf3d284d → master is already an ancestor of the PR head. The PR branch already contains the current master. There is nothing to integrate.

Conclusion: The "merge state: dirty" claim is stale/incorrect. The PR is NOT conflicting with master. No rebase, no merge, no push needed. The branch is already up to date with master.

Note on git remote: The origin remote in this workdir had been redirected to the mirror (by a concurrent agent). I used the gh remote (still pointing at GitHub) for all fetches and used the GitHub API for authoritative state.

八问:

  1. 是什么问题: 系统转发声称 PR 与 base 分支冲突(merge state: dirty),要求 rebase/merge。
  2. 什么原因导致的: 转发信息基于过期状态。实际 master 头未移动(仍为 301e1a5),PR 头(44bf3d284d)已包含当前 master,不存在冲突。
  3. 影响范围与严重程度: 无影响——PR 本身没有冲突,CI 已全绿(上一轮已确认 30/30 checks passed)。
  4. 怎么修复的: 无需修复。通过 GitHub API + 本地 git merge-base --is-ancestor 验证了 PR 分支已包含当前 master,确认转发信息过期。
  5. 是否有回归问题: 不涉及——本轮未做任何代码变更,未 push 任何 commit。
  6. 是否破坏缓存: 不涉及。
  7. 是否改了设计方向: 不涉及。
  8. 是否引入了新的配置: 不涉及。

判定: 无需操作。PR 分支已包含当前 master,无冲突,CI 已绿。等待 owner 合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷

Conflict resolved — PR #5476 rebased onto new master head 77fe0b1d63

This run re-verified the live state: master had moved forward since the last check (was 301e1a5459, now 77fe0b1d63), and the PR was genuinely conflicting (mergeable: False, mergeable_state: dirty).

What was done:

  1. Merged gh/master (77fe0b1d63) into the PR branch.
  2. 4 golden file conflicts in tests/golden/storage-render/{anthropic,chat,google,responses}.json — both master and the PR had changed the state digests. Resolved by regenerating all four with scripts/update-storage-render-goldens.ts (reflects the combined PR+master code state).
  3. Verified locally:
    • tests/golden-storage-render.test.ts → 5/5 pass
    • tests/cache-seam-tools-change.test.ts → 7/7 pass
    • tests/issue2929-codex-fold-double-miss.test.ts → 1/1 pass
  4. Pushed final head 44bf3d284d..fee9e9bbb8 (no CI-hold marker → one full CI pass).

Commits added this run:

八问:

  1. 是什么问题: master 前进到 77fe0b1d63,PR 分支与 master 产生真实冲突(4 个 golden 文件 + 自动合并的源码文件)。
  2. 什么原因导致的: master 上合入了多个 PR([PR] docs(clients): dsh-go host | docs(clients): dsh-go 宿主 #6592、[PR] fix(diagnostics): register the attribution topic the banner already reports to #7054、[PR] release v0.1.216 #6938 release v0.1.216 等),其中 storage 相关变更修改了 storage-render golden 的 state digest,与 PR 自身的 golden 变更冲突。
  3. 影响范围与严重程度: 仅影响 CI 合并状态(dirty → clean);PR 功能代码不受影响,4 个 golden 文件已重新生成并验证通过。
  4. 怎么修复的: merge master → 用 update-storage-render-goldens.ts 重新生成 4 个 golden 文件(反映 PR+master 合并后的代码状态)→ 定向测试验证 → push。
  5. 是否有回归问题: 审了 golden-storage-render(5/5)、cache-seam-tools-change(7/7)、issue2929(1/1)——全部通过。自动合并的源码文件(src/cache-ledger.ts、src/server/relay.ts、reference/architecture.md 等)无冲突,git 自动合并正确。
  6. 是否破坏缓存: 不涉及——golden 文件是测试快照,不影响运行时缓存。
  7. 是否改了设计方向: 不涉及。
  8. 是否引入了新的配置: 不涉及。

判定: 冲突已解决,CI 已触发(head fee9e9bbb8),等待 CI 结果。PR 功能代码完整保留。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Re-review at head fee9e9bbb — verdict: APPROVE (recommended).

Another rebase onto newer master. The PR's net contribution vs current master is the clean 10-file tools feature, byte-identical to what I approved at b43b71e0c / 44bf3d284:

  • src/cache-ledger.ts (+16 tools lines: toolsArrayFps, describeToolsChange, the prov:"tools" seam bucket, toolSeams/toolSeamMissed), src/loop/core.ts + src/server/relay.ts (the two chokepoints pass toolsArrayFps(...) as the 6th noteForwardedBody arg), src/web/client.ts + src/web/i18n.ts (the web-report tools bucket I wired), tests/cache-seam-tools-change.test.ts + 4 storage-render goldens.

Disambiguation (master's own changes rebased in, NOT PR work): the branch-to-previous-head diff shows a #6729 recovery-pairing refinement (if (f.mode !== "n") continue;) in cache-ledger.ts and a 3-arg createHandoffReply(...) in relay.ts — both are present on current origin/master (lines 2429 / 381), pulled in by the rebase. The net diff vs master contains 0 #6729 lines, and the relay/core net diffs are only the tools chokepoint. The earlier #6922/#2929 ci-fixes files are now absorbed into master, so they no longer appear in the net diff.

Verification:

  • No kernel/ or pi-subagents/ touched; the PR body carries no kernel-change: line → no authorization gate.
  • Mirror cache at fee9e9bbb: 0 failed (10 shards still in progress), no failed/blocked — green.
  • No new findings on the core feature; no open ends.

Verdict: APPROVE (recommended). Core fix correct, regression-guarded, purely diagnostic; the only additions are master's own rebase context. (Formal GitHub approve is owner-only and blocked for a self-authored PR — this is the reviewer's recommendation for your final approve + merge.)


中文八问

  1. 是什么问题:cache-seam 监控只按“消息列表”指纹归因 provider 前缀断裂;Anthropic 线上前缀是 system + tools + messages,会话中途改 tools 数组会在不碰任何消息的情况下让缓存缝断在工具边界,监控却把它误归到顺带的消息级分叉(client [Enhancement][cache-ledger] attribute client-side mid-history insertions to a client bucket — seam forensics currently blame bili for host churn (found in #2997) #3023 或未知 seam),掩盖了 pi native: bili's tools join the request only from the 2nd request, so each pi session re-writes ~20k cache tokens once #5459 的真正根因。
  2. 什么原因导致:detectSeam 的指纹维度缺一维——只看 messages,看不见 tools 数组。
  3. 影响范围与严重程度:仅诊断/报告面(/acp-cache 文本 + web 报告),无可用性影响;触发条件低频(会话中途变工具集)。纯误归属,p3。
  4. 怎么修复:在两个发送咽喉点(src/server/relay.ts、src/loop/core.ts)对完整解析体补采 per-entry 工具指纹(toolsArrayFps),detectSeam 加一条先于消息臂运行的 tools 臂,prev/cur 工具表不同就把残差计入新 prov:"tools" 桶并点名 appeared/disappeared/redefined/reordered;稳定/缺失/无 tools 全部 fail-soft 落回旧臂。
  5. 是否有回归问题:核心功能与已批准版本逐字节一致,无回归。高危模式逐项过:无语义漂移、无吞错、阈值/时序/输出格式不变。本轮 rebase 带入的 Feature: show nudge-recommended vs actually-folded tokens per fold (recovery rate) in the web panel chart and session report | 功能:web 折线图与 session 报告显示每次压缩「推荐 vs 实际折叠」回收率 #6729 配对细化与 createHandoffReply 签名变更均为 master 自身变更,非本 PR 贡献。
  6. 是否破坏缓存:不涉及(detectSeam 只读账本做归因,不改任何缓存/重试/去重)。
  7. 是否改了设计方向:不变(仍是账本诊断归属面,加一个桶)。
  8. 是否引入新配置:无(无新 env/config/默认值)。

收工:head fee9e9bbb,核心 cache-seam 功能与已批准版本逐字节一致(net diff 即 10 文件工具特性);rebase 带入的 #6729 配对细化 / createHandoffReply 签名均为 master 自身变更。无 kernel 改动、无新发现、无 open ends,CI 0 失败。建议 owner 批准并合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

No change since my re-review above — the head is still fee9e9bbb, identical to the head I reviewed in the previous comment (the branch did not move). Verdict stands: APPROVE (recommended). Core tools feature byte-identical to the approved version, no kernel//kernel-change, CI 0 failed. Awaiting owner approve + merge.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Round complete for head fee9e9bbb — verdict: APPROVE (recommended) (full 8问 in my re-review comment above).

  • Net diff vs current master = the clean 10-file tools feature, byte-identical to the approved version. The branch-to-branch deltas (#6729 recovery-pairing if (f.mode !== "n") continue;, 3-arg createHandoffReply) are master's own rebased changes, not PR work (confirmed present on origin/master; net cache-ledger has 0 recovery lines, net relay/core = only the tools chokepoint).
  • No kernel//pi-subagents/ touched, no kernel-change: line → no authorization gate.
  • CI mirror cache @ fee9e9bbb: 0 failed (10 shards in progress), no failed/blocked — green.
  • On-spot fix (web-report tools bucket) already committed on the PR branch as a fix: commit (re-hashed by the rebase). No open ends.

Awaiting owner approve + merge. (Formal GitHub approve is owner-only and blocked for a self-authored PR — this is the reviewer's recommendation.)

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷

Conflict resolved again — PR #5476 merged onto new master head a446a3c1c

Re-verified live state: master had advanced again (was 77fe0b1d63, now a446a3c1c — new PRs #6827, #7105, #7083, #7107 merged in). PR was genuinely conflicting (mergeable: False, dirty).

What was done:

  1. Merged origin/master (a446a3c1c) into the PR branch.
  2. Same 4 golden file conflicts (tests/golden/storage-render/{anthropic,chat,google,responses}.json) — master's batch11-wave11 merge regenerated the goldens on its own tree. Resolved by regenerating with scripts/update-storage-render-goldens.ts on the combined PR+master tree.
  3. Verified locally:
    • tests/golden-storage-render.test.ts → 5/5 pass
    • tests/cache-seam-tools-change.test.ts → 7/7 pass
  4. Pushed final head fee9e9bbb8..ddc2ca68e (no CI-hold marker → one full CI pass).

Commits added this run:

八问:

  1. 是什么问题: master 再次前进(合入 [PR] wave-11 batch: 7 community fixes (opencode provider, preflight epoch, output budget, +4) — #6797/#6818 excluded #6827 batch11-wave11 等),storage-render golden 文件再次冲突。
  2. 什么原因导致的: master 上 [PR] fix(persist): keep k̂ model provenance and the emergency-shrink marker across restarts #6775 的 persisted fields 变更重新生成了 golden,与 PR 分支上已重新生成的 golden 产生内容冲突(同一字段不同 hash 值)。
  3. 影响范围与严重程度: 仅 CI 合并状态;PR 功能代码不受影响。
  4. 怎么修复的: merge master → 重新生成 4 个 golden 文件 → 定向测试验证 → push。
  5. 是否有回归问题: golden-storage-render 5/5、cache-seam-tools-change 7/7 全部通过。自动合并的源码文件无冲突。
  6. 是否破坏缓存: 不涉及。
  7. 是否改了设计方向: 不涉及。
  8. 是否引入了新的配置: 不涉及。

判定: 冲突已解决,CI 已触发(head ddc2ca68e)。注意:这是第三次因 master 前进导致的 golden 冲突——如果 master 持续活跃,可能需要考虑在 PR 合并前再做一次最终 rebase。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷

Re-verification run (attempt 1/6) — conflict already resolved, no new action needed.

This run was triggered by the "merge state: dirty" forward. I re-verified the live state before acting and found the conflict was already resolved and pushed by the prior run (floor 49, Nov 18): master a446a3c1c was merged into the branch (f0cff6da8) and the 4 storage-render goldens regenerated (ddc2ca68e).

Live state (verified this run):

  • PR head: ddc2ca68e (== local HEAD); branch is a clean descendant of origin/master (a446a3c1c) — git merge-base --is-ancestor confirms master is an ancestor, no conflict.
  • mergeable: True, mergeable_state: blocked (CI/review gates, not a merge conflict).
  • No conflict markers in the tree; the PR's 10-file tools feature is intact.
  • Targeted tests green this run: cache-seam-tools-change (7) + golden-storage-render (4 wires) + cache-ledger = 52/52 pass.
  • CI running on ddc2ca68e: 44/55 check-runs green, 11 test shards in progress.

Nothing left to push. Awaiting CI completion + owner approve/merge (merge is human-only).

八问:

  1. 是什么问题: 系统转发声称 PR 与 base 冲突(dirty),要求 rebase/merge。
  2. 什么原因导致的: 转发基于 master 前进后(77fe0b1d63 → a446a3c1c)的过期快照;实际冲突已由上一轮(floor 49, 11-18)解决并推送(ddc2ca68e)。
  3. 影响范围与严重程度: 无新增影响——冲突已解决,PR 功能代码完整。
  4. 怎么修复的: 本轮无需修复;重新验证了 live 状态(master 已是 PR head 祖先、无冲突标记、定向测试 52/52 绿、CI 运行中)。
  5. 是否有回归问题: 不涉及——本轮未做任何代码变更、未 push 任何 commit。
  6. 是否破坏缓存: 不涉及。
  7. 是否改了设计方向: 不涉及。
  8. 是否引入了新的配置: 不涉及。

判定: 无需操作。PR 分支已包含当前 master(a446a3c1c),无冲突,CI 运行中(44/55 绿、11 分片进行中)。等 CI 全绿 + owner 合并。

(注:本次唤醒中我先前误把一条回复发到了上游编号 #5476 的镜像线程,本条才是本任务(#5478)的正确回复。)

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Re-review at head ddc2ca68e — verdict: APPROVE (recommended).

The branch was merged with the new master head (a446a3c1c) and the storage-render goldens regenerated against it — the same sanctioned merge-and-regen pattern as prior rounds (new commits: f0cff6da8 "Merge master … resolve conflict with new master head a446a3c", ddc2ca68e "fix(test): regenerate storage-render goldens after merging master a446a3c"). The 144-file / 7112-line branch-to-branch delta is master's own work pulled in by that merge (now in both, so absent from the net diff) — not PR contribution.

Net diff vs current master = the clean 10-file tools feature — the 5 source files + the 7-case test are unchanged from what I approved; the 4 storage-render goldens are regenerated against the new master base (the new toolSeams/toolSeamMissed counters):

  • src/cache-ledger.ts — the full tools feature: prov:"tools" line type, toolSeams/toolSeamMissed agg counters, ToolsDelta/ToolEntry types, toolsArrayFps() + describeToolsChange(), the noteForwardedBody 6th toolsFps param, the TOOLS arm in detectSeam running before the message arms (fail-soft on stable/missing/no-tools), getCacheLedger agg init, BiliCacheReport.seam.tools, and the formatSeam 🔧 TOOLS-ARRAY CHANGE section + the !e.tools suspect-filter.
  • src/loop/core.ts + src/server/relay.ts — the two chokepoints import toolsArrayFps and pass it as the 6th noteForwardedBody arg.
  • src/web/client.ts + src/web/i18n.ts — the web-report tools bucket I wired (normalizer / active / legend / chip / residual + zh/en i18n).
  • tests/cache-seam-tools-change.test.ts (7 cases) + 4 storage-render goldens.

Verification:

  • No kernel/ or pi-subagents/ in the net diff; the PR body carries no kernel-change: line → no authorization gate.
  • CI mirror cache @ ddc2ca68e: 0 failed (9 shards in progress, 6 success, 15 skipped), no failed/blocked — green.
  • No new findings on the core feature; no open ends.

Verdict: APPROVE (recommended). Core fix correct, regression-guarded, purely diagnostic; the only additions since fee9e9bbb are master's own merge + golden regen. (Formal GitHub approve is owner-only and blocked for a self-authored PR — this is the reviewer's recommendation for your final approve + merge.)


中文八问

  1. 是什么问题:cache-seam 监控只按"消息列表"指纹归因 provider 前缀断裂;Anthropic 线上前缀是 system + tools + messages,会话中途改 tools 数组会在不碰任何消息的情况下让缓存缝断在工具边界,监控却把它误归到顺带的消息级分叉(client [Enhancement][cache-ledger] attribute client-side mid-history insertions to a client bucket — seam forensics currently blame bili for host churn (found in #2997) #3023 或未知 seam),掩盖了 pi native: bili's tools join the request only from the 2nd request, so each pi session re-writes ~20k cache tokens once #5459 的真正根因。
  2. 什么原因导致:detectSeam 的指纹维度缺一维——只看 messages,看不见 tools 数组。
  3. 影响范围与严重程度:仅诊断/报告面(/acp-cache 文本 + web 报告),无可用性影响;触发条件低频(会话中途变工具集)。纯误归属,p3。
  4. 怎么修复:在两个发送咽喉点(src/server/relay.ts、src/loop/core.ts)对完整解析体补采 per-entry 工具指纹(toolsArrayFps),detectSeam 加一条先于消息臂运行的 tools 臂,prev/cur 工具表不同就把残差计入新 prov:"tools" 桶并点名 appeared/disappeared/redefined/reordered;稳定/缺失/无 tools 全部 fail-soft 落回旧臂。
  5. 是否有回归问题:核心功能与已批准版本一致,无回归。高危模式逐项过:无语义漂移、无吞错、阈值/时序/输出格式不变。本轮新增的仅是 master 合并(a446a3c1c)+ golden 重生成,均为 master 自身变更、非本 PR 贡献;net diff 仍为干净的 10 文件工具特性。
  6. 是否破坏缓存:不涉及(detectSeam 只读账本做归因,不改任何缓存/重试/去重)。
  7. 是否改了设计方向:不变(仍是账本诊断归属面,加一个桶)。
  8. 是否引入新配置:无(无新 env/config/默认值)。

收工:head ddc2ca68e,核心 cache-seam 功能与已批准版本一致(net diff 即 10 文件工具特性);本轮新增为 master 合并 + golden 重生成(master 自身变更)。无 kernel 改动、无新发现、无 open ends,CI 0 失败。建议 owner 批准并合并。

…ead 6453fee)

Regenerated the 4 storage-render goldens on the combined PR+master tree: only the metadata section digest + derived stateDigest moved (the #5466 toolSeams/toolSeamMissed counters); wire bodies (state/blockContents/stats) byte-unchanged.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷

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

Master moved again (a446a3c1c → 6453feeeb, including #7149 batch2's storage-render golden regen), which re-dirtied the PR. Merged the new master head into the PR branch and resolved the recurring 4-file storage-render golden conflict by regenerating on the combined tree. Pushed as the final (unmarked) head — live state is now clean and CI is green.

七问:

  1. 是什么问题:PR 与 master 再次冲突(master 前进 a446a3c1c → 6453feeeb),merge state 变 dirty,需要接冲突。
  2. 什么原因导致的:master 合入 [PR] perf: batch-1 hash dedup — anonymous-lane v1 skip + incremental wire-hash pair (#7149) #7151/[PR] perf: Batch 2+3-1 consolidated — fingerprint change detection + ledger zero-hash inheritance + persona deprecation annot | perf: 批次二+三-1 合订 — 指纹变化探测 + 台账零哈希继承 + persona 退役标注 (#7149) #7191/[PR] kernel: move illegally-positioned directive-only systems to the trailing run (#7270) #7281/[PR] compress.reasoning.tail: drop reasoning of any closed round in the protected window (#7144 follow-up) #7252/[PR] fix: completely prohibit inheritance compression for presets registered at dsh runtime (wrapped by agentPresets.register | fix: dsh 运行时注册的 preset 继承压缩完全禁止(agentPresets.register 包裹) #7242/性能清理提案:同一份内容每请求被重复哈希 3-5 次 —— 盘点结论与分批清理方案 #7149 batch1/2/3 等一批 PR,其中 性能清理提案:同一份内容每请求被重复哈希 3-5 次 —— 盘点结论与分批清理方案 #7149 batch2 又改了 storage-render 的 systemFp/canonicalSysFp(256B change-probe head),与本 PR 同样触碰的 4 个 golden 冲突。
  3. 影响范围与严重程度:仅本 PR 分支的冲突,不影响其他分支/用户;不接则 PR 进不了可合并态。
  4. 怎么修复的:把新 master head 6453feeeb merge 进 PR 分支;源码(src/cache-ledger.ts 等)自动合并干净,只有 4 个 storage-render golden 冲突,用官方脚本 scripts/update-storage-render-goldens.ts 在合并后的树上重新生成。
  5. 是否有回归问题:无。4 个 golden 相对 master 只有 stateDigest + metadata 段摘要变化(cache-seam monitor blames the client when the prefix break is a tools-array change (messages-only comparison) #5466 新增 toolSeams/toolSeamMissed 计数器所致),wire 正文(state/blockContents/stats)逐字节不变;相对 master 的净 diff 恰好是本 PR 预期的 10 个文件。定向测试 52/52 通过(cache-seam-tools-change + golden-storage-render + cache-ledger)。
  6. 是否破坏缓存:不涉及——golden 只是快照摘要,非运行时缓存;wire 正文未动。
  7. 是否改了设计方向:不涉及——纯冲突消解 + golden 重生成,无架构/数据流变化。

判定:冲突已解决,PR head 现为 90db1deb2(无 ci-held 标记,触发一次完整 CI)。live 状态:mergeable True / mergeable_state blocked(等人工 review,非冲突);CI 镜像缓存 30/30 无红(0 failed / 0 pending,全部 test / static-gates / mysql-contract 成功,其余 e2e 车道 skip)。合并仍由人工执行。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷

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

Re-verified live first: the reported check test (windows-latest, 22, 4) was still red (completed failure). Pulled the job log — the failing case is #5152 the owner heartbeat keeps POSTing while the sending thread is pinned, a timing-sensitive test that needs ≥10 beats in a 6s window and got 7. That subsystem is untouched by this PR (the diff is only cache-ledger / loop / relay / web / i18n + the #5466 test + 4 goldens; src/launcher.ts, the heartbeat sender, is not in the diff), and the test passes 6/6 locally — so it's a runner-load flake, not a regression. Re-ran the single failed job (one-time API write, not a poll); attempt 2 passed and the mirror now shows all green.

七问:

  1. 是什么问题:CI 红了一个 test 分片(windows-latest / node 22 / shard 4)。
  2. 什么原因导致的:非本 PR 回归,而是 [Bug] Watchdog takes its stale-heartbeat reading on its own event loop, so a synchronous stall kills a live proxy (parent-gone → uncompressed 400) #5152 的 owner-heartbeat 时序测试在负载过高的 Windows runner 上 flake——断言要求 6s 阻塞窗口内 ≥10 个心跳(20 个理论值的一半),实际只到 7 个;本 PR 完全不碰心跳发送端(src/launcher.ts 不在 diff 里),本地 6/6 通过。
  3. 影响范围与严重程度:仅 CI 分片的偶发 flake,不影响 PR 代码正确性、不影响用户;不处理则 PR 卡在红 CI 无法合并。
  4. 怎么修复的:确认是 flake(非回归)后,直接 re-run 该失败 job(一次性 API 写操作,非轮询);重跑 attempt 2 通过。
  5. 是否有回归问题:无——失败测试与 PR 改动域无关;PR 自身改动上一轮已验证(52/52 定向测试 + 4 golden 仅 metadata/stateDigest 变)。
  6. 是否破坏缓存:不涉及——本次未改任何代码,纯 CI 分片重跑。
  7. 是否改了设计方向:不涉及——无代码变更。

判定:CI 已全绿(镜像缓存 30/30,0 failed / 0 pending;GitHub run attempt 2 conclusion success)。本次无代码改动(故无 ci-held 中间提交)。该时序测试在重载分片上仍可能偶发 flake,属独立子系统(非本 PR 范围),本车道不擅自改其断言;PR 仍等人工 review 合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷

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

Re-verified live: the reported check test (windows-latest, 22, 4) is already green — this event is stale. Last run I re-ran that single failed job (a #5152 owner-heartbeat timing flake, unrelated to this PR) and attempt 2 passed. Mirror cache now shows 30/30 (0 failed / 0 pending). No further work needed; PR stays green and waiting on human review/merge.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Re-review at head 90db1deb2 — verdict: APPROVE (recommended).

Master advanced (a446a3c1c → 6453feeeb — kernel 0.0.200, hash-cleanup batches, dsh-preset compaction gate, compress-reasoning-tail, etc.) and the branch merged it: one new commit (90db1deb2 "Merge master … resolve conflict with new master head 6453fee"), no separate golden-regen this time. That master work is now in both, so it's absent from the net diff — not PR contribution.

Net diff vs current master = the clean 10-file tools feature, unchanged from what I approved:

  • src/cache-ledger.ts — the full tools feature (all 12 key symbols present: toolsArrayFps(), describeToolsChange(), prov:"tools", toolSeams/toolSeamMissed, the tools: td seam-event field, the TOOLS arm in detectSeam running before the message arms, noteForwardedBody 6th toolsFps param, formatSeam 🔧 section + !e.tools suspect-filter).
  • src/loop/core.ts + src/server/relay.ts — both chokepoints pass toolsArrayFps(...) as the 6th noteForwardedBody arg (confirmed in the net diff).
  • src/web/client.ts + src/web/i18n.ts — the web-report tools bucket (my fix).
  • tests/cache-seam-tools-change.test.ts (7 cases) + 4 storage-render goldens.

Verification:

  • No kernel/ or pi-subagents/ in the net diff; PR body carries no kernel-change: line → no authorization gate.
  • CI mirror cache @ 90db1deb2: 0 failed, 0 pending (27 success, 3 skipped) — fully green, all checks complete.
  • No new findings on the core feature; no open ends.

Verdict: APPROVE (recommended). Core fix correct, regression-guarded, purely diagnostic; the only addition since ddc2ca68e is master's own merge. (Formal GitHub approve is owner-only and blocked for a self-authored PR — this is the reviewer's recommendation for your final approve + merge.)


中文八问

  1. 是什么问题:cache-seam 监控只按"消息列表"指纹归因 provider 前缀断裂;Anthropic 线上前缀是 system + tools + messages,会话中途改 tools 数组会在不碰任何消息的情况下让缓存缝断在工具边界,监控却把它误归到顺带的消息级分叉(client [Enhancement][cache-ledger] attribute client-side mid-history insertions to a client bucket — seam forensics currently blame bili for host churn (found in #2997) #3023 或未知 seam),掩盖了 pi native: bili's tools join the request only from the 2nd request, so each pi session re-writes ~20k cache tokens once #5459 的真正根因。
  2. 什么原因导致:detectSeam 的指纹维度缺一维——只看 messages,看不见 tools 数组。
  3. 影响范围与严重程度:仅诊断/报告面(/acp-cache 文本 + web 报告),无可用性影响;触发条件低频(会话中途变工具集)。纯误归属,p3。
  4. 怎么修复:在两个发送咽喉点(src/server/relay.ts、src/loop/core.ts)对完整解析体补采 per-entry 工具指纹(toolsArrayFps),detectSeam 加一条先于消息臂运行的 tools 臂,prev/cur 工具表不同就把残差计入新 prov:"tools" 桶并点名 appeared/disappeared/redefined/reordered;稳定/缺失/无 tools 全部 fail-soft 落回旧臂。
  5. 是否有回归问题:核心功能与已批准版本一致,无回归。高危模式逐项过:无语义漂移、无吞错、阈值/时序/输出格式不变。本轮新增的仅是 master 合并(6453feeeb),为 master 自身变更、非本 PR 贡献;net diff 仍为干净的 10 文件工具特性。
  6. 是否破坏缓存:不涉及(detectSeam 只读账本做归因,不改任何缓存/重试/去重)。
  7. 是否改了设计方向:不变(仍是账本诊断归属面,加一个桶)。
  8. 是否引入新配置:无(无新 env/config/默认值)。

收工:head 90db1deb2,核心 cache-seam 功能与已批准版本一致(net diff 即 10 文件工具特性);本轮新增为 master 合并(master 自身变更)。无 kernel 改动、无新发现、无 open ends,CI 全绿(0 失败 / 0 待跑)。建议 owner 批准并合并。

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

bug Something isn't working p3 pi scope/ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cache-seam monitor blames the client when the prefix break is a tools-array change (messages-only comparison)

1 participant