[codex] 修复角色评论回复归属#81
Merged
utopiafar merged 1 commit intoMay 15, 2026
Merged
Conversation
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.
背景
修复 #78。用户回复某个角色评论后,后续角色自动回复有概率显示成“角色回复自己”。
关联:Fixes #78
根因
用户评论会正确保存
reply_to_id,但process_ai_reply任务没有把“本次用户评论 id”固定传给SaveComment工具。评论 agent 只能从已有评论上下文里看到用户是在回复某个角色评论,因此模型可能把 AI 回复的reply_to_id也填成那条原始角色评论 id,最终 UI 展示成同一个角色指向自己。改动
forcedReplyToId。CommentToolFactory单元测试,覆盖固定回复目标、空目标归一化、保留角色间回复目标等场景。验证
flutter pub get --offlinedart format --set-exit-if-changed lib/agent/skills/comment_agent/tools/comment_tools.dart lib/agent/skills/character_tools_factory.dart lib/agent/skills/comment_agent/comment_agent_skill.dart lib/agent/comment_agent/comment_agent.dart lib/data/repositories/post_comment.dart test/agent/comment_tool_factory_test.dartflutter test --no-pub test/agent/comment_tool_factory_test.dartflutter analyze --no-pub lib/agent/skills/comment_agent/tools/comment_tools.dart lib/agent/skills/character_tools_factory.dart lib/agent/skills/comment_agent/comment_agent_skill.dart lib/agent/comment_agent/comment_agent.dart lib/data/repositories/post_comment.dart test/agent/comment_tool_factory_test.dartgit diff --check upstream/main...HEAD