From dfcf84a764906704ec279c097a0b80598c6bd092 Mon Sep 17 00:00:00 2001 From: Noa Levi <275430404+lphuc2250gma@users.noreply.github.com> Date: Wed, 27 May 2026 13:07:38 +0000 Subject: [PATCH] chore: improve ChatDev maintenance path --- frontend/src/count_lines.py | 5 +++-- tests/test_mem0_memory.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/frontend/src/count_lines.py b/frontend/src/count_lines.py index 94a8916f65..56a93cfda1 100755 --- a/frontend/src/count_lines.py +++ b/frontend/src/count_lines.py @@ -1,7 +1,8 @@ import os +from typing import Collection, Optional -def count_lines(root: str, extensions=None) -> int: +def count_lines(root: str, extensions: Optional[Collection[str]] = None) -> int: """ Count total number of lines in files under `root` whose extension is in `extensions`. @@ -36,7 +37,7 @@ def count_lines(root: str, extensions=None) -> int: return total_lines -def main(): +def main() -> None: root = "." total = count_lines(root) print(f"Total lines of code under '{os.path.abspath(root)}': {total}") diff --git a/tests/test_mem0_memory.py b/tests/test_mem0_memory.py index da34270ff9..9c409ec0da 100644 --- a/tests/test_mem0_memory.py +++ b/tests/test_mem0_memory.py @@ -314,6 +314,20 @@ def test_update_no_input_is_noop(self): client.add.assert_not_called() + def test_update_header_only_input_is_noop(self): + """Input containing only a pipeline header is cleaned to empty and skipped.""" + memory, client = _make_mem0_memory(agent_id="a1") + + payload = MemoryWritePayload( + agent_role="writer", + inputs_text="=== INPUT FROM TASK (user) ===", + input_snapshot=None, + output_snapshot=None, + ) + memory.update(payload) + + client.add.assert_not_called() + def test_update_api_error_does_not_raise(self): """API errors are logged but do not propagate.""" memory, client = _make_mem0_memory(agent_id="a1")