Repository navigation
feat(convo,web): 记忆接口按登录身份限定归属 - #30
Merged
Merged
Conversation
liut
force-pushed
the
feat/memory-ownership
branch
2 times, most recently
from
October 10, 2026 11:31
0c6ea21 to
fab00e2
Compare
- 契约新增创建前/加载后/更新前/删除前钩子,创建归属登录者,越权返回 forbidden - 新增 /api/convo/memories 五个接口,越权映射 403、未找到映射 404,其余 503 - 列表按请求者收窄并补齐分页默认值,keeper 支持 ownerID 与 own 代查 - 归属原语 ErrForbidden / restrictedToOwner / ownerIDFromContext / ownerAllowed 不绑定具体模型 - 删除记忆在同一事务内清理向量,agent 召回沿用同一归属规则
liut
force-pushed
the
feat/memory-ownership
branch
from
October 11, 2026 09:04
fab00e2 to
d0732f2
Compare
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.
概述
记忆的归属规则收敛到存储层:列表经
ConvoMemorySpec.SiftX扩展点按请求者身份收窄,单条操作经契约钩子在越权时拒绝,接口层只负责把越权错误映射成 403、把未找到映射成 404。创建一律归属登录者,keeper 不受归属限制。同时交付 agent 召回越权与删除后向量残留。docs/convo.yaml)新增beforeCreating/afterLoad/beforeUpdating/beforeDeleting钩子,make codegen重新生成convo_gen.gostores.ErrForbidden、restrictedToOwner/ownerIDFromContext/ownerAllowed,以及列表收窄入口ConvoMemorySpec.applyOwnerScope/api/convo/memories五个接口,详情/更新/删除错误经failStoreErr映射 403/404/503,并同步docs/swagger.{json,yaml}memory_forget复用该路径Key decisions
SiftX,不额外实现第二份归属过滤ErrForbidden、restrictedToOwner、ownerIDFromContext、ownerAllowed),不绑定具体模型,后续接口可直接复用测试
memory_owner_test.go覆盖收窄判定、归属编号解析、放行判定、列表归属矩阵、四个钩子;handle_convo_memory_test.go覆盖 403/404/成功三类响应-tags=integration,本地 PostgreSQL + Redis):越权读写被拒、keeper 可代查代改、删除后向量消失、召回只返回本人记忆make vet、make lint通过(0 issue);go test ./...全部通过注:
stores.TestIntegration_SkillFrontmatterFields在干净数据库上同样失败,属既有问题,与本次改动无关。Post-Deploy Monitoring & Validation
request fail且 code=403 且 URI 前缀/api/convo/memories;delete memory vector fail/api/convo/memories*的 200/403/404/503 分布,memory_recall调用量与返回条数memory_recall对已有记忆的用户仍返回结果delete memory vector fail持续出现——前者说明身份解析异常,后者说明向量清理受阻