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(agent): remove obsolete runtime context assertions
chengyongrud349b65713d6
diff --git a/tests/agent/test_context_builder.py b/tests/agent/test_context_builder.pyindex 5d58fc5e6..4aa46bd8d 100644--- a/tests/agent/test_context_builder.py+++ b/tests/agent/test_context_builder.py@@ -283,20 +283,6 @@ class TestBuildMessages:messages = builder.build_messages([], "hello", channel="cli", chat_id="direct")user_msg = str(messages[-1]["content"])assert user_msg == "hello"- assert "Runtime Context" not in user_msg- assert "Current Time:" not in user_msg- assert "Chat ID:" not in user_msg-- def test_session_metadata_does_not_inject_context_without_provider(self, tmp_path):- builder = _builder(tmp_path)- messages = builder.build_messages(- [],- "hi",- channel="cli",- chat_id="x",- session_metadata={"goal_state": {"status": "active", "objective": "hidden"}},- )- assert messages[-1]["content"] == "hi"def test_explicit_runtime_context_blocks_are_appended(self, tmp_path):builder = _builder(tmp_path)diff --git a/tests/agent/test_context_prompt_cache.py b/tests/agent/test_context_prompt_cache.pyindex bbe75265a..8d48b237d 100644--- a/tests/agent/test_context_prompt_cache.py+++ b/tests/agent/test_context_prompt_cache.py@@ -62,26 +62,6 @@ def test_system_prompt_reflects_current_dream_memory_contract(tmp_path) -> None:assert "write important facts here" not in prompt-def test_default_user_message_has_no_runtime_context(tmp_path) -> None:- workspace = _make_workspace(tmp_path)- builder = ContextBuilder(workspace)-- messages = builder.build_messages(- history=[],- current_message="Return exactly: OK",- channel="cli",- chat_id="direct",- )-- assert messages[0]["role"] == "system"- assert "## Current Session" not in messages[0]["content"]-- assert messages[-1]["role"] == "user"- user_content = messages[-1]["content"]- assert user_content == "Return exactly: OK"- assert "_meta" not in messages[-1]--def test_provider_context_appended_after_user_content(tmp_path) -> None:workspace = _make_workspace(tmp_path)builder = ContextBuilder(workspace)@@ -102,42 +82,6 @@ def test_provider_context_appended_after_user_content(tmp_path) -> None:assert user_pos < context_pos, "user content must precede provider context"-def test_sender_id_is_not_injected_without_provider(tmp_path) -> None:- workspace = _make_workspace(tmp_path)- builder = ContextBuilder(workspace)-- messages = builder.build_messages(- history=[],- current_message="Return exactly: OK",- channel="cli",- chat_id="direct",- sender_id="user-12345",- )-- user_content = messages[-1]["content"]- assert isinstance(user_content, str)- assert user_content == "Return exactly: OK"- assert "Sender ID:" not in user_content---def test_runtime_context_excludes_sender_id_when_not_provided(tmp_path) -> None:- """Sender ID should not be present in runtime context when not provided."""- workspace = _make_workspace(tmp_path)- builder = ContextBuilder(workspace)-- messages = builder.build_messages(- history=[],- current_message="Return exactly: OK",- channel="cli",- chat_id="direct",- sender_id=None,- )-- user_content = messages[-1]["content"]- assert isinstance(user_content, str)- assert "Sender ID:" not in user_content--def test_unprocessed_history_injected_into_system_prompt(tmp_path) -> None:"""Entries in history.jsonl not yet consumed by Dream appear with timestamps."""workspace = _make_workspace(tmp_path)diff --git a/tests/agent/test_loop_runner_integration.py b/tests/agent/test_loop_runner_integration.pyindex cec77b7e0..18092a77c 100644--- a/tests/agent/test_loop_runner_integration.py+++ b/tests/agent/test_loop_runner_integration.py@@ -181,8 +181,6 @@ async def test_runtime_context_is_persisted_as_next_turn_prompt_prefix(tmp_path)assert second_wire[2]["role"] == "assistant"assert second_wire[2]["content"] == "first answer"assert second_wire[3]["content"].startswith("second turn")- assert "Current Time:" not in str(second_wire)- assert "Chat ID:" not in str(second_wire)assert len(provider_calls) == 2persisted_first_user = session.messages[0]diff --git a/tests/agent/test_loop_save_turn.py b/tests/agent/test_loop_save_turn.pyindex e6866f061..89d3c581d 100644--- a/tests/agent/test_loop_save_turn.py+++ b/tests/agent/test_loop_save_turn.py@@ -1401,7 +1401,6 @@ async def test_system_subagent_followup_is_persisted_before_prompt_assembly(tmp_assert "[Message Time:" not in non_system[0]["content"]assert "[Message Time:" not in non_system[1]["content"]assert non_system[2]["content"].count("subagent result") == 1- assert "Current Time:" not in non_system[2]["content"]assert non_system[2]["content"] == "subagent result"loop.sessions.invalidate("cli:test")diff --git a/tests/agent/test_session_manager_history.py b/tests/agent/test_session_manager_history.pyindex f00bc7874..36f60c890 100644--- a/tests/agent/test_session_manager_history.py+++ b/tests/agent/test_session_manager_history.py@@ -460,27 +460,12 @@ def test_get_history_does_not_duplicate_persisted_cli_app_runtime_context():assert public_history == [{"role": "user", "content": "please use @drawio"}]-def test_get_history_does_not_synthesize_mcp_preset_attachment():- session = Session(key="test:mcp-preset")- session.messages.append({- "role": "user",- "content": "please use @linear",- "mcp_presets": [{"name": "linear", "transport": "stdio"}],- })-- assert session.get_history(max_messages=500) == [{- "role": "user",- "content": "please use @linear",- }]---def test_public_history_does_not_synthesize_legacy_capability_context():+def test_public_history_omits_cli_app_breadcrumb():session = Session(key="test:legacy-capabilities")session.messages.append({"role": "user","content": "please use the attachments","cli_apps": [{"name": "drawio", "entry_point": "cli-anything-drawio"}],- "mcp_presets": [{"name": "linear", "transport": "stdio"}],})public_history = session.get_history(