Skip to content

docs(memory): say what happens to lines of the memory file the server cannot read - #5706

Merged
cliffhall merged 2 commits into
v2/mainfrom
v2/docs/5609-memory-readme-unreadable-lines
Nov 30, 2026
Merged

cliffhall merged 2 commits into
v2/mainfrom
v2/docs/5609-memory-readme-unreadable-lines

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Closes #5609

Description

Adds a Lines the server cannot read passage to src/memory/README.md, right after Limiting how large the graph grows. It states which line shapes are left out of the loaded graph, which of them log to stderr (and that JSON arrays and objects with a missing or unknown type do not), that every save writes them back after the graph's own lines while blank lines are dropped, that they count toward MEMORY_MAX_FILE_BYTES, that no tool reaches them, and that the fix is a hand edit with the clients stopped.

Each claim was checked against loadGraphWithUnreadable and saveGraph in src/memory/index.ts on v2/main, against __tests__/invalid-record-removal.test.ts (#5541), and against the built server (below). The passage quotes no tool's result text, only the stderr messages, so it does not collide with the sibling PRs that change create_relations and delete-count wording.

Server Details

  • Server: memory
  • Changes to: README only

Motivation and Context

The README mentioned unreadable lines only in passing, under the write limits, so a user who saw a Skipping … line on stderr, or a Not found for an entity visible in the file, had nowhere to read what was happening or how to fix it. The issue's comments include a per-shape table showing that not every skipped line logs; the passage follows that table, re-verified here.

How Has This Been Tested?

Docs only, so a targeted probe: the built server (src/memory/dist/index.js, 2.2.2) driven with the Inspector CLI 2.12.0 over stdio against a planted memory file holding one valid entity, then one line of each shape, then a blank line:

{"type":"entity","name":"Alice","entityType":"person","observations":["ok"]}
not valid json
42
null
[1,2,3]
{"type":"note","text":"x"}
{"name":"NoType"}
{"type":"entity","name":"Broken","observations":["no entityType"]}
{"type":"relation","from":"Alice","to":"Broken"}
(blank line)
  • read_graph, --protocol-era legacy and --protocol-era modern: both return only Alice, and both print exactly five stderr lines for eight skipped lines. The array, the note object and the object with no type print nothing:
    Skipping malformed line in memory file
    Skipping non-object line in memory file
    Skipping non-object line in memory file
    Skipping invalid entity in memory file: entityType: Invalid input: expected string, received undefined
    Skipping invalid relation in memory file: relationType: Invalid input: expected string, received undefined
    
  • delete_entities ["Broken"]: Deleted 0 of 1 entities. Not found: Broken.
  • create_entities Bob, then the file: Alice and Bob first, then the eight skipped lines verbatim in their original order; the blank line is gone.

No LLM-client run: the change has no client-observable surface.

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follow MCP security best practices
  • I have updated the server's README accordingly
  • I have added a changeset (npm run changeset) if this changes what a TypeScript server publishes (not applicable: README only, no change to the published server's behavior)
  • I have tested this with an LLM client (not applicable: documentation only; the Inspector CLI probe above verifies each claim)
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling (not applicable: no code changed)
  • I have documented all environment variables and configuration options (not applicable: none added or changed)

🤖 Generated with Claude Code

… cannot read

Which line shapes are skipped, which of them log to stderr and which do
not, that every save keeps them and they count toward
MEMORY_MAX_FILE_BYTES, that no tool reaches them, and that the fix is a
hand edit with the clients stopped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
@cliffhall cliffhall added the v2 label Nov 30, 2026
@changeset-bot

changeset-bot Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f0e16a0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

memory: MCP interface diff

Base: c0075947ac6b (Merge pull request #5682 from modelcontextprotocol/v2/chore/5681-python-calver-2026.11.27)
Head: the build in this checkout, at e2c68101df88 (Merge f0e16a0 into c007594)

Diffed because it was named (--server).

✅ No interface changes detected.

Tools Prompts Resources Resource templates
Base 9 0 1 0
Head 9 0 1 0

Updated by this run for f0e16a0a21faba9bc171a515986c6512e4565fad.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The README misstates skipped-record behavior when a readable namesake exists and omits stopping all server processes before manual edits, potentially misleading users about invalid-line removal and allowing ongoing writes to overwrite repairs.

2 open issues
What changed in this PR

Documents how the memory server handles unreadable file records, addressing #5609 without changing server behavior.

Changes:

  • Explains which lines are skipped and which produce stderr messages.
  • Clarifies preservation on save, blank-line removal, and file-size accounting.
  • Describes tool limitations and manual repair steps.
File Description
src/​memory/​README.md Adds guidance on unreadable records, their persistence, and manual repair.

Review effort: Balanced

Comment thread src/memory/README.md Resolved
Comment thread src/memory/README.md Resolved
… and stop HTTP servers before a hand edit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
@cliffhall

Copy link
Copy Markdown
Member Author

Copilot round 1: 2 findings, both fixed in f0e16a0. Both were defects in the passage this PR adds.

  • Unreachable line vs. readable namesake: the not-found and refused behavior holds only while no readable entity shares the name. Once create_entities adds one, tools act on it, and deleting it leaves the skipped line in place. Reworded to say so.
  • Stopping HTTP servers: "quit every client" did not cover a Streamable HTTP server, which runs independently. The step now says to stop every server process using the file, including HTTP servers, and wait for each to exit.

Gate green on f0e16a0. Requesting round 2.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the documentation-only update on unreadable records and safe manual repair.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@cliffhall

Copy link
Copy Markdown
Member Author

Copilot round 2 on f0e16a0: clean, no open findings, and both round-1 findings shown as resolved. The review loop ends on this first clean round.

@cliffhall
cliffhall merged commit 6347e09 into v2/main Nov 30, 2026
48 checks passed
@cliffhall
cliffhall deleted the v2/docs/5609-memory-readme-unreadable-lines branch November 30, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants