Repository navigation
session identity: tool-prompt neutralization (#2917) + order-primary resolution (#2944) - #2942
ranxianglei wants to merge 6 commits into
Conversation
The dsh host renders the plugin manifest's tool descriptions into the main system message, so the persona fingerprint keyed on strings bili itself controls. Two ambient events forked the main lane off the raw key (zero-fold ghost session, folds unreachable, preflight unfold dies): - a bili upgrade that rewords a tool description (kernel 540f440, compress 55473->55496 chars; #2917 restart race: old prompt claimed, new prompt forked |sub:<fp>, 14MB unfold 502'd in preflight) - a user installing a plugin mid-session (new tool lines) Tool prompts are ambient configuration, not conversation identity (owner rule 2026-10-12): neutralizeToolPrompts drops every system line containing a request-declared tool description before fingerprinting, anchor storage, and the #2601 model-drift line-diff. Line granularity so the tool-name remnant disappears (a plugin install must MATCH, not migrate). Wrapped renders fail containment and stay conservative. A real persona edit (AGENTS.md) and the review persona still fork; #2601 absorption now survives a simultaneous tool rewrite. AGENTS.md 2.11 records the principle.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3321-pr.2942.3b95d5eThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2942.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review 完成(PR Review 规范 ①–⑤ 全过 + 本地定向验证)。结论:方向正确、实现过关、未发现回归;CI 唯一红灯是与本 diff 无关的时序 flake,建议重跑该 job 后合并。本 PR 触及 session 绑定逻辑(§7.4 human 领地),合并留给你。 ① 原 issue(方向关)#2917 取证成立(kernel 540f440 改写 compress 工具描述 55473→55496 字符;重启竞态:旧提示词先 claim raw id,0.35s 后新文本到达 → fp 失配 → 零折叠 ② 回归审查(既有行为逐项)
残留(轻微,无需处置):fp 公式输入变化意味着存量 system 含工具行的 ③ 代码审查
④ 测试有效性新 7 项断言有牙( ⑤ diff 整洁度单 commit,4 文件 +209/-6,每行都和本 PR 目的相关。AGENTS.md KDD #11 为 owner rule 文本(2026-10-12);与未合并 #2939 的 #11 编号一次性冲突,按合并顺序解决,PR 正文已注明。 CIhead 结构化八问
判定:代码与测试就绪;重跑 windows-24 test job 转绿后即可合并(合并留给你——session 绑定逻辑属 human 领地)。 |
The four handle.ts call sites pass parsed.tools as an OPTIONAL positional arg into personaNamespace() — dropping it compiles clean and every unit test stays green, silently disabling the neutralization for that lane. This e2e drives real requests through startServer on the dsh/openai lane with a DISCONTINUOUS history between claim and rewrite, so only the MATCH rung can keep the raw key (the migrate rung cannot rescue broken wiring). Negative control: a real persona edit in the same shape still forks. Fixture note: each request carries a host action tool alongside the ACP tool — a bili-tools-only declaration is demoted via #1897 (leaked-tools side passthrough) before persona resolution runs.
…2944) src/session-resolve.ts implements the #2944 rule ALONGSIDE persona-anchor.ts (no deletion, no server switch-over): a client-minted unambiguous id plus an intact order skeleton (content-blind per-position kind sequence) claims the same session - 50% mid-conversation content churn cannot fork the main lane. Shallow traffic (no assistant turns) is always derived (|sub:aux, #1916 race dead); head truncation re-anchors; deep strangers park at |sub:task. tests/issue2944-session-resolve.test.ts pins BOTH implementations with the same corpus: the old fp ladder is characterized FIRST (charting pins), the new resolver runs the same inputs, designed divergences documented per row. Special proofs: P1 50% churn same order+length -> same session; P2 review blob never claims raw; P3 truncated head -> raw + re-anchor; P5 deep main-shaped stranger -> derived-task. AGENTS.md Key Design Decision #12.
…corpus The unused-exports gate failed on orderKindOf / SessionOrderResolution / sessionOrderSkeletonOf — all three exist for the test + switch-over diagnostic surface, so make the corpus consume them instead of waiving: direct orderKindOf assertions (incl. the OpenAI tool_calls/tool_call_id wire shape) replace the local shim, skeleton bookkeeping is pinned after continue/reanchor/claim, and a resolution result carries the exported type. No source change.
|
设计大改 重新审查 非常谨慎的深入审查 |
[bot] 🏷 按「设计大改、非常谨慎的深入审查」要求做了独立复审——不复用前轮结论:重新拉分支逐行读了新模块全文 + 差分 corpus 全文 + 新增 e2e wiring 测试全文,本地跑了 typecheck + 全部 12 个 persona 相关套件,CI 逐格核对,并查证了 #2939 的真实状态(查出一个文档事实错误,已顺手修掉)。 验收形态核对(对照 #2944 issue 四条实施约束)
独立验证证据
测试有效性(质量关)新增 openai-lane e2e wiring 测试是真测试:hermetic rig(真实 结构化八问
深入审查发现(切换前 checklist,均不阻塞本 PR)
顺手修复(2 个独立标注 commit,已推 PR 分支,head
|
Two stages of the same campaign — 会话身份不读表示 (session identity never keys on representation). Tracked by #2944. Closes #2917.
Stage 1 — persona fp ignores tool prompts (#2917)
neutralizeToolPrompts(src/persona-anchor.ts) drops every system line containing a request-declared tool description (≥16 chars, line granularity) before fingerprinting, anchor storage, and #2601 line-diff. bili's own upgrade rewording the compress description (55473→55496 chars) forked|sub:<fp>ledgers with zero folds and a 14MB unfold died in preflight; plugin installs mid-session did the same by ADDING lines. All four persona call sites (anthropic :819, openai :829, responses-dsh :851, instructions lane :888) now passbody.tools.Stage 2 — order-primary session resolution (#2944, NEW FILE, not switched in)
Owner rule 2026-10-12: 顺序+自铸 id 即可认领同一会话,hash 只是护栏.
src/session-resolve.tsimplements it ALONGSIDE persona-anchor.ts — old file NOT deleted, server NOT switched over:|sub:aux(并发同 session-id 流互相覆盖 lastInputTokens 基线:#388 侧请求分类漏掉「整段上下文单消息」形态,#1595 re-anchor 放大覆盖 #1916 restart race dead); deep main-shaped stranger under the same id ⇒|sub:task.瞄点 + differential pin (owner constraint)
tests/issue2944-session-resolve.test.tsruns the SAME corpus through BOTH implementations: the old fp ladder is characterized FIRST (growth=match, drift+chain=migrate, review fork|sub:fp, fp-equal rescue, 50%-churn invisible to fp), then the new resolver over identical inputs. Behavior-compatible rows share one expectation; designed divergences old→new documented per row. Special proofs: P1 (50% churn ⇒ same session), P2 (blob never claims raw, before or after main claim), P3 (truncated head ⇒ raw+reanchor), P5 (deep stranger ⇒ derived-task).Rollout per #2944: switch-over in a follow-up small step after this corpus soaks — this PR changes ZERO server behavior (new file + tests only, stage 1 is the wired part).
AGENTS.md