π OpenHands: AI-Driven Development
minor fixes for when commands time out (#5518)
Robert Brennan5fa18511b37e
diff --git a/openhands/controller/agent_controller.py b/openhands/controller/agent_controller.pyindex ed253c1710..21065f5e92 100644--- a/openhands/controller/agent_controller.py+++ b/openhands/controller/agent_controller.py@@ -184,7 +184,7 @@ class AgentController:self.state.local_iteration += 1async def update_state_after_step(self):- # update metrics especially for cost. Use deepcopy to avoid it being modified by agent.reset()+ # update metrics especially for cost. Use deepcopy to avoid it being modified by agent._reset()self.state.local_metrics = copy.deepcopy(self.agent.llm.metrics)async def _react_to_exception(@@ -317,9 +317,10 @@ class AgentController:elif action.source == EventSource.AGENT and action.wait_for_response:await self.set_agent_state_to(AgentState.AWAITING_USER_INPUT)- def reset_task(self) -> None:- """Resets the agent's task."""+ def _reset(self) -> None:+ """Resets the agent controller"""self.almost_stuck = 0+ self._pending_action = Noneself.agent.reset()async def set_agent_state_to(self, new_state: AgentState) -> None:@@ -337,7 +338,7 @@ class AgentController:returnif new_state in (AgentState.STOPPED, AgentState.ERROR):- self.reset_task()+ self._reset()elif (new_state == AgentState.RUNNINGand self.state.agent_state == AgentState.PAUSEDdiff --git a/openhands/runtime/utils/request.py b/openhands/runtime/utils/request.pyindex 46d730bfba..234464874f 100644--- a/openhands/runtime/utils/request.py+++ b/openhands/runtime/utils/request.py@@ -24,7 +24,7 @@ def send_request(timeout: int = 10,**kwargs: Any,) -> requests.Response:- response = session.request(method, url, **kwargs)+ response = session.request(method, url, timeout=timeout, **kwargs)try:response.raise_for_status()except requests.HTTPError as e: