Skip to content

memory: unreadable lines are deleted by the next write (regression from #4717, unreleased) #4885

Description

@yotambraun

Since #4717, loadGraph() skips lines that fail to parse or validate. The mutations still call saveGraph() with the filtered graph, which rewrites the whole file, so the next unrelated write deletes those lines for good. The tool call reports success.

Reproduction on main (f46d957), starting from this memory.jsonl:

{"type":"entity","name":"Alice","entityType":"person","observations":["Works at Acme","Prefers email"]}
{"type":"entity","name":"Bob","entityType":"person","observations":["Allergic to penicillin","Lives in Haifa",null]}
{"type":"entity","name":"Project X","observations":["Deadline 2026-10-01","Budget 40k"]}
{"type":"relation","from":"Alice","to":"Bob","relationType":"manages"}

After create_entities for an unrelated entity (Carol), the file is:

{"type":"entity","name":"Alice","entityType":"person","observations":["Works at Acme","Prefers email"]}
{"type":"entity","name":"Carol","entityType":"person","observations":["New hire"]}
{"type":"relation","from":"Alice","to":"Bob","relationType":"manages"}

Bob loses both valid observations because of one null, Project X is gone, and the Alice-Bob relation now points to a deleted entity.

The other kinds of line from earlier reports behave the same way on main: a truncated line (#1481), two objects on one line (#1819, #3173), and a relation without relationType. The published 2026.8.31 predates #4717 and fails on these files instead of deleting them, so this is not released yet. Lines with an unknown type were already dropped before #4717.

I'll open a PR that keeps skipping these lines in memory but writes them back unchanged on save.

Recorded runs for main, 2026.8.31 and the fix (tool calls, responses, file before and after), with a script to reproduce them: https://github.com/yotambraun/agent-eval-flow/tree/f184978b4224aaff39e125fd0b25075e4af00532/examples/data/mcp-memory

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions