From 86ff216dc9774f701108fff8b637f2cd1b9d4f42 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 24 Feb 2026 16:39:25 -0800 Subject: [PATCH] fix: update tests for CORE_MEMORY_BLOCK_CHAR_LIMIT increase to 100k (#9645) Tests were failing because they relied on the old default limit of 20,000: - test_memory.py: "x " * 50000 = 100,000 chars now equals the limit instead of exceeding it. Increased to "x " * 60000 (120k chars). - test_block_manager.py: Block created with default limit (now 100k), then 30k char update no longer exceeds it. Set explicit limit=20000 on the test block to preserve the test intent. - test_log_context_middleware.py: Removed stale `limit: 20000` from dummy frontmatter fixtures to match new serialization behavior. Related to #9537 Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com> Co-authored-by: Kian Jones --- tests/managers/test_block_manager.py | 4 +++- tests/test_log_context_middleware.py | 4 ++-- tests/test_memory.py | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/managers/test_block_manager.py b/tests/managers/test_block_manager.py index 8f6408cf..ddfe4a2c 100644 --- a/tests/managers/test_block_manager.py +++ b/tests/managers/test_block_manager.py @@ -562,7 +562,9 @@ async def test_update_block(server: SyncServer, default_user): @pytest.mark.asyncio async def test_update_block_limit(server: SyncServer, default_user): block_manager = BlockManager() - block = await block_manager.create_or_update_block_async(PydanticBlock(label="persona", value="Original Content"), actor=default_user) + block = await block_manager.create_or_update_block_async( + PydanticBlock(label="persona", value="Original Content", limit=20000), actor=default_user + ) limit = len("Updated Content") * 2000 update_data = BlockUpdate(value="Updated Content" * 2000, description="Updated description") diff --git a/tests/test_log_context_middleware.py b/tests/test_log_context_middleware.py index bf6e650e..9cf0e100 100644 --- a/tests/test_log_context_middleware.py +++ b/tests/test_log_context_middleware.py @@ -52,8 +52,8 @@ class TestLogContextMiddleware: async def get_files(self, agent_id, org_id, ref): assert ref == "HEAD" return { - "system/human.md": "---\ndescription: human\nlimit: 20000\n---\nname: sarah", - "system/persona.md": "---\ndescription: persona\nlimit: 20000\n---\nbe helpful", + "system/human.md": "---\ndescription: human\n---\nname: sarah", + "system/persona.md": "---\ndescription: persona\n---\nbe helpful", } class DummyMemoryRepoManager: diff --git a/tests/test_memory.py b/tests/test_memory.py index 7c83bebe..334ff5bc 100644 --- a/tests/test_memory.py +++ b/tests/test_memory.py @@ -25,9 +25,9 @@ def test_chat_memory_init_and_utils(chat_memory: Memory): def test_memory_limit_validation(chat_memory: Memory): with pytest.raises(ValueError): - ChatMemory(persona="x " * 50000, human="y " * 50000) + ChatMemory(persona="x " * 60000, human="y " * 60000) with pytest.raises(ValueError): - chat_memory.get_block("persona").value = "x " * 50000 + chat_memory.get_block("persona").value = "x " * 60000 def test_get_block_not_found(chat_memory: Memory):