From 06b63a55bd746458316e01b41ba9ff2d7901b9f3 Mon Sep 17 00:00:00 2001 From: user Date: Mon, 15 Jun 2026 18:25:01 -0400 Subject: [PATCH] fix(frontend): prevent session polling from stopping permanently after backend errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the backend restarts during session creation, useSession's refetchInterval callback receives undefined data (query in error state). Without an early return, the phase-based logic falls through to `return false`, permanently stopping polling. The session UI gets stuck on "Starting Session" and never recovers. Add early return `if (\!session) return 2000` to keep polling every 2s when data is unavailable, allowing the UI to recover once the backend is reachable again. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- components/frontend/src/services/queries/use-sessions.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/frontend/src/services/queries/use-sessions.ts b/components/frontend/src/services/queries/use-sessions.ts index e6945c947..f58382f33 100755 --- a/components/frontend/src/services/queries/use-sessions.ts +++ b/components/frontend/src/services/queries/use-sessions.ts @@ -80,6 +80,8 @@ export function useSession(projectName: string, sessionName: string, port: Sessi retryDelay: (attemptIndex) => Math.min(1000 * 2 ** attemptIndex, 10000), refetchInterval: (query) => { const session = query.state.data as AgenticSession | undefined; + if (!session) return 2000; + const phase = session?.status?.phase; const annotations = session?.metadata?.annotations || {};