The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(acp): messages=[] from run_conversation clears the ACP transcript
teknium160797460b6ce
diff --git a/acp_adapter/server.py b/acp_adapter/server.pyindex 4831a9acd0a..adb8d58e7f2 100644--- a/acp_adapter/server.py+++ b/acp_adapter/server.py@@ -878,7 +878,9 @@ class HermesACPAgent(SlashCommandsMixin, acp.Agent):streamed_message: bool,) -> PromptResponse:"""Persist, emit provenance/final text, drain queued prompts, report usage."""- if result.get("messages"):+ # Key presence, not truthiness: ``messages=[]`` is a legitimate cleared transcript (#10844);+ # only a result without the key leaves the history untouched.+ if "messages" in result and isinstance(result["messages"], list):state.history = result["messages"]self.session_manager.save_session(session_id)diff --git a/tests/acp/test_server.py b/tests/acp/test_server.pyindex 54f232162f4..047c86e6c98 100644--- a/tests/acp/test_server.py+++ b/tests/acp/test_server.py@@ -446,6 +446,24 @@ class TestPrompt:assert captured.get("child") == resp.session_id+ @pytest.mark.asyncio+ async def test_empty_messages_list_replaces_stale_history(self, agent, mock_manager):+ """``run_conversation`` returning ``messages=[]`` clears the ACP transcript instead of+ leaving the previous turn's history in place (#10844)."""+ resp = await agent.new_session(cwd=".")+ state = mock_manager.get_session(resp.session_id)+ state.history = [{"role": "user", "content": "old"}]+ state.agent.run_conversation = MagicMock(return_value={"final_response": "done", "messages": []})+ state.agent.model = "test-model"+ state.agent.provider = "openrouter"+ mock_conn = MagicMock(spec=acp.Client)+ mock_conn.session_update = AsyncMock()+ agent._conn = mock_conn++ await agent.prompt(prompt=[TextContentBlock(type="text", text="hi")], session_id=resp.session_id)++ assert state.history == []+