Skip to content

Conversation

@rafaelcalleja
Copy link

@rafaelcalleja rafaelcalleja commented Jan 6, 2026

Fixes #3

Summary

  • Add cross‑process file lock around Mind.open() and all memvid operations to prevent concurrent access to .mv2.
  • Keep corruption handling, but now it runs under lock, so Invalid indicates real corruption.
  • Add regression test that fails on main and passes with the lock.

Changes

  • New src/utils/memvid-lock.ts using proper-lockfile
  • Lock wrapping in src/core/mind.ts
  • New test src/__tests__/mind-lock.test.ts
  • Add deps proper-lockfile and @types/proper-lockfile

Testing

  • npm test -- src/__tests__/mind-lock.test.ts
  • npm run typecheck

TODO

@sharafdin sharafdin requested a review from Olow304 January 7, 2026 05:09
@sharafdin sharafdin added the bug Something isn't working label Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race condition in concurrent hooks corrupts mind.mv2 (Invalid sketch track magic)

2 participants