Repository navigation
fix(audit): make index_persist audit entries opt-in - #2
Merged
Merged
Conversation
Port of upstream rohitg00#1182 (39658a9) onto the v0.9.29-patch line, adapted only for this branch's ledger-era index-persistence (same gate, same vocabulary, same tests). Index shard writes, manifest publishes, and generation reclaims record no user-data deletions, yet a single save() emits several index_persist audit rows; on a real store they reached 59876 of 84028 entries (71%). On this branch they would also dominate the new AGENTMEMORY_AUDIT_MAX retention window within hours of sustained capture (~4 rows per 5s debounced save) and evict genuine deletion records, so they are now opt-in via AGENTMEMORY_AUDIT_INDEX_PERSIST=1 (trimmed, case-insensitive 1/true; 0/false/anything else stays off). - src/state/index-persistence.ts: auditIndexPersistEnabled() gate, verbatim from upstream - test/index-persistence.test.ts: gating suite ported verbatim (default-off, affirmative vocabulary, off vocabulary, persistence unaffected) — 12 new tests, suite now 1756 passing - plugin/skills/agentmemory-config/REFERENCE.md: regenerated (52 vars) - CHANGELOG.md: document the new default under [Unreleased]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports upstream rohitg00#1182 (
39658a9) onto thev0.9.29-patchline:index_persistaudit rows become opt-in viaAGENTMEMORY_AUDIT_INDEX_PERSIST=1(default off). Follow-up to the retention PR (#1) — without this, the newAGENTMEMORY_AUDIT_MAX=5000retention window is dominated by index-persistence rows within hours of sustained capture, evicting genuine deletion records.Why
src/functions/audit.ts.save()emits severalindex_persistrows; on a real store they reached 59876 of 84028 entries (71%) (figure from upstream's fix).index_persistnoise and realdelete/forgetrecords get swept.Changes (
1917377)auditIndexPersistEnabled()gate +if (!auditIndexPersistEnabled()) return;at the top ofauditIndexPersistence(), verbatim from upstream (directprocess.envread is equivalent togetEnvVarhere becausehydrateProcessEnvFromFile()runs at boot in bothcli.tsandindex.ts; keeping the text identical minimises the future merge into main, where fix(audit): make index_persist audit entries opt-in rohitg00/agentmemory#1182 already landed).1,1,true,TRUE,true), off vocabulary (0,false,yes,"," ``), and persistence-unaffected. Env captured/restored per case (upstream's second commit).[Unreleased]→ Fixed.No REST endpoint / MCP tool / KV scope / audit-operation changes, so no count surfaces beyond the regenerated REFERENCE.md.
Test plan
npm testpasses — 1756 passed / 1 skipped (base 1744 + 12 new gating tests; no regressions)npm run buildpassesnpm run skills:checkpasses (17 skills)npx tsc --noEmit— 30 pre-existing errors, byte-identical set to the merge base (no new type errors)39658a9verified: src hunks identical except one patch-branch context line (DEFAULT_BOOT_RECLAIM_MAX_DELETES)