Repository navigation
[PR] fix: recognize CodeBuddy/WorkBuddy x-conversation-id as stable session identity (#5488) - #5526
ranxianglei wants to merge 5 commits into
Conversation
…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.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9053-pr.5526.a34f86cThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5526.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 查重: 不重复。open/closed issue 与近期 PR 中无同症状(宿主自动压缩后 fork 匿名会话 → EMERGENCY fold 双压缩循环)或同机制( 标签: bug / codebuddy(现建)/ scope/wiring(请求边界 header 识别属协议接线)/ p1(每次宿主压缩丢 baseline + EMERGENCY fold 风暴 + cacheHitPct≈1 成本失控,属会话状态丢失/缓存泄露类,按 owner 修订不降 p2)。 这是带 |
…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.
(ai: qwen/qwen3.8-27b) Review 完成 — 结论:可合并(session-identity 逻辑,§7.4 human-gated,请 owner 手动 merge: #5526) 结构化八问
验证
Review 期间补了一个 commitREADME(en+zh)「How sessions work」里的通用 header 枚举漏了这次新增的名字(stale),已同步: 收工判定:可合并——单数组扩展 + 回归测试,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)
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 冲突已解 + CI 全绿,新 head 关键发现:master 已经独立落地了同一个修复分支落后 master 939 个提交;唯一的冲突文件 按 union-of-intent 解冲突:该 hunk 整段取 master 侧(功能等价 + 注释更新)。于是本 PR 相对 master 的净 diff 收敛为两件 #5825 没做的事:
单红定性:已知 load-starvation flake,与本 PR 无关run 42927584531 唯一失败 结构化八问
收工判定:可合并——冲突清零、checks 全绿、diff 收敛干净;鉴于功能本体已由 #5825 先行落地,若 owner 觉得剩余测试+文档增量不值得单独占一个 PR,close 也是合理处置,二选一均可。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 陈旧告警确认:本轮实读核验(非引用旧评论)——PR head |
… 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
left a comment
There was a problem hiding this comment.
(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.
[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:
已顺手修:README en/zh per-client header enumeration omitted Local-verification note: workdir node_modules is empty; running the targeted suites locally would require a full 八问:
判定:APPROVE,合并等待人工(§7.4:session-identity 逻辑属人工门禁)。 |
|
这个问题master是否存在 |
What & why
CodeBuddy / WorkBuddy stamp their per-conversation UUID in the
x-conversation-idheader 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-idto 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-code2.177.1,@genie/agent-cli2.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)
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;
sessionHeaderremains 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