Skip to content

fix: a write is not lost to a memory under review - #70

Open
alexeybe1kin wants to merge 8 commits into
mainfrom
fix/write-dedup-active
Open

alexeybe1kin wants to merge 8 commits into
mainfrom
fix/write-dedup-active

Conversation

@alexeybe1kin

Copy link
Copy Markdown
Collaborator

Hunt finding memorygate-1 F30.

The exact-duplicate check in POST /memory/write had three gaps:

  • It took any memory with the same text, whatever its status. A write equal to a memory under review or expired answered ok with duplicate_of, and nothing became active, so the write was lost.
  • It looked only at the newest 100 memories.
  • Two writes at once could both insert.

Now it matches only an active memory of the agent, in SQL and however old. Writes of one text are serialised with the existing lock_memory_text (Postgres advisory lock). Search is unchanged: it is the admin library, and it shows status.

Tests: tests/test_write_dedup_active.py. The under-review case fails on main. The old-active case is coverage, since the vector near-duplicate path also catches it on main. Locally: every test file that writes memories, 59 passed; ruff, types and boundaries ok.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant