fix(memory): add regression tests for memory context preservation aft…#43778
Open
LifeJiggy wants to merge 2 commits into
Open
fix(memory): add regression tests for memory context preservation aft…#43778LifeJiggy wants to merge 2 commits into
LifeJiggy wants to merge 2 commits into
Conversation
…er compaction SUMMARY_PREFIX already explicitly states MEMORY.md/USER.md remain 'always authoritative and active' after compaction (fix for NousResearch#17251). Added 3 regression tests to lock this contract: - test_summary_prefix_mentions_memory_stays_active: MEMORY.md/USER.md are present and described as active/authoritative - test_summary_prefix_exempts_memory_from_compaction: memory files are explicitly exempted from the 'background reference' label - test_summary_prefix_instucts_agent_not_to_ignore_memory: prefix tells agent to never deprioritize memory content No code changes needed — the fix is already on main. Tests prevent regression.
…ervation - Fix test_summary_prefix_instucts -> instructs (missing 'r') - 3 regression tests verify SUMMARY_PREFIX keeps MEMORY.md/USER.md as always-authoritative after compaction - Tests guard against NousResearch#17251 regression (memory deprioritized)
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.
fix/memory-context-compaction
What does this PR do?
Adds 3 regression tests ensuring SUMMARY_PREFIX in agent/context_compressor.py keeps MEMORY.md and USER.md as "always authoritative and active" after context compaction. The fix for #17251 is already on main — these tests prevent regression by locking the behavioral contract at the test level.
Earlier versions labeled compacted content as "background reference, NOT active instructions" which caused the agent to ignore MEMORY.md/USER.md after compaction. The current SUMMARY_PREFIX explicitly carves out persistent memory as exempt.
Related Issue
Fixes #17251 (memory context deprioritized after compaction)
Type of Change
✅ Tests (adding or improving test coverage)
Changes Made
tests/agent/test_context_compressor.py: Added TestMemoryContextPreserved class with 3 tests:
test_summary_prefix_mentions_memory_stays_active: MEMORY.md/USER.md present and described as active/authoritative
test_summary_prefix_exempts_memory_from_compaction: memory files explicitly exempted from "background reference" label
test_summary_prefix_instructs_agent_not_to_ignore_memory: prefix tells agent to never deprioritize memory
How to Test
python -m pytest tests/agent/test_context_compressor.py::TestMemoryContextPreserved -q — 3/3 pass
Tests verify against SUMMARY_PREFIX in agent/context_compressor.py:37-61
Checklist
I've read the Contributing Guide
My commit messages follow Conventional Commits
I searched for existing PRs
My PR contains only changes related to this fix
I've run pytest and all tests pass
I've added tests for my changes
I've tested on Windows 11