Repository navigation
[PR] feat(fastpath): v5 identity-based hit criteria (only sessionid+msgid; count/bytes demoted to diagnostics) — per owner ru | feat(fastpath): v5 身份制命中判据(只看 sessionid+msgid,count/字节降级为诊断)— 按 owner ruling 2026-11-03 - #5577
ranxianglei wants to merge 2 commits into
Conversation
…026-11-03 Owner directive (issue #5571 thread): drop byte-stability from the hit gate; verify on sessionid + msgid only, count stays diagnostic (already so since v4). - Head element loop: under a shape-valid host msgid list, id/byte inequality demotes to a diagnostic warn stream (feeds M3 re-seeding signals); pure-count clients keep the pre-v5 byte gate unchanged (their ids carry no proof). - Session continuity gate: new state field cs (h8 digest of the client-native session header: wb x-conversation-id / cc x-claude-code-session-id / opencode x-session-affinity); an identity swap riding one bili session is a sess-change miss; recorded identity follows the traffic, swaps always cost a legacy pass. readSaved whitelist extended for cs. - System text has no msgid (flagged deviation in the ruling): head-drift stays gating in both modes.
ranxianglei
left a comment
There was a problem hiding this comment.
自审(评审人=作者本人,小改动按常设规则直接提交):
结论:可合并。 要点核对:
- 闸门顺序正确:sess-change 放在 shape/prevId 之后、multimodal/fragment 解析之前(fail-fast),且仅 id 模式(形状有效列表在场)生效。
readSaved白名单对cs要求恰 8 位 hex,失配即重建——与本模块防御风格一致;cs 只存 sha1[:8] 摘要,无隐私面。本字段曾遗漏导致闸门静默失效,已补并有回归测试钉死(sess-change 三个断言)。- 会话头字面量三处复制(#3482 先例,#5573 profiles 表为规范源)——#5573 合并后可做去重重构,不阻塞本 PR。
- 需 owner 知悉的两处语义(PR body 已标):① system 文本无 msgid → head-drift 两侧仍挡命中(flagged deviation,可否决);② id 模式下 head 被宿主就地改写会以 stash 前缀核骑乘出站,靠 warn 流兜底,M3 可升级为智能重播种。
- count 模式逐字节行为不变:既有 in-place-edit 回归测试未动、通过;122/122 + tsc 0。
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.7953-pr.5577.e1c81bcThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5577.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。全仓 open/closed 检索 watermark/fastpath 仅命中 #5573(本 PR 正文点名的姊妹「身份采集层」设计 PR,正文明确二者独立、任意顺序可合);无并列/竞争的同 v5 判据改动。#5571(ruling 讨论)、#5403/#5418(前序 v3/v4)、#3482(header 字面量复制先例)均为背景引用,非重复项。 标签: 审核结论(八问)一句人话先行:这个 PR 把你 2026-11-03 的裁决忠实落地了——id 模式下头部逐元素 id/字节比对降级为诊断、新增会话身份连续性闸门;count 模式逐字节行为不变。代码我逐行读完、三个新测试在 CI 里确实过了。唯一拦路的是 CI 现在红,但红的不是这个 diff(见末节)。
CI 状态(必须说清)PR head 当前红: 判定代码层面可合——忠实落地你的裁决,两处理性偏差均已报备,回归清点干净,count 模式零影响,三个新测试有牙且 CI 通过。合并前置:CI 转绿(当前红不可归因于本 diff,走 #4599 重跑/ci-fixes 即可)。green 后建议直接合。长期盯一项:M3 智能重播种是「头部就地改写骑乘」这条 trade-off 的安全网,warn 流已就位但尚无消费者,别让 M3 悬空。 |
Gate Test Discipline (#3617): every gate ships both directions. The new sess-change gate only had its positive row (swap -> miss); this adds the negative row: a session id first seen after an unrecorded seed turn, and a follow-up that drops the header, must both stay hits, not spurious identity events.
|
按 owner 指示并入 #5576(cherry-pick 于含 owner 打磨提交的最终谱系之上 = dd20ffb4,零冲突,合流后全套件 131/131 + tsc 0),本 PR 关闭。 |
现象 / 背景
owner 裁决(#5571 讨论,m02411):命中判据去掉字节级头部比对——只看 sessionid + msgid,不看字节是否稳定、不看 count。count 在 v4(owner ruling 2026-11-02)已降为诊断;本 PR 完成最后一步:头部逐元素 id/字节比对同样降级,并新增会话身份连续性闸门。
改动(src/server/fastpath.ts 单文件 + 测试,+
170/−40)watermark v5: N/M head element(s) differ ... riding ... feeds M3)。宿主就地改写 head 会以 stash 前缀核"骑乘"出站(已知后果,warn 流供 M3 智能重播种使用)。纯 count 客户端无任何身份可凭——行为与 v5 前逐字节一致。cs(客户端原生会话头 h8=sha1[:8] 摘要,只存摘要不落原文,隐私口径对齐 [PR] feat(obs): M1 Native Identity Observation Layer — Convert the #5571 collection table from static forensics to live measu | feat(obs): M1 原生身份观测层 — 把 #5571 采集表从静态取证变成实测数据(默认关) #5573):wbx-conversation-id/ ccx-claude-code-session-id/ opencodex-session-affinity(字面量按 lane 统一决策点收尾:还剩四处按客户端名字自算的旁路要搬进来(#3417 待做) #3482 先例在本模块内复制,[Design] Client-Native Unified Identity Layer for Session/MsgID (Identity Collection Table + Incremental Parsing Refacto | [设计] 客户端原生的 session/msgid 统一身份层(身份采集表 + 增量解析重构) #5571 的 profiles 表是规范源)。种子轮记录过身份后,当前请求身份必须同值,否则miss("sess-change")走 legacy;任一侧无值则不主张、不误伤。语义:记录的跟随流量走——换会话的后续增长可以骑乘,原会话回来再付一次 legacy(无跨交换静默骑乘)。readSaved白名单已同步放行cs(漏了它闸门永不生效,本 PR 内发现并修)。head-drift两侧模式都继续挡命中(credited miss,自修复)——宁可多解析一次,不把过期 system prompt 发出去。此点在 ruling 线程中单独报备,可否决。不变量
宽度算术仍服务端重建(K 取自 ledger stampT,永不吃 echo);prevId 链、shape、模型匹配、breaker、零增量 no-progress 全部原样;count 模式逐字节行为不变(既有 in-place-edit 回归测试未动且通过)。
验证
tsc 0 error;tests/fastpath.test.ts 24/24(含 3 个新 v5 测试:骑乘+warn、system 仍挡【钉死偏差】、sess 换回语义)、issue5403-watermark-fastpath 与 lane-decisions-matrix 合计 122/122。
依赖关系
独立于 #5573(observation layer):会话头字面量有意复制而非 import,两个 PR 任意顺序合并均可;合并 #5573 后可选做去重重构。