Summary
saveState() is called from several async tool handlers. Concurrent calls (for example setup_wallet and register) can interleave read-modify-write on the module-level wallet and API key state and lose an update.
Scope
- Keep the implementation aligned with the existing MindVault architecture.
- Add or update automated tests.
- Update docs when the change affects contributors, deployers, or agent users.
Acceptance criteria
- State-mutating tools run under a single in-process async lock so reads and writes cannot interleave.
- A test drives two concurrent mutating calls and asserts both results are persisted.
- Failure cases are deterministic and safe to show in issue-driven contributor work.
- Relevant local tests pass.
Summary
saveState()is called from several async tool handlers. Concurrent calls (for example setup_wallet and register) can interleave read-modify-write on the module-level wallet and API key state and lose an update.Scope
Acceptance criteria