Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,26 @@ export function App(): JSX.Element {
? (agents.find((item) => item.id === resolvedAgentId) ?? null)
: null;
if (!agent || agent.status !== "running") {
const payload = await api<{ agent: Agent }>(
`/api/v1/agents/${resolvedAgentId}?includeGitContext=false`
);
agent = payload.agent;
try {
const payload = await api<{ agent: Agent }>(
`/api/v1/agents/${resolvedAgentId}?includeGitContext=false`
);
agent = payload.agent;
} catch {
// Server is temporarily unreachable (e.g. mid-deploy). Schedule a
// retry so reconnection continues once the server is back up.
if (!shouldKeepAttachedRef.current) return;
clearReconnectTimer();
reconnectAttemptsRef.current += 1;
const delay = Math.min(1200 * reconnectAttemptsRef.current, 8000);
setConnState("reconnecting");
setStatusMessage("Session disconnected, reconnecting...");
reconnectTimerRef.current = window.setTimeout(() => {
reconnectTimerRef.current = null;
void ensureTerminalConnected(false, false, resolvedAgentId);
}, delay);
return;
}
}

if (agent.status !== "running") {
Expand Down