fix(channels): 群聊止血——企微 is_group 以 chattype 为准,群记忆红线(不写不读) - #52
Open
tianling536 wants to merge 1 commit into
Open
fix(channels): 群聊止血——企微 is_group 以 chattype 为准,群记忆红线(不写不读)#52tianling536 wants to merge 1 commit into
tianling536 wants to merge 1 commit into
Conversation
群聊+多员工+分工系列的第 1 个 PR(止血包): - 企微 is_group 改以 chattype 为准:chattype=group 缺 chatid 的异常帧 记 warning 后丢弃,不再降级混入成员私聊会话;single 带 chatid 不再误判为群 - 群记忆红线:群聊会话不写记忆(memory job 直接跳过)、不检索个人记忆 (agent_loop 两处 context_memories 调用点跳过)——成员私人偏好绝不会 混入群账号或被念给群里其他人 - 新增 is_group_conv_id(channel, conv_id) 判定(兼容无 scope/带 scope/ 成员级 #member 三种格式),并修复会话列表漏判带 scope 企微群的既有瑕疵 测试:企微缺 chatid 丢弃+single 带 chatid 按私聊、helper 三种格式、 群会话 capture 跳过/私聊不受影响;全量 1205 passed、ruff 零告警
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.
概述
「群聊 + 多数字员工沟通 + 分工」系列的第 1 个 PR(止血包),先拆掉两个上线即炸的雷,后续 PR(成员级群聊/转派/分工编排)以此为基。
问题
wecom.py):chattype=group但缺chatid的异常帧被静默降级为私聊,真实群消息混入该成员的 p2p 会话(回复还会私聊发出);is_group仅看chatid存在性,chattype=single却带chatid的帧会被误判为群。修复
is_group以chattype为准:缺chatid的群帧记 warning 后丢弃(无法构成稳定群会话,绝不降级混入私聊);single带chatid按私聊处理(session_id/group_id/context_token同步按 is_group 归位)。memory/jobs.py后台任务拿到会话后,群会话直接跳过(零 LLM 开销,单一入口覆盖全部触发路径);agent_loop.py两处context_memories调用点,群会话跳过检索——成员私人偏好绝不会在群里被念出来;is_group_conv_id(channel, conv_id):兼容无 scope(wechat_group_x)、带 scope(wecom_{corp}_group_x)、成员级(...#member,为后续 PR 预留)三种格式;并顺带修复会话列表接口漏判带 scope 企微群(is_group一直为 False)的既有瑕疵。测试
chatid群帧→None+warning;single 带chatid→私聊(新行为固化);is_group_conv_id:三种群格式判真、私聊/跨渠道不误判;test_verification_runs_bounded_text_stream_and_json_probes,与本 PR 无关)。兼容性