Repository: All-Hands-AI/OpenHands
File: openhands/server/session/session.py (Python)

Code before:
            _waiting_times = 1

            if self.sio:
                # Get timeout from configuration, default to 30 seconds
                client_wait_timeout = self.config.client_wait_timeout
                self.logger.debug(
                    f'Using client wait timeout: {client_wait_timeout}s for session {self.sid}'
                )

                # Wait once during initialization to avoid event push failures during websocket connection intervals
                while self._wait_websocket_initial_complete and (
                    time.time() - _start_time < client_wait_timeout
                ):
                    if bool(
                        self.sio.manager.rooms.get('/', {}).get(
                            ROOM_KEY.format(sid=self.sid)
                        )
                    ):
                        break

                    # Progressive backoff: start with 0.1s, increase to 1s after 10 attempts
                    sleep_duration = 0.1 if _waiting_times <= 10 else 1.0

                    # Log every 2 seconds to reduce spam
                    if _waiting_times % (20 if sleep_duration == 0.1 else 2) == 0:
                        self.logger.warning(
                            f'There is no listening client in the current room,'
                            f' waiting for the {_waiting_times}th attempt (timeout: {client_wait_timeout}s): {self.sid}'
                        )
                    _waiting_times += 1
                    await asyncio.sleep(sleep_duration)
                self._wait_websocket_initial_complete = False
                await self.sio.emit('oh_event', data, to=ROOM_KEY.format(sid=self.sid))

            await asyncio.sleep(0.001)  # This flushes the data to the client
            self.last_active_ts = int(time.time())
            return True
        except RuntimeError as e:
            self.logger.error(f'Error sending data to websocket: {str(e)}')
            self.is_alive = False
            return False

    async def send_error(self, message: str) -> None:
        """Sends an error message to the client."""
        await self.send({'error': True, 'message': message})

    async def _send_status_message(
        self, msg_type: str, runtime_status: RuntimeStatus, message: str
    ) -> None:
        """Sends a status message to the client."""
        if msg_type == 'error':

Review comment (bug):
```suggestion
                        self.logger.debug(
```

Code after:
            _waiting_times = 1

            if self.sio:
                # Get timeout from configuration, default to 30 seconds
                client_wait_timeout = self.config.client_wait_timeout
                self.logger.debug(
                    f'Using client wait timeout: {client_wait_timeout}s for session {self.sid}'
                )

                # Wait once during initialization to avoid event push failures during websocket connection intervals
                while self._wait_websocket_initial_complete and (
                    time.time() - _start_time < client_wait_timeout
                ):
                    if bool(
                        self.sio.manager.rooms.get('/', {}).get(
                            ROOM_KEY.format(sid=self.sid)
                        )
                    ):
                        break

                    # Progressive backoff: start with 0.1s, increase to 1s after 10 attempts
                    sleep_duration = 0.1 if _waiting_times <= 10 else 1.0

                    # Log every 2 seconds to reduce spam
                    if _waiting_times % (20 if sleep_duration == 0.1 else 2) == 0:
                        self.logger.debug(
                            f'There is no listening client in the current room,'
                            f' waiting for the {_waiting_times}th attempt (timeout: {client_wait_timeout}s): {self.sid}'
                        )
                    _waiting_times += 1
                    await asyncio.sleep(sleep_duration)
                self._wait_websocket_initial_complete = False
                await self.sio.emit('oh_event', data, to=ROOM_KEY.format(sid=self.sid))

            await asyncio.sleep(0.001)  # This flushes the data to the client
            self.last_active_ts = int(time.time())
            return True
        except RuntimeError as e:
            self.logger.error(f'Error sending data to websocket: {str(e)}')
            self.is_alive = False
            return False

    async def send_error(self, message: str) -> None:
        """Sends an error message to the client."""
        await self.send({'error': True, 'message': message})

    async def _send_status_message(
        self, msg_type: str, runtime_status: RuntimeStatus, message: str
    ) -> None:
        """Sends a status message to the client."""
        if msg_type == 'error':