Skip to content

Your lightweight open-source personal agent.

refactor(memory): guard empty summaries only on write

chengyongruf63001828fa6
diff --git a/nanobot/agent/memory.py b/nanobot/agent/memory.py
index f893424c6..a736335b5 100644
--- a/nanobot/agent/memory.py
+++ b/nanobot/agent/memory.py
@@ -431,11 +431,7 @@ class MemoryStore:
unified_session: bool = False,
) -> list[dict[str, Any]]:
"""Return unprocessed history entries safe to inject into a turn prompt."""
- entries = [
- entry
- for entry in self.read_unprocessed_history(since_cursor=since_cursor)
- if str(entry.get("content", "")).strip() != "(nothing)"
- ]
+ entries = self.read_unprocessed_history(since_cursor=since_cursor)
if session_key is None:
return entries
if not unified_session:
diff --git a/tests/agent/test_context_prompt_cache.py b/tests/agent/test_context_prompt_cache.py
index a0d378d46..f9393f1c2 100644
--- a/tests/agent/test_context_prompt_cache.py
+++ b/tests/agent/test_context_prompt_cache.py
@@ -96,17 +96,6 @@ def test_unprocessed_history_injected_into_system_prompt(tmp_path) -> None:
assert re.search(r"\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}\]", prompt)
-def test_nothing_history_entry_is_not_injected(tmp_path) -> None:
- workspace = _make_workspace(tmp_path)
- builder = ContextBuilder(workspace)
- builder.memory.append_history("(nothing)")
-
- prompt = builder.build_system_prompt()
-
- assert "# Recent History" not in prompt
- assert "(nothing)" not in prompt
-
-
def test_recent_history_injection_is_session_scoped(tmp_path) -> None:
workspace = _make_workspace(tmp_path)
builder = ContextBuilder(workspace)