Release v2.7.0 with memory defenses#152
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c5d7d1050
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| cfg = self._config or get_config().governance.memory_defense | ||
| path = Path(os.path.expanduser(cfg.quarantine_path)) if cfg.quarantine_path else None | ||
| if path is None: | ||
| path = get_default_data_dir() / "quarantine" / "memory_anomalies.jsonl" |
There was a problem hiding this comment.
Use active storage dir for quarantine default path
When governance.memory_defense.quarantine_path is unset, quarantine records are written to get_default_data_dir() (AMEM_DATA_DIR/~/.amem) instead of the storage location backing the current MemoryManager instance. In deployments/tests that use a custom data directory (for example via MemoryManager(jsonl_path=...)), blocked notes are quarantined outside the active dataset, which breaks expected artifact locality and can leak data into an unintended global path.
Useful? React with 👍 / 👎.
|
|
||
| _p = time.perf_counter() | ||
| try: | ||
| reference_notes = self.store.get_notes_by_domain(domain) |
There was a problem hiding this comment.
Avoid full-domain note scan for each remember call
The new defense path loads every note in the domain on each write (get_notes_by_domain) before scoring, even though the gate later trims to max_reference_notes. On large domains this turns remember() into an O(N) read/materialization per write, causing avoidable ingest latency spikes and throughput collapse despite a small configured reference limit.
Useful? React with 👍 / 👎.
Summary
Validation
ruff check src/zettelforge/ruff format --check src/zettelforge/ tests/test_memory_defense.py tests/test_llm_client.py tests/test_llm_providers.py tests/test_performance.pypytest -q tests/test_memory_defense.py tests/test_telemetry_collector.py tests/test_telemetry_integration.py tests/test_llm_client.py tests/test_llm_providers.py tests/test_performance.py --tb=short --disable-warnings-> 99 passed, 9 skippedpytest -q --tb=short --disable-warnings-> 742 passed, 13 skippedpython3 -m build --outdir <tmp>andpython3 -m twine check <tmp>/*