π OpenHands: AI-Driven Development
(fix) CodeActAgent: use `content` of AgentDelegateObservation (#3970)
tobitege6682e0f1dd79
diff --git a/agenthub/codeact_agent/codeact_agent.py b/agenthub/codeact_agent/codeact_agent.pyindex ea45068e3f..c8d31ad046 100644--- a/agenthub/codeact_agent/codeact_agent.py+++ b/agenthub/codeact_agent/codeact_agent.py@@ -153,7 +153,10 @@ class CodeActAgent(Agent):text = truncate_content(text, max_message_chars)return Message(role='user', content=[TextContent(text=text)])elif isinstance(obs, AgentDelegateObservation):- text = obs_prefix + truncate_content(str(obs.outputs), max_message_chars)+ text = obs_prefix + truncate_content(+ obs.outputs['content'] if 'content' in obs.outputs else '',+ max_message_chars,+ )return Message(role='user', content=[TextContent(text=text)])elif isinstance(obs, ErrorObservation):text = obs_prefix + truncate_content(obs.content, max_message_chars)diff --git a/tests/integration/mock/eventstream_runtime/CodeActAgent/test_browse_internet/prompt_001.log b/tests/integration/mock/eventstream_runtime/CodeActAgent/test_browse_internet/prompt_001.logindex b488a9195d..856b5f45c4 100644--- a/tests/integration/mock/eventstream_runtime/CodeActAgent/test_browse_internet/prompt_001.log+++ b/tests/integration/mock/eventstream_runtime/CodeActAgent/test_browse_internet/prompt_001.log@@ -402,7 +402,13 @@ The server is running on port 5000 with PID 126. You can access the list of numbNOW, LET'S START!++----------+Browse localhost:8000, and tell me the ultimate answer to life. Do not ask me for confirmation at any point.+----------++ENVIRONMENT REMINDER: You have 19 turns left to complete the task. When finished reply with <finish></finish>.diff --git a/tests/integration/mock/eventstream_runtime/CodeActAgent/test_browse_internet/prompt_005.log b/tests/integration/mock/eventstream_runtime/CodeActAgent/test_browse_internet/prompt_005.logindex 769c883609..749ec17b7b 100644--- a/tests/integration/mock/eventstream_runtime/CodeActAgent/test_browse_internet/prompt_005.log+++ b/tests/integration/mock/eventstream_runtime/CodeActAgent/test_browse_internet/prompt_005.log@@ -402,6 +402,9 @@ The server is running on port 5000 with PID 126. You can access the list of numbNOW, LET'S START!++----------+Browse localhost:8000, and tell me the ultimate answer to life. Do not ask me for confirmation at any point.----------@@ -414,7 +417,10 @@ Browse localhost:8000, and tell me the ultimate answer to life. Do not ask me fo----------OBSERVATION:-{'content': 'The answer to life, the universe, and everything has been revealed: OpenHands is all you need!'}+The answer to life, the universe, and everything has been revealed: OpenHands is all you need!++----------+ENVIRONMENT REMINDER: You have 13 turns left to complete the task. When finished reply with <finish></finish>.