Description
Memory.read_only blocks remember and remember_many, but two other implicit write paths still mutate the backing store: update rewrites a record, and recall refreshes last_accessed through touch_records. As a result, reading through a read-only Memory leaves a persistent trace.
Steps to Reproduce
- Create a Memory with local storage and store one record while writable.
- Set memory.read_only = True.
- Call update on that record; its content changes.
- Or call recall; the stored last_accessed timestamp advances.
Expected behavior
When read_only is true, implicit persistence paths leave stored records unchanged. Explicit deletion through forget and reset is a separate operation and can remain available.
Screenshots/Code snippets
A focused regression is available in PR #7367. It asserts that read-only update returns the existing record unchanged and that read-only recall does not advance last_accessed, with writable positive controls.
Operating System
Other: macOS Sequoia.
Python Version
3.12
crewAI Version
1.15.21
crewAI Tools Version
Not used.
Virtual Environment
Venv
Evidence
The two regression tests fail on the current implementation and pass with PR #7367. The full memory test directory passes: 134 passed, 19 skipped. Ruff and the repository gates are clean.
Possible Solution
Honor read_only before update writes and before recall invokes touch_records. Return the existing record from read-only update to match remember's silent no-op behavior.
Additional context
This preserves recall results and leaves explicit forget/reset behavior unchanged. The patch is limited to two behavior checks, documentation, and regression tests.
Description
Memory.read_only blocks remember and remember_many, but two other implicit write paths still mutate the backing store: update rewrites a record, and recall refreshes last_accessed through touch_records. As a result, reading through a read-only Memory leaves a persistent trace.
Steps to Reproduce
Expected behavior
When read_only is true, implicit persistence paths leave stored records unchanged. Explicit deletion through forget and reset is a separate operation and can remain available.
Screenshots/Code snippets
A focused regression is available in PR #7367. It asserts that read-only update returns the existing record unchanged and that read-only recall does not advance last_accessed, with writable positive controls.
Operating System
Other: macOS Sequoia.
Python Version
3.12
crewAI Version
1.15.21
crewAI Tools Version
Not used.
Virtual Environment
Venv
Evidence
The two regression tests fail on the current implementation and pass with PR #7367. The full memory test directory passes: 134 passed, 19 skipped. Ruff and the repository gates are clean.
Possible Solution
Honor read_only before update writes and before recall invokes touch_records. Return the existing record from read-only update to match remember's silent no-op behavior.
Additional context
This preserves recall results and leaves explicit forget/reset behavior unchanged. The patch is limited to two behavior checks, documentation, and regression tests.