Repository navigation
[PR] fix: gate identity-orphan on a unique full-prefix replay | 修复 identity-orphan 对共享开场白匿名请求的误报 - #4279
Closed
yanhuojiyusheng wants to merge 1 commit into
Conversation
- prefix-affinity.ts: orphanSuspect 候选必须 identified、depth >= MIN_RESUME_PREFIX(8)、在候选自身 hash domain(hv2 neutral / hv1 raw) 下累积前缀链 hash 一致、深度在 ALIGN_TAIL_APPEND_MAX(64) 内,且唯一;出现第二个候选不记录。移除只比较 normalized tail fingerprint 的旧判定。 - server/handle.ts: identity-orphan 事件与 warn 日志改为 verified full history prefix / possible identity loss; original session state retained,删除 client identity lost 与 fold continuity lost 的断言。 - conflict-watch.ts: identity-orphan 建议改为匿名重放线索,不再断定原客户端停用原 ID 或压缩连续性已断。 - tests: 共享开场白(你好/你是谁/你好啊?/长公共指令)、不同前文同末句、depth 7 边界与 8 通过、多候选歧义、legacy hv1 raw 域、跨协议重序列化、mock proxy 主→辅助→主无告警且原 ID 可继续、完整匿名重放仍记录。 Fixes ranxianglei#4278
Owner
|
(ai: zhipuai-lb/glm-5.3) 已并入合并列车 #4525(master 6d7c587,合并方式 merge commit,提交保留原作者署名)。本 PR 关单收尾;若列车中对应提交出问题,回滚点为 #4525 单提交 revert。 感谢 @yanhuojiyusheng 的贡献——你的提交以原作者署名随列车进入 master(合并方式为 merge commit),仓库贡献者列表可见。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4278.
问题与根因
Hermes 车道出现 identity-orphan 误报(0.1.204,
9c94476f-dirty):插件主请求正常进行,一个约 1.3 KiB、ua="hermes-agent"、无 bili 插件头的匿名 openai 请求在主回合结束约 0.1 秒后到达(task=标题生成的辅助请求机制完全吻合,但日志无 task/system 字段,未坐实),用户内容是「你好」「你是谁」这类开场白,随后原会话被记为 identity-orphan。根因在诊断判定本身:
orphanSuspect只比较候选深度位置上的 normalized tail fingerprint:不验证完整前缀、不要求候选唯一,不同会话同开场白甚至只有末句相同都会命中。24的下限是序列化字符串长度,{"content":"你好","role":"user"}已 30 字节;legacyMIN_NORM_LEAF_LEN = 32不约束 neutral 路径。client identity lost; their fold ledgers are now orphaned。而真实日志显示原会话告警后仍以原 conversation id 正常继续。方案
只收紧诊断,不动 resolution/adoption(#1486 保持不变,仍然新 mint
pfa-*):orphanSuspect候选必须同时满足:depth >= MIN_RESUME_PREFIX (8)(复用 resume 证据下限常量);chainHashes逐步累积,hashes[depth-1] === entry.tailHash等价于前缀逐字节一致》;ALIGN_TAIL_APPEND_MAX = 64)内;取舍(诚实边界)
门槛提高后是保守漏报:不足 8 个中性轮次、前缀被改写、或匿名请求追加超过 64 turn 的真实身份丢失不再产生该诊断。只影响诊断覆盖面,不影响请求路由与状态恢复。
不采用
验证
基于
94f75cce(当前 upstream/master)验证,提交为4b7d5cf:npm run typecheck、npm run build、git diff --check通过。