memory: README does not say that unreadable lines are skipped, kept on every write, and fixable only by hand

未关闭 适合新手
#5,609 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
90/100
Issue 类型
文档
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
documentation

调研方向

结合阅读 src/memory/README.md、src/memory/index.ts 中的 loadGraphWithUnreadable 和 saveGraph,以确认文档所述行为。在存储或故障排除部分附近添加一段简短说明,涵盖被跳过和记录日志的行、写入时的保留行为和字节限制、工具的局限性以及手动修复。README 解释了所述行为和恢复步骤后,即为完成。

由索引模型根据 Issue 内容生成。

描述

documentation server-memory v2
Which server?

memory (@modelcontextprotocol/server-memory), src/memory/README.md.

The problem

The README does not say what the server does with a line of the memory file it cannot read, or how to fix one. The only mention is in passing, under the write limits ("MEMORY_MAX_FILE_BYTES counts the bytes of the file as it would be saved, unreadable lines included").

What the server does today (loadGraphWithUnreadable and saveGraph in src/memory/index.ts, from #4885):

  • A line that is not JSON, is not an object, has an unknown type, or fails the entity or relation schema (an entity with no entityType, an observation that is not a string, a relation with no relationType) is left out of the graph. Each skipped line is logged to stderr ("Skipping invalid entity in memory file: …").
  • Every save writes those lines back unchanged, after the graph's own lines, so a write never drops data it could not read.
  • No tool can then remove or repair such a line. read_graph, search_nodes and open_nodes do not show it; delete_entities and delete_observations report its name as not found; add_observations and create_relations fail with "Entity with name … not found"; create_entities under the same name stores a second record beside the invalid line; an invalid relation matches no delete_relations call and stays after the entities it names are deleted. #5541 pins this in src/memory/__tests__/invalid-record-removal.test.ts.

So the only remedy is to edit the file by hand, and a user who sees the stderr line, or a Not found for an entity they can see in the file, has nowhere to read that.

Expected

A short passage in the README (near the storage or troubleshooting sections) stating: which lines are skipped, that they are logged to stderr, that they are kept in the file on every write and count toward MEMORY_MAX_FILE_BYTES, that no tool reaches them, and that the fix is to stop the clients using the file and correct or delete the line in a text editor.

Scope

Documentation only. Whether a remediation tool should exist is a separate question this issue does not ask.

Found while verifying #5541.

主要语言
TypeScript
星标
92k
派生
12k
平均合并
3 小时 46 分钟
30 天内合并 PR
206

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

modelcontextprotocol/servers 的其他 Issue

查看 modelcontextprotocol/servers 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。