fix(agent): restore MCP wait timeout and fix direct URL navigation

- Restore 50-second self-imposed timeout for agent wait operations in MCP
  server. Returns friendly message instead of letting SDK timeout trigger
  generic "tool failed" error that confuses orchestrator agents.

- Fix direct URL navigation to agent screens by waiting for WebSocket
  connection before initializing. Previously, init would fire before WS
  connected, fail silently, and never retry due to guard ref.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Mohamed Boudra
2026-01-05 23:47:58 +07:00
co-authored by Claude Opus 4.5
parent 348242541c
commit 33a3031f74
2 changed files with 88 additions and 9 deletions
@@ -438,6 +438,11 @@ function AgentScreenContent({
return;
}
// Skip if not connected - will re-run when connection is established
if (!ws?.isConnected) {
return;
}
// Skip if already initializing
if (isInitializingFromMap === true) {
return;
@@ -459,7 +464,7 @@ function AgentScreenContent({
});
initializeAgent({ agentId: resolvedAgentId });
}, [resolvedAgentId, initializeAgent, isInitializingFromMap]);
}, [resolvedAgentId, initializeAgent, isInitializingFromMap, ws?.isConnected]);
useEffect(() => {
if (Platform.OS !== "web") {