Skip to content

[PR] fix: recognize CodeBuddy/WorkBuddy x-conversation-id as stable session identity (#5488) - #5526

Open
ranxianglei wants to merge 5 commits into
masterfrom
2026-11-02_codebuddy-x-conversation-id
Open

ranxianglei wants to merge 5 commits into
masterfrom
2026-11-02_codebuddy-x-conversation-id

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What & why

CodeBuddy / WorkBuddy stamp their per-conversation UUID in the x-conversation-id header on every model request, but that header was missing from bili's session-identity recognition list (conversationHeaderSource, src/session-id.ts). Such requests fell through to content-prefix affinity, which is head-anchored only: when the host auto-compacts it rewrites the first message into a <system-reminder data-role="compact-summary">, the head match misses, and bili forks a brand-new anonymous session for every compaction. The fresh session has no usage baseline, so the kernel's first-sight mass path arms an EMERGENCY fold at zero growth, folds for minutes, and still forwards a payload above the host trigger — which makes the host compact again. A self-sustaining two-compactor loop (#5488).

This adds x-conversation-id to the candidate list, ranked in the low-trust generic tier below the client-specific headers (the name is generic-sounding, so it must never outrank claude/grok/mavis/opencode/acp signals). With a stable id, the session is no longer "fresh" after a host compaction, so the first-sight mass path stops being reachable from host compaction.

Verified by the reporter via dynamic capture (@tencent-ai/codebuddy-code 2.177.1, @genie/agent-cli 2.165.0): the id is present on 100% of requests and is a single stable value across the whole transcript including the host-compaction event.

Behavior change (flagged)

  • CodeBuddy / WorkBuddy proxy-mode users: previously every host auto-compaction forked a new anonymous session (baseline lost, EMERGENCY fold, cacheHitPct ~1). Now the stable conversation id is honored, so one session persists across host compactions and the usage baseline / fold state carry over. This is the intended fix.
  • All other clients: no-op. No existing client sends x-conversation-id; and because it ranks below every client-specific header, even a hypothetical client sending both keeps its specific id winning.

Scope / review note

Single-module, single-array change plus a regression test. It touches session-identity logic, which is human-gated (§7.4) — please review rather than auto-merge. No config surface added (extends the existing recognition list; sessionHeader remains the manual escape hatch). No version bump.

Validation

Targeted suites green locally on the rebased head: tests/proxy-session-id.test.ts, tests/responses-instructions-drift.test.ts, tests/plugin-protocol.test.ts (54 pass). Full-suite verdict left to CI.

Honest gap: the reporter's probes used tiny payloads, so this does not hermetically reproduce that a full-length session avoids the ~380s EMERGENCY preflight end-to-end. That path is gated on baseline === 0 (kernel/src/compress.ts) and becomes unreachable once the id is stable, but a real CodeBuddy/WorkBuddy long-session run through a patched build would confirm it.

Immediate stopgap for affected users (no update required): set "sessionHeader": "x-conversation-id" in ~/.config/billion-context/billion-context.json.

Closes #5488

…n identity (#5488)

CodeBuddy / WorkBuddy stamp their per-conversation UUID in x-conversation-id on every model request, but that header was absent from bili's recognition list, so requests fell through to prefix-affinity. When the host auto-compacts it rewrites the first message's content (a compact-summary); head-anchored matching then misses and bili forks a fresh anonymous session per compaction, losing the usage baseline and arming a first-sight EMERGENCY fold at zero growth, then forwarding a payload still above the host trigger: a self-sustaining two-compactor loop (#5488).

Add x-conversation-id to conversationHeaderSource's candidate list, ranked in the low-trust generic tier below the client-specific headers (the name is generic-sounding, so it must not outrank them). With a stable id the session is no longer 'fresh' after host compaction, so the first-sight mass path stops being reachable from it.

Regression test pins recognition plus the rank boundaries above and below.
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-02_codebuddy-x-conversation-id (5d245aa)

Latest build — install this exact version

npm install -g billion-context@0.0.9053-pr.5526.a34f86c

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
5d245aa billion-context@0.0.9053-pr.5526.a34f86c build
55f3153 billion-context@0.0.9023-pr.5526.9511c18 build
d0828b9 billion-context@0.0.7852-pr.5526.f017abf build
57c0f1b billion-context@0.0.7850-pr.5526.3b99cd3 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix: recognize CodeBuddy/WorkBuddy x-conversation-id as stable session identity (#5488) [PR] fix: recognize CodeBuddy/WorkBuddy x-conversation-id as stable session identity (#5488) Nov 2, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复。open/closed issue 与近期 PR 中无同症状(宿主自动压缩后 fork 匿名会话 → EMERGENCY fold 双压缩循环)或同机制(conversationHeaderSource 缺 x-conversation-id)的条目;本 PR 即 #5488 的修复本体。

标签: bug / codebuddy(现建)/ scope/wiring(请求边界 header 识别属协议接线)/ p1(每次宿主压缩丢 baseline + EMERGENCY fold 风暴 + cacheHitPct≈1 成本失控,属会话状态丢失/缓存泄露类,按 owner 修订不降 p2)。

这是带 ework-agent-pr 标记的已完成工作,我不重做,走 review 流程:核对分支代码、跑定向测试、查 CI。初审印象:单 commit、2 文件(+26/-1),x-conversation-id 插入 src/session-id.ts 识别列表的中段(低于全部客户端专属 header、高于裸 generic 名),排序方向与信任分层一致。已确认 lane-decisions 注册表(claude/codex profile 匹配)不受新 source name 影响、上游转发路径不会因此新增外发 header。完整八问结论随后补上。

…lks (en+zh)

The recognition-list change in this PR made the README's generic-header
enumeration (How sessions work, en+zh) stale; sync both to the new order.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Review 完成 — 结论:可合并(session-identity 逻辑,§7.4 human-gated,请 owner 手动 merge: #5526)

结构化八问

  1. 是什么问题:CodeBuddy/WorkBuddy 用户每次宿主自动压缩后,bili 都会 fork 一个全新匿名会话——压缩基线丢失、触发零增长 EMERGENCY 折叠风暴、cacheHitPct≈1,且宿主看到 payload 仍超阈值会继续压缩,形成自维持的双压缩循环(Two independent compactors fight each other: host-side kernel compaction spawns a fresh anonymous session inside bili, which then EMERGENCY-folds every turn and forwards a payload still above the host trigger — a self-sustaining loop #5488)。
  2. 什么原因导致的:这两家客户端每个请求都带稳定的 x-conversation-id,但 bili 的会话身份识别列表(conversationHeaderSource)没有它 → 请求落到内容前缀亲和(只锚定头部)→ 宿主把首条消息改写成 compact-summary 后头部匹配失败 → 匿名 fork。修在决策点(识别列表),不是去堵 kernel 首见路径或亲和匹配,方向正确。
  3. 影响范围与严重程度:仅 proxy 模式、开了宿主自动压缩的 CodeBuddy/WorkBuddy 长会话用户;严重度高——基线反复丢失 + EMERGENCY 折叠风暴 + 缓存命中≈1 的成本爆炸,属会话状态丢失/缓存泄露类,定 p1。
  4. 怎么修复的:把 x-conversation-id 加进识别列表,排在低信任通用层——低于所有客户端专属 header(claude/grok/mavis/opencode)和 x-session-affinity/x-acp-session,高于裸通用名(x-session-id 等);名字听起来太泛所以绝不能压过专属信号。id 稳定后会话不再"fresh",基线与折叠状态跨宿主压缩延续。
  5. 是否有回归问题:未发现,逐项清点过既有行为:
    • 优先级:任何假设中同时发专属 header + x-conversation-id 的客户端,专属 id 仍然赢;仓库 grep 确认无现有客户端发这个 header;
    • lane-decisions profile 注册表(src/server/lane-decisions.ts:102-125):codex 条目按 turn-metadata/UA 匹配、claude-responses 按 x-claude-code-session-id 匹配——CodeBuddy 流量修前(undefined)修后("x-conversation-id")都解析为 ANONYMOUS,无 profile 翻转;
    • 上游转发(src/server.ts:2850):x-session-id stamp 仅在 !convSource || bili-internal 时发生——修前 affinity 本就 undefined 不 stamp,修后 convSource 存在也不 stamp,id 依旧从不出现在 bili↔模型线上(不变量保持);
    • pck stamp(resolveRelayAffinityPck):只对 x-bili-plugin-conversation stamp,不受影响;
    • claude transcript lineage resume(handle.ts:1645):门控 claude header,不受影响;plugin 车道 x-bili-plugin-conversation 最优先,CodeBuddy 不发 plugin marker,不受影响;
    • 行为变更(PR 已披露):CodeBuddy/WorkBuddy proxy 模式——旧:每次宿主压缩 fork 新会话;新:同一会话跨压缩存活,基线/fold 状态延续。其他客户端 no-op。
  6. 是否破坏缓存:不破坏,恰恰相反——修复目的就是把 cacheHitPct≈1 拉回正常水平。识别列表本身不碰缓存失效策略;这类客户端的 session key 从 pfa-…/匿名切到客户端自己的 id,是有意的切换。
  7. 是否改了设计方向:没有。是现有「客户端声明的 id 逐字采用」身份模型的又一次证据驱动的扩展,与 claude/grok/mavis/opencode 条目同纪律(动态抓包证明存在且稳定才收录)。
  8. 是否引入了新的配置:没有。扩展既有识别列表;sessionHeader 仍是手动逃生口(也正是受影响用户今天就能用的止血手段:"sessionHeader": "x-conversation-id")。

验证

  • 本地定向套件(proxy-session-id / responses-instructions-drift / plugin-protocol)54/54 过;
  • CI 原 head(57c0f1b)47 个 check run 全绿(35 success / 12 skipped / 0 fail,ubuntu+windows × node 22/24 全 shard);
  • PR 自认的诚实缺口我认可:探针 payload 小,未端到端复现「全长会话避开 ~380s EMERGENCY preflight」——该路径门控在 kernel/src/compress.ts 的 baseline === 0,id 稳定后结构性不可达,真实 CodeBuddy 长会话跑一遍即可最终确认,不阻塞本 PR。

Review 期间补了一个 commit

README(en+zh)「How sessions work」里的通用 header 枚举漏了这次新增的名字(stale),已同步:d0828b9d4 docs(#5488): list x-conversation-id in the session-identity header walks (en+zh),纯文档,+3/-2,CI 会重跑。

收工判定:可合并——单数组扩展 + 回归测试,diff 干净,双向断言齐全(该解析时解析、不该压过专属 header 时不压过),CI 全绿,行为变更已披露。请 owner 手动 merge。

…conflict resolution)

Union-of-intent on src/session-id.ts: master already carries the functional
change via #5825 (x-conversation-id in conversationHeaderSource at the same
low-trust position, plus agent-session-id), so the conflicted hunk takes
master's version verbatim. Net PR delta vs master reduces to:
- tests/proxy-session-id.test.ts: priority-order regression assertions
  (complements #5825's identity-harvest coverage; adds claude/x-session-id
  vs x-conversation-id cells)
- README.md / README.zh-CN.md: list x-conversation-id in the session-identity
  header walks (the enumeration was left stale by #5825)
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

冲突已解 + CI 全绿,新 head 55f315374——PR 现在 mergeable=True(mergeable_state=blocked 是合并前的人审/保护状态,非冲突),请 owner 手动 merge。本轮做了三件事:解冲突、定性并处理单红、本地验证。

关键发现:master 已经独立落地了同一个修复

分支落后 master 939 个提交;唯一的冲突文件 src/session-id.ts 打开后发现 master 侧已经带上了本 PR 的功能变更——#5825(commit 34dbcc2d0,owner-ruled 身份信道接线)把 x-conversation-id 加进了 conversationHeaderSource,位置与本 PR 选的完全一致(low-trust 层:低于全部客户端专属 header 与 affinity 层、高于裸 generic 名),还额外加了 agent-session-id(goose)和更新的证据注释(实测 2.181.0,fresh/-c/-r 跨重启稳定)。

按 union-of-intent 解冲突:该 hunk 整段取 master 侧(功能等价 + 注释更新)。于是本 PR 相对 master 的净 diff 收敛为两件 #5825 没做的事:

单红定性:已知 load-starvation flake,与本 PR 无关

run 42927584531 唯一失败 test (windows-latest, 22, 2) = tests/wire-exit-matrix.test.ts「abort x proxy-openai-sse」:closed=0、duration 21952ms(win32 base 20s+lag 耗尽)——与 #4599 floor 1213(#5897,21.3s)/floor 1206(#5401,21.7s)/floor 1144(#5901)同一签名同一 cell;本 PR 净 diff 不触碰 relay/abort/teardown 路径,同组兄弟 cell(anthropic/responses/json)毫秒级全过。按先例触发定向 rerun-failed-jobs(HTTP 201)→ attempt 2 completed/success,当前 head 全部 checks 绿(GitHub API 单次实读核验;镜像 upstream-checks 缓存对该 PR 自 00:08Z 起未刷新,已在 #4599 留两行说明)。

结构化八问

  1. 是什么问题:PR 与 master 冲突(dirty)无法合并;合并后 CI 单红一个 windows 测试分片。
  2. 什么原因导致的:①冲突 = 分支 939 个提交的漂移期间,Investigate and integrate a stable "session + message ID" identity channel on a per-client basis. Current status: only f | 逐客户端调查并接入稳定"会话+消息ID"身份信道:现状仅 dsh/omp/pi/opencode 四车道在跑,其余(codebuddy/hermes/claude/codex/zcode…)按清单逐个研究 #5825 在 master 上独立实现了同一识别逻辑,两侧在同一数组区域各写各的注释与列表;②单红 = runner 负载依赖的既有 flake(wire-exit-matrix abort x proxy-openai-sse 超时预算耗尽),非本 diff 引入。
  3. 影响范围与严重程度:合并阻塞级(PR 不能合);flake 本身无用户面影响、仅消耗一次 CI 重跑。
  4. 怎么修复的:用 merge(不 rebase,避免改写共享历史)接 master;冲突 hunk 取 master 侧(union-of-intent:Investigate and integrate a stable "session + message ID" identity channel on a per-client basis. Current status: only f | 逐客户端调查并接入稳定"会话+消息ID"身份信道:现状仅 dsh/omp/pi/opencode 四车道在跑,其余(codebuddy/hermes/claude/codex/zcode…)按清单逐个研究 #5825 的实现是本 PR 功能的超集且注释更新);净 diff 收敛为测试补强 + README 枚举修正;flake 走定向 job 重跑而非改代码。
  5. 是否有回归问题:无。合并后 src/session-id.ts 与 master 逐字节一致(零行为漂移);测试/文档纯增量;本地 typecheck 干净 + 定向 4 套件(proxy-session-id / identity-harvest / responses-instructions-drift / plugin-protocol)70/70 过;推送 head 全矩阵绿。高危模式逐项过:无语义漂移、无阈值/时序变化、无输出格式变化。
  6. 是否破坏缓存:不涉及(未触碰缓存/fold/持久化任何路径)。
  7. 是否改了设计方向:没有——反而确认 Investigate and integrate a stable "session + message ID" identity channel on a per-client basis. Current status: only f | 逐客户端调查并接入稳定"会话+消息ID"身份信道:现状仅 dsh/omp/pi/opencode 四车道在跑,其余(codebuddy/hermes/claude/codex/zcode…)按清单逐个研究 #5825 的方向(low-trust 识别 + transcript.jsonl harvest 车道)就是正主实现;本 PR 现定位为它的补充回归测试与文档枚举修正,原 issue Two independent compactors fight each other: host-side kernel compaction spawns a fresh anonymous session inside bili, which then EMERGENCY-folds every turn and forwards a payload still above the host trigger — a self-sustaining loop #5488 的双压缩循环修复本体已在 master。
  8. 是否引入了新的配置:没有。

收工判定:可合并——冲突清零、checks 全绿、diff 收敛干净;鉴于功能本体已由 #5825 先行落地,若 owner 觉得剩余测试+文档增量不值得单独占一个 PR,close 也是合理处置,二选一均可。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

陈旧告警确认:本轮实读核验(非引用旧评论)——PR head 55f315374 已包含全部 master(master 58a879622 未再前进,分支落后 0),GitHub API 实测 mergeable: true、mergeable_state=blocked(人审/保护状态,非冲突);镜像缓存刚刷新:30/30 checks 完成,27 success + 3 skipped,0 失败。冲突与红项均不存在,无需任何操作。等待 owner 手动 merge(或按我上条所述 close 二选一)。

ci-check added 2 commits November 11, 2026 11:34
The per-client enumeration omitted agent-session-id (goose lane), added to
the recognition list by the #5825 identity-channel refactor; also normalize
the line wrapping left by the x-conversation-id insertion (#5526 review).
… list

NO_IDENTITY_MESSAGE listed 7 of the 13 recognized headers (missing grok/mavis/
agent-session-id/x-conversation-id/session_id). Enumerate the authoritative
order from src/session-id.ts so the hint matches what the proxy actually
accepts (#5526 review drive-by).

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Verdict: APPROVE (posted as a comment review — GitHub forbids the approve event on this account's own PR).

Verified end-to-end:

  • Effective delta vs master is docs + regression tests only: the x-conversation-id recognition itself already landed on master via the #5825 identity-channel refactor (decision A, CHANGELOG.md:63); this branch adds the README en/zh sync and the rank-order regression test. Merge-base == master tip; the conflict merge kept both sides' list entries.
  • Rank position in the new test matches the authoritative candidate list (src/session-id.ts:96): below client-specific + affinity tier, above bare generics. Causal chain against #5488 holds in code: stable id ⇒ session not fresh ⇒ usage baseline present ⇒ kernel first-sight mass path (gated baseline === 0, kernel/src/compress.ts:2299) unreachable from host compaction ⇒ no EMERGENCY-fold loop.
  • Security posture unchanged: value is client-supplied but used as a local key only, never forwarded; untrusted generic tier ranks below client-specific headers so real clients keep winning.
  • CI green on final read (30 checks, 0 failed). One windows wire-exit-matrix abort-teardown flake on the first run (timing-sensitive assertion, sibling abort tests pass, same-tree master green, retry green) — flake, not regression.
  • Drive-by fixes pushed on this branch during review: README en/zh per-client enumeration was missing agent-session-id (pre-existing since the refactor), and the 400 NO_IDENTITY_MESSAGE hint listed 7 of 13 recognized headers — now aligned with the recognition order.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Duplicate screening: not a duplicate PR — but the code half overlaps the already-merged #5825 identity-channel refactor (decision A): x-conversation-id entering the recognition list itself already landed on master via that refactor (CHANGELOG.md:63, commit 34dbcc2, merged after this branch cut on 2026-11-02). This PR's unique contribution = README en/zh doc sync + rank-order regression test, both needed.

Verdict: APPROVE — posted as a formal GitHub review (id 5853551990; GitHub rejects the approve event on this account's own PR, so it was filed as a comment review carrying the APPROVE verdict). Merge awaits a human — session-identity logic is human-gated per §7.4 regardless.

What I verified:

  1. Effective diff vs master (git diff origin/master...head) = README.md, README.zh-CN.md, tests/proxy-session-id.test.ts (+13) only. The src/session-id.ts change is already on master via Investigate and integrate a stable "session + message ID" identity channel on a per-client basis. Current status: only f | 逐客户端调查并接入稳定"会话+消息ID"身份信道:现状仅 dsh/omp/pi/opencode 四车道在跑,其余(codebuddy/hermes/claude/codex/zcode…)按清单逐个研究 #5825; merge-base == master tip (58a8796) and the conflict merge kept both sides' list entries — nothing lost.
  2. Correctness: the new test's rank assertions match the authoritative candidate list (src/session-id.ts:96) — x-conversation-id sits below client-specific + affinity tier, above bare generics. The causal chain against Two independent compactors fight each other: host-side kernel compaction spawns a fresh anonymous session inside bili, which then EMERGENCY-folds every turn and forwards a payload still above the host trigger — a self-sustaining loop #5488 holds in code: stable id ⇒ session not fresh ⇒ usage baseline present ⇒ kernel first-sight mass path (gated baseline === 0, kernel/src/compress.ts:2299; reason string :2457) unreachable from host compaction ⇒ no EMERGENCY-fold loop.
  3. Tests have teeth: two-directional rank pins (wins vs x-session-id/session_id; loses vs x-claude-code-session-id/x-opencode-session-id/x-acp-session). Overlap with tests/identity-harvest.test.ts:337-349 is acceptable — different exported functions pinned (clientConversationHeader value wrapper vs conversationHeaderSource name).
  4. CI: final mirror read = 30 checks / 0 failed / 0 pending. First run had one windows shard-2 failure: wire-exit-matrix abort teardown (tests/wire-exit-matrix.test.ts:273 'upstream socket(s) must be destroyed', 21952ms timing-sensitive assertion; sibling abort tests pass, shard 2163 pass / 1 fail). Same-tree master green + retry green ⇒ flake, not regression.
  5. Security/trust: value is client-supplied but used as a local key only, never forwarded (docs/session-identity-resolution.md:106 posture, active for all installs); ranks below client-specific headers so real clients keep winning; KDD#9 evidence-permitlist N/A (that governs persona-fingerprint splitting, not id recognition). No new attack surface.
  6. Behavior change disclosure (flagged in the PR body; the behavior itself is already live on master via Investigate and integrate a stable "session + message ID" identity channel on a per-client basis. Current status: only f | 逐客户端调查并接入稳定"会话+消息ID"身份信道:现状仅 dsh/omp/pi/opencode 四车道在跑,其余(codebuddy/hermes/claude/codex/zcode…)按清单逐个研究 #5825 decision A): CodeBuddy/WorkBuddy proxy-mode sessions now persist across host compactions instead of forking a fresh anonymous session per compaction; all other clients are no-op. Old → new: per-compaction anonymous fork (measured cacheHitPct ~1%, 380–415s stalls/turn, Two independent compactors fight each other: host-side kernel compaction spawns a fresh anonymous session inside bili, which then EMERGENCY-folds every turn and forwards a payload still above the host trigger — a self-sustaining loop #5488) → persistent session with healthy cache continuity.

已顺手修:README en/zh per-client header enumeration omitted agent-session-id(#5825 重构引入的既有缺口)+ 规整了作者插入造成的断行 → commit 97a98a9
已顺手修:400 缺会话身份提示文案(NO_IDENTITY_MESSAGE,src/server/headers.ts:12)只列了 13 个可识别 header 中的 7 个(缺 grok/mavis/agent-session-id/x-conversation-id/session_id)→ 已对齐权威识别顺序;唯一测试钉是宽松前缀正则(tests/e2e-session-identity.test.ts:371),不受影响 → commit 5d245aa

Local-verification note: workdir node_modules is empty; running the targeted suites locally would require a full npm ci + kernel build (= effectively a local full-suite setup), which local-testing discipline forbids — skipped. My diff touches neither the test files nor any module they import (headers.ts is pinned only by the loose prefix regex, kept verbatim); the CI re-run on the new head (5d245aa) is the authoritative gate.

八问:

  1. 是什么问题:CodeBuddy/WorkBuddy 每个请求都带 x-conversation-id,bili 此前不认它为会话身份,退回前缀亲和;宿主自动压缩改写首条消息后,每次压缩都分裂出一个全新匿名会话。
  2. 什么原因导致的:根因在身份识别层——候选名单缺这个 header(不是压缩层问题);新匿名会话没有用量基线,kernel 首见大量路径(baseline===0 门)在零增长时武装 EMERGENCY fold,与宿主压缩器互相追逐成自持环(Two independent compactors fight each other: host-side kernel compaction spawns a fresh anonymous session inside bili, which then EMERGENCY-folds every turn and forwards a payload still above the host trigger — a self-sustaining loop #5488 实测:25 分钟 19 fold/3 压缩、netSaved -67127、缓存命中 1%)。
  3. 影响范围与严重程度:仅 CodeBuddy/WorkBuddy proxy-mode 用户;严重——核心压缩承诺失灵(每轮 380–415s 卡顿、缓存命中崩塌),属 p1 级体验毁灭。
  4. 怎么修复的:把 x-conversation-id 加进候选名单的低信任通用层(低于客户端专属 header、高于裸通用名)——稳定 id ⇒ 会话跨宿主压缩持久 ⇒ 基线存在 ⇒ 首见路径不可达,从源头断环(疏而非堵)。
  5. 是否有回归问题:无。其他客户端不发该 header,行为不变;客户端专属 header 优先级不受影响(测试双向钉死);文档已对齐;CI 全绿(一次 windows 时序 flake,重试即绿)。
  6. 是否破坏缓存:改善而非破坏——修复前每次宿主压缩换新会话导致前缀缓存全丢(cacheHitPct 1%);修复后会话持久,缓存连续。
  7. 是否改了设计方向:否。沿用既有「名单第一命中」机制与信任分层,只是补一个名单条目;且该条目已由 Investigate and integrate a stable "session + message ID" identity channel on a per-client basis. Current status: only f | 逐客户端调查并接入稳定"会话+消息ID"身份信道:现状仅 dsh/omp/pi/opencode 四车道在跑,其余(codebuddy/hermes/claude/codex/zcode…)按清单逐个研究 #5825 统一消费缝重构决定 A 带上 master,本 PR 剩余增量只有文档+测试。
  8. 是否引入了新的配置:否。(PR 正文提到的 sessionHeader 是既有逃生阀,非新增。)

判定:APPROVE,合并等待人工(§7.4:session-identity 逻辑属人工门禁)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

这个问题master是否存在

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

不存在(当前 master)。 刚对远端 master tip(31684f368e,ls-remote 核实)重新验证过:

  1. 根因已不在:Two independent compactors fight each other: host-side kernel compaction spawns a fresh anonymous session inside bili, which then EMERGENCY-folds every turn and forwards a payload still above the host trigger — a self-sustaining loop #5488 的根因是会话身份候选名单缺 x-conversation-id → 退回前缀亲和 → 宿主每次压缩后分裂匿名会话 → 双压缩器互追成环。当前 master 的 src/session-id.ts:96 名单里已有 x-conversation-id(低信任通用层:低于客户端专属 header、高于裸通用名),:88 有记录 CodeBuddy 用法的注释块。该条目由 Investigate and integrate a stable "session + message ID" identity channel on a per-client basis. Current status: only f | 逐客户端调查并接入稳定"会话+消息ID"身份信道:现状仅 dsh/omp/pi/opencode 四车道在跑,其余(codebuddy/hermes/claude/codex/zcode…)按清单逐个研究 #5825 身份信道重构(决定 A) 带上 master——本 PR 分支 2026-11-02 切出时它还没合入,所以 PR 里带着同样的 src 改动;Investigate and integrate a stable "session + message ID" identity channel on a per-client basis. Current status: only f | 逐客户端调查并接入稳定"会话+消息ID"身份信道:现状仅 dsh/omp/pi/opencode 四车道在跑,其余(codebuddy/hermes/claude/codex/zcode…)按清单逐个研究 #5825 合入后这部分就变成重复了。
  2. 因果链在 master 上闭环:稳定 id ⇒ 会话跨宿主压缩持久 ⇒ 用量基线存在 ⇒ kernel 首见大量路径(baseline === 0 门,kernel/src/compress.ts:2299)不可达 ⇒ 不会再出现 EMERGENCY fold 循环。
  3. master 存在过该问题的窗口:从 Two independent compactors fight each other: host-side kernel compaction spawns a fresh anonymous session inside bili, which then EMERGENCY-folds every turn and forwards a payload still above the host trigger — a self-sustaining loop #5488 提出(2026-11-02)到 Investigate and integrate a stable "session + message ID" identity channel on a per-client basis. Current status: only f | 逐客户端调查并接入稳定"会话+消息ID"身份信道:现状仅 dsh/omp/pi/opencode 四车道在跑,其余(codebuddy/hermes/claude/codex/zcode…)按清单逐个研究 #5825 合入之间。报告人实测的版本落在这个窗口内,所以他看到的是真 bug;当前 master 及之后切出的版本不再复现。

顺带勘误我上一条回复的一处引注:我写的「commit 34dbcc2」是 #5825 分支侧的设计提交,内容经 #5825 合并进入 master(master 上的合并 SHAs 不同),CHANGELOG 与 KDD #18 的引用不受影响;「内容已在 master」这一结论本身不受影响(上面是对远端 tip 的直接验证)。

结论:代码侧 master 无需再动。这个 PR 对 master 的剩余增量只有 README en/zh 文档同步 + 排序回归测试(其中 README 缺 agent-session-id、400 提示文案缺 5 个 header 两处既有缺口我已顺手修在该分支上,commit 97a98a9 / 5d245aa)。合不合由你定——合入则补上文档与测试钉;不合并的话行为修复也已在 master 生效(名字排序已有 tests/identity-harvest.test.ts:337-349 部分钉住,值级排序测试会随分支搁置)。我不自行关闭。

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

Projects

None yet

1 participant