Skip to content

Self-improving AI Employees for everyone

fix: agent handle labels, console log order, and WebSocket connect perf

trohitg080beb3a0621
diff --git a/client/src/components/AIAgentNode.tsx b/client/src/components/AIAgentNode.tsx
index 91d579c3..a7319b32 100644
--- a/client/src/components/AIAgentNode.tsx
+++ b/client/src/components/AIAgentNode.tsx
@@ -385,8 +385,8 @@ const AGENT_CONFIGS: Record<string, AgentConfig> = {
subtitle: 'LangChain DeepAgents',
themeColorKey: 'green',
bottomHandles: [
- { id: 'input-skill', label: 'Skill', position: '20%' },
- { id: 'input-teammates', label: 'Team', position: '50%' },
+ { id: 'input-skill', label: 'Skill', position: '30%' },
+ { id: 'input-teammates', label: 'Team', position: '55%' },
{ id: 'input-tools', label: 'Tool', position: '80%' },
],
leftHandles: [
@@ -627,19 +627,18 @@ const AIAgentNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnecta
))}
{/* Bottom Handle Labels */}
- <div style={{
- position: 'absolute',
- bottom: theme.spacing.lg,
- left: '0',
- right: '0',
- display: 'flex',
- justifyContent: 'space-around',
- fontSize: theme.fontSize.sm,
- color: theme.colors.text,
- fontWeight: theme.fontWeight.medium
- }}>
- {config.bottomHandles.map(h => <span key={h.id}>{h.label}</span>)}
- </div>
+ {config.bottomHandles.map(h => (
+ <span key={`label-${h.id}`} style={{
+ position: 'absolute',
+ bottom: theme.spacing.lg,
+ left: h.position,
+ transform: 'translateX(-50%)',
+ fontSize: theme.fontSize.sm,
+ color: theme.colors.text,
+ fontWeight: theme.fontWeight.medium,
+ whiteSpace: 'nowrap',
+ }}>{h.label}</span>
+ ))}
{/* Bottom Handles */}
{config.bottomHandles.map(h => (
diff --git a/server/core/database.py b/server/core/database.py
index 17aec2ff..c3af8323 100644
--- a/server/core/database.py
+++ b/server/core/database.py
@@ -916,7 +916,8 @@ class Database:
result = await session.execute(stmt)
logs = result.scalars().all()
- # Return in chronological order (oldest first)
+ # Return in reverse-chronological order (newest first)
+ # Matches real-time prepend convention in WebSocketContext
return [
{
"node_id": log.node_id,
@@ -930,7 +931,7 @@ class Database:
"source_node_label": log.source_node_label,
"timestamp": log.created_at.isoformat(),
}
- for log in reversed(logs)
+ for log in logs
]
except Exception as e:
diff --git a/server/services/status_broadcaster.py b/server/services/status_broadcaster.py
index 9de86b2d..722b5281 100644
--- a/server/services/status_broadcaster.py
+++ b/server/services/status_broadcaster.py
@@ -80,29 +80,17 @@ class StatusBroadcaster:
}
async def connect(self, websocket: WebSocket):
- """Accept a new WebSocket connection."""
+ """Accept a new WebSocket connection.
+
+ Sends cached status immediately so the client is unblocked,
+ then refreshes service statuses in a background task.
+ """
await websocket.accept()
async with self._lock:
self._connections.add(websocket)
logger.info(f"[StatusBroadcaster] Client connected. Total: {len(self._connections)}")
- # Fetch fresh WhatsApp status before sending initial_status
- # This ensures client sees actual connection state (especially after auto-connect)
- await self._refresh_whatsapp_status()
-
- # Fetch Twitter status from stored OAuth tokens
- await self._refresh_twitter_status()
-
- # Fetch Google Workspace status from stored OAuth tokens
- await self._refresh_google_status()
-
- # Refresh Telegram status from stored token and auto-reconnect
- await self._refresh_telegram_status()
-
- # Auto-reconnect Android relay if there's a stored session
- await self._auto_reconnect_android_relay()
-
- # Send current full status immediately
+ # Send cached status immediately -- don't block on service refreshes
try:
await websocket.send_json({
"type": "initial_status",
@@ -111,12 +99,39 @@ class StatusBroadcaster:
except Exception as e:
logger.error(f"[StatusBroadcaster] Failed to send initial status: {e}")
+ # Refresh service statuses in background -- updates broadcast when ready
+ asyncio.create_task(self._refresh_all_services())
+
async def disconnect(self, websocket: WebSocket):
"""Remove a WebSocket connection."""
async with self._lock:
self._connections.discard(websocket)
logger.info(f"[StatusBroadcaster] Client disconnected. Total: {len(self._connections)}")
+ async def _refresh_all_services(self):
+ """Refresh all service statuses concurrently and broadcast updates.
+
+ Runs as a background task so the WebSocket handshake is never
+ blocked by slow network calls. Uses asyncio.gather with
+ return_exceptions so one failure does not prevent others.
+ """
+ results = await asyncio.gather(
+ self._refresh_whatsapp_status(),
+ self._refresh_twitter_status(),
+ self._refresh_google_status(),
+ self._refresh_telegram_status(),
+ self._auto_reconnect_android_relay(),
+ return_exceptions=True,
+ )
+ for r in results:
+ if isinstance(r, Exception):
+ logger.warning("[StatusBroadcaster] Service refresh failed: %s", r)
+
+ try:
+ await self.broadcast({"type": "full_status", "data": self._status})
+ except Exception as e:
+ logger.warning("[StatusBroadcaster] Failed to broadcast refreshed status: %s", e)
+
async def broadcast(self, message: Dict[str, Any]):
"""Broadcast a message to all connected clients using TaskGroup.
diff --git a/workflows/AI Employee[Experimental].json b/workflows/AI Employee[Experimental].json
index 39fcd02e..a8c14c0b 100644
--- a/workflows/AI Employee[Experimental].json
+++ b/workflows/AI Employee[Experimental].json
@@ -1,5 +1,5 @@
{
- "id": "example_example_workflow-1772437472641-wdn3sj4us",
+ "id": "example_workflow-1772437472641-wdn3sj4us",
"name": "AI Employee[Experimental]",
"nodes": [
{
diff --git a/workflows/Zeenie Agent.json b/workflows/Zeenie Agent.json
index 718c0f36..4e2d0714 100644
--- a/workflows/Zeenie Agent.json
+++ b/workflows/Zeenie Agent.json
@@ -1,5 +1,5 @@
{
- "id": "example_example_example_example_example_example_workflow-1770568399727-b5zkjpuda",
+ "id": "example_workflow-1770568399727-b5zkjpuda",
"name": "Zeenie Agent",
"nodes": [
{
diff --git a/workflows/Zeenie Assistant.json b/workflows/Zeenie Assistant.json
index a17c3e8f..5e1ea242 100644
--- a/workflows/Zeenie Assistant.json
+++ b/workflows/Zeenie Assistant.json
@@ -1,5 +1,5 @@
{
- "id": "example_example_example_workflow-1772151325023-i7zkjbt04",
+ "id": "example_workflow-1772151325023-i7zkjbt04",
"name": "Zeenie Assistant",
"nodes": [
{