π OpenHands: AI-Driven Development
SocketIO init event ordering (#5714)
diwu-sf5e8c20f406f5
diff --git a/openhands/server/listen_socket.py b/openhands/server/listen_socket.pyindex 969e9c175d..4bd7b80719 100644--- a/openhands/server/listen_socket.py+++ b/openhands/server/listen_socket.py@@ -4,6 +4,7 @@ from github import Githubfrom socketio.exceptions import ConnectionRefusedErrorfrom openhands.core.logger import openhands_logger as logger+from openhands.core.schema.agent import AgentStatefrom openhands.events.action import (NullAction,)@@ -79,10 +80,11 @@ async def connect(connection_id: str, environ, auth):):continueelif isinstance(event, AgentStateChangedObservation):+ if event.agent_state == AgentState.INIT:+ await sio.emit('oh_event', event_to_dict(event), to=connection_id)agent_state_changed = event- continue- await sio.emit('oh_event', event_to_dict(event), to=connection_id)-+ else:+ await sio.emit('oh_event', event_to_dict(event), to=connection_id)if agent_state_changed:await sio.emit('oh_event', event_to_dict(agent_state_changed), to=connection_id)