fix(memory): defer resources for disabled managers 🤖🤖🤖 - #284
fix(memory): defer resources for disabled managers 🤖🤖🤖#284Sampoornnagpal wants to merge 2 commits into
Conversation
Signed-off-by: Sampoorn Nagpal <nagpalsampoorn@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 WalkthroughWalkthrough
ChangesMemory manager lazy resources
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Disabled memory installations now avoid creating embedder and SQLite resources until explicitly used, while enabled installations retain eager setup. No actionable current-head merge risk remains. Sequence Diagram(s)sequenceDiagram
participant Caller
participant MemoryManager
participant Embedder
participant MemoryStore
participant RetrievalEngine
Caller->>MemoryManager: invoke explicit memory operation
MemoryManager->>Embedder: initialize on first access
MemoryManager->>MemoryStore: initialize on first access
MemoryManager->>RetrievalEngine: initialize with embedder and store
RetrievalEngine-->>MemoryManager: return retrieval result
MemoryManager-->>Caller: return operation result
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: Sampoorn Nagpal <nagpalsampoorn@gmail.com>
What does this PR do?
Installing
MemoryManagerwithenabled=Falsestill constructs an embedder and creates the configured SQLite database/directories before the disabled check. Defer these resources for disabled managers using cached properties, and avoid initializing the store during uninstall.Enabled installation remains eager, preserving backend validation and hook setup. Explicit direct manager operations still work and initialize resources on demand; agent-facing tools stay disabled. Document that distinction.
Validation
New regressions reproduce directory creation and unnecessary embedder construction before the fix. Additional coverage checks explicit manager access, cached resource reuse, and uninstall.
uv run pytest -q packages/nooa-memory/tests/memory/test_memory_manager.py packages/nooa-memory/tests/memory/test_memory_owner.py packages/nooa-memory/tests/memory/test_memory_skill.py packages/nooa-memory/tests/memory/test_memory_reflection_interrupt.py— 54 passed. Targeted Pyright: 0 errors/warnings.Windows/Python 3.12 with external import-only helpers for #84/#85 (
fcntl/SIGUSR2); helpers are not included and do not validate POSIX locking/signals. No live model calls.Related issues
No matching open issue found. Independent of the record-update fix in #277.
Checklist
Summary by CodeRabbit
Bug Fixes
Documentation
Tests