Skip to content

Commit

Permalink
Fix pr #5246: Fix issue #5015: [Bug]: Headless mode awaits for reques…
Browse files Browse the repository at this point in the history
…ted user feedb…
  • Loading branch information
openhands-agent committed Nov 26, 2024
1 parent 1687d54 commit dfa625e
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions openhands/controller/agent_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,21 +646,18 @@ async def _handle_traffic_control(
else:
self.state.traffic_control_state = TrafficControlState.THROTTLING
if self.headless_mode:
# In headless mode, we should stop the agent with an error
self.log(
'warning',
e = RuntimeError(
f'Agent reached maximum {limit_type} in headless mode. '
f'Current {limit_type}: {current_value:.2f}, max {limit_type}: {max_value:.2f}',
f'Current {limit_type}: {current_value:.2f}, max {limit_type}: {max_value:.2f}'
)
await self.set_agent_state_to(AgentState.ERROR)
await self._react_to_exception(e)
else:
self.log(
'warning',
e = RuntimeError(
f'Agent reached maximum {limit_type}. '
f'Current {limit_type}: {current_value:.2f}, max {limit_type}: {max_value:.2f}. '
f'{TRAFFIC_CONTROL_REMINDER}',
)
await self.set_agent_state_to(AgentState.PAUSED)
# FIXME: this isn't really an exception--we should have a different path
await self._react_to_exception(e)
stop_step = True
return stop_step

Expand Down

0 comments on commit dfa625e

Please sign in to comment.