fix: 修复记忆模块误写入与错误分类问题#55
Merged
minorcell merged 3 commits into1024XEngineer:mainfrom Mar 25, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
minorcell
reviewed
Mar 25, 2026
Comment on lines
493
to
497
| hasQuestionIntent := containsAnyFold(trimmedUser, | ||
| "什么", "干嘛", "作用", "怎么", "如何", "why", "where", "which", "负责", "在哪", "含义", "区别") | ||
| hasExplanation := containsAnyFold(trimmedReply, | ||
| "用于", "负责", "位于", "表示", "通过", "调用", "读取", "写入", "返回", "实现", "处理", "对应", "配置", "路径", "字段", "参数") | ||
|
|
Comment on lines
506
to
509
| if !containsAnyFold(trimmed, "默认", "始终", "以后", "统一", "不要自动", "回答中文", "只用", "只使用", "只需要", "不要再", "固定", "长期") { | ||
| return false | ||
| } | ||
| return containsAnyFold(trimmed, "config.yaml", ".env", "中文", "提交", "命令", "风格", "配置") |
Comment on lines
+546
to
+559
|
|
||
| func hasProjectRuleAnchor(text string) bool { | ||
| return containsAnyFold(text, | ||
| "config.yaml", "readme", "go test", "go build", | ||
| "cmd/", "internal/", "configs/", "services/", "memory/", "main.go", | ||
| "data/", "workspace", "工作区", "根目录", "主配置文件", "文件", "路径") | ||
| } | ||
|
|
||
| func hasProjectRuleSignal(text string) bool { | ||
| return containsAnyFold(text, | ||
| "项目", "仓库", "约定", "配置", "结构", "目录", "命令", | ||
| "默认", "统一", "必须", "需要", "测试命令", "构建命令") | ||
| } | ||
|
|
Collaborator
|
@Yumiue 先合并了,记忆模块的设计你可以看看我给你们发的。这里的问题可以在后续的PR解决,你们可以先记录一个 issue。 |
phantom5099
added a commit
that referenced
this pull request
Apr 23, 2026
fix(runtime): reconcile partial usage observation
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.
背景
当前记忆模块存在两类问题,导致“记忆似乎失效”:
project_rule,造成长期记忆污染。这会影响后续记忆召回质量,让记忆统计和实际行为看起来不一致。
变更内容
project_rule的判定条件,避免把普通用户偏好误存为项目规则userInput和assistantReply,避免只写入摘要,提升后续召回质量影响范围
测试
已执行:
go test ./internal/server/service -run TestMemoryService -vgo test ./...备注
本次修复会阻止后续继续写入错误记忆,但不会自动清理历史脏数据。
如本地已有错误记忆,建议手动执行:
/clear-memory confirm