Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
test: distinguish public history in compaction commands
Xubin Renc1fc6171b631
diff --git a/tests/command/test_compact_command.py b/tests/command/test_compact_command.pyindex 455dc90b5..b62767342 100644--- a/tests/command/test_compact_command.py+++ b/tests/command/test_compact_command.py@@ -15,6 +15,7 @@ from nanobot.bus.runtime_events import TurnCompletedfrom nanobot.command.builtin import cmd_stopfrom nanobot.command.router import CommandContextfrom nanobot.providers.base import GenerationSettings, LLMResponse, ProviderConversationState+from nanobot.runtime_context import public_history_messagefrom nanobot.session.history_visibility import is_hidden_history_message@@ -139,11 +140,12 @@ async def test_compacted_session_waits_for_new_input_without_continuation("content": loop.context.build_system_prompt(channel="cli", session_summary=expected_summary),}assert [message["role"] for message in sent] == ["system", "user"]- assert sent[1]["content"] == "hi"+ assert sent[1]["content"].startswith("hi\n\n")+ assert "File access: not restricted to this project." in sent[1]["content"]loop.sessions.invalidate(key)resumed = loop.sessions.get_or_create(key)- assert resumed.get_history() == [+ assert resumed.get_history(include_runtime_context=False) == [{"role": "user", "content": "hi"},{"role": "assistant", "content": "Hello!"},]@@ -278,7 +280,7 @@ async def test_compact_is_a_fifo_barrier_during_an_active_turn(loop) -> None:task.cancel()await asyncio.gather(task, return_exceptions=True)- assert [message["content"] for message in compacted_history if message["role"] == "user"] == [+ assert [public_history_message(message)["content"] for message in compacted_history if message["role"] == "user"] == ["initial question", "before compaction",]assert all("/compact" != message.get("content") for request in requests for message in request)