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 <kianjones9@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2026-02-24 16:39:25 -08:00
committed by Caren Thomas
parent 895acb9f4e
commit 86ff216dc9
3 changed files with 7 additions and 5 deletions

View File

@@ -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")

View File

@@ -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:

View File

@@ -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):