mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-16 17:36:07 +00:00
fix(box): handle RPC failure in get_status/get_sessions gracefully
When the Box runtime disconnects, there is a race between the heartbeat flipping _available=false and the frontend polling get_status(). If the poll arrives first, client.get_status() throws a ConnectionClosedError which propagated as a 500, causing the frontend to show a grey dot (null status) instead of a red dot with error details. Now get_status() catches RPC errors and returns available=false with the exception message as connector_error. get_sessions() returns an empty list when unavailable or on RPC failure.
This commit is contained in:
@@ -182,6 +182,7 @@ async def test_box_service_get_sessions_delegates_to_client():
|
||||
client.get_sessions = AsyncMock(return_value=[{'session_id': 'test-session'}])
|
||||
|
||||
service = BoxService(make_app(Mock()), client=client)
|
||||
service._available = True
|
||||
|
||||
sessions = await service.get_sessions()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user