Repository navigation
Description
Bug Description
On an ordinary Basic Memory Cloud note with no review items, edit_note(operation="find_replace") accepted an outdated expected_checksum and modified the note.
Paul suggested in Discord that this looks like a core-library bug.
Steps To Reproduce
The observed test used a disposable synthetic note:
- Read the note using structured
read_noteand save itsrevision_checksumas cA. - Append a marker, producing revision B.
- Read again and confirm its checksum differs from cA.
- Confirm the original replacement target still occurs exactly once in B.
- Call
edit_noteon the same note with:operation="find_replace"- The original target as
find_text - Replacement content
expected_replacements=1expected_checksum=cA
- Read the note again to check whether the stale edit was rejected.
Expected Behavior
The stale precondition rejects the mutation with a recognizable conflict error. Revision B and its contents remain unchanged.
If checksum preconditions are unsupported on ordinary notes, supplying one should return an explicit error rather than silently proceed.
Actual Behavior
The replacement succeeded, and read-back confirmed the content changed.
Observed checksum prefixes:
- Baseline A:
eaec17de… - After marker append B:
b3aa17dc… - After accepted stale edit:
bb60d282…
The replacement target occurred exactly once, so replacement-count validation did not explain or prevent the stale edit. The appended marker and the note's identity remained intact.
Environment
- Basic Memory Cloud through its ChatGPT connector
- Observed September 11, 2026
- Cloud server/core-library version: unknown
- No local Basic Memory installation was used for this test
- Disposable synthetic note with no review items; no production data involved
Additional Context
An automated reader can submit an edit based on outdated content while believing its supplied checksum protects against concurrent changes.
Our current workaround is an exclusive overnight maintenance window. No production data was lost in this test.
The MCP documentation describes expected_checksum in the context of reviewed notes. Please confirm whether accepting a stale checksum on an ordinary note is intended.
This sequential test demonstrates stale acceptance; it does not establish behavior under simultaneous racing writes.
Possible Solution
When an expected_checksum is supplied, enforce it on ordinary notes as well as reviewed notes, or explicitly reject it if unsupported. Validation and commit should be atomic so another writer cannot change the note between checking the checksum and saving.
A regression test should confirm stale rejection without mutation. A separate concurrency test could verify that two conditional writes based on the same revision produce exactly one success and one conflict.
Activity
phernandez commentedon Sep 14, 2026
Milestone status (2026-09-14): confirmed current Cloud bug; no fix or PR exists yet.
Current Basic Memory Cloud
mainat16e5dba1eb164db1a42bae1e94eb1a2af1b56bd2still gatesexpected_checksumonly when a note contains comments or suggestions:Therefore a supplied stale checksum on an ordinary note is still ignored, matching the report. This path lives in Cloud's hosted MCP review/edit wrapper, not the Core edit implementation, so delivery should be made in
basic-memory-cloud(with this issue linked or moved as appropriate).Next step: enforce any supplied checksum before applying an ordinary-note edit, preserve the existing required-checksum rule for reviewed notes, and add regression coverage proving stale rejection leaves content unchanged. The actual write must retain the existing canonical CAS boundary; a read-only precheck by itself is not sufficient concurrency protection.
phernandez commentedon Sep 14, 2026
The fix is in Cloud PR https://github.com/basicmachines-co/basic-memory-cloud/pull/2071 (head
b7a1956309877120a867b2961b1ccb9d68a7bc27).RCA: Cloud's hosted
edit_notewrapper checked callerexpected_checksumonly for notes with comments or suggestions. For an ordinary note it ignored the supplied precondition and passed its newly readentity.db_checksumto PATCH/PUT. Core correctly enforced that header, but it represented the wrapper's newer read rather than the caller's revision.The fix rejects any supplied checksum that differs from the existing note's accepted checksum. Ordinary notes can still omit it; reviewed notes still require it. PATCH and PUT retain the server-read checksum header to protect against another write after wrapper validation. No new locks or retries.
Verification: 84 targeted tests and
just fast-checkpass. Real FastMCP → mounted API → Cloud/Core mutation-service tests use disposable PostgreSQL and prove both read A/write B/stale edit A rejection and an injected write after the wrapper read, for PATCH and PUT. API plus independent database readback confirm B remains unchanged. Temporarily removing the wrapper guard makes both sequential regression tests fail because stale writes succeed.Ready for coordinator/user direction: all seven applicable CI checks passed on
b7a1956309877120a867b2961b1ccb9d68a7bc27(the two web-only checks were skipped). Codex completed that exact-head review and left a fresh +1 on the PR body at 2026-09-14 15:30:10 UTC. Final review/thread checks found no findings or unresolved threads. Not merged or deployed.