Repository navigation
Conversation
…ackup Memory GC and the compression pass both archived to archive/<basename>. With VT_MEMORY_HIERARCHY, user/x.md and project/x.md share a basename, so archiving the second renamed it over the first; compressing an entry a second time (daily -> digest) replaced the raw original's backup with the daily summary. The archive is documented as archive-only, never deleted. Pick a free archive name instead: the first backup keeps <name>, later ones get <stem>.1<suffix>, <stem>.2<suffix>, ... Signed-off-by: thejesh23 <35212698+thejesh23@users.noreply.github.com>
This branch has not been deployed
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
archive/<basename>, overwriting whatever backup already has that name. The archive is documented as archive-only / never deleted, but two cases lose an original for good:VT_MEMORY_HIERARCHY,user/x.mdandproject/x.mdare different entries with the same basename, so archiving the second renames it over the first;Why
Two GC-eligible entries with the same title, one
user, oneproject, hierarchy on:On
mainthe user preference is gone from both the live tree and the archive.consolidation.pyand thememory.consolidatescheduled job promise the opposite ("low-importance memories are moved to<memory_dir>/archive/, never deleted").Changes
agent/src/memory/compression.py: newfree_archive_path(archive_dir, name). The first backup keepsname, so the layout is unchanged when there's no clash. Later ones get<stem>.1<suffix>,<stem>.2<suffix>, …archive_originaluses it, and its error-path temp cleanup now removes the temp file it actually created.agent/src/memory/lifecycle.py:_execute_gc_actionuses the same helper for both thearchiveand the (currently disabled)deletebranch.agent/tests/test_memory_gc.py(hierarchy basename clash; GC after a compression backup of the same entry) and two inagent/tests/memory/test_compression.py(raw backup kept through daily → digest; two categories' entries with one basename).archive/behaviour,mainvs this branch:x.mdarchive/x.mdarchive/x.md(unchanged)x.md(other category)archive/x.mdarchive/x.1.mdx.md, daily inx.1.mdOut of scope: archive restore tooling (there's none in-tree; nothing reads
archive/back), and moving to a per-category archive layout.Test Plan
main(e.g.an archived original was overwritten: ['sizing.md']) and pass with the fix.pytest agent/tests/test_memory_gc.py agent/tests/memory: 127 passed, 1 skipped.pytest --ignore=agent/tests/e2e_backtest --ignore=agent/tests/test_e2e_harness_v2.pyon Python 3.12, macOS, lockfile deps: 22658 passed, 197 skipped, 30 failed.mainin the same environment: 22654 passed, 197 skipped, and the same 30 failures (identical test IDs): 25 intest_history_source.py, 3 needing the optionalstatsmodelsextra, and 2 needing the package installed (test_cli_package_bootstrap,test_governance::test_collect_key_package_versions_reflects_real_environment).bash tools/ci_grep_gates.sh, the gate tests, the CI syntax checks,ruff checkon the changed files (2 pre-existing unused imports intest_compression.pyare onmainand untouched),git diff --check. New lines are Black-formatted with--line-ranges; I didn't reformat existing code.Checklist
src/agent/,src/session/,src/providers/)Risk: file naming inside
<memory_dir>/archive/only, and only when a name is already taken; live memory files, the index and FTS are untouched. Rollback is a single-commit revert.