diff --git a/packages/dashboard/src/routes.ts b/packages/dashboard/src/routes.ts index 2f30022ef..34c2d23c2 100644 --- a/packages/dashboard/src/routes.ts +++ b/packages/dashboard/src/routes.ts @@ -9713,6 +9713,18 @@ export function createApiRoutes(store: TaskStore, options?: ServerOptions): Rout } } // Don't return — subscribe to continue receiving events (thinking, next question, etc.) + } else if (lastEventId === undefined) { + // First-connect catch-up for a session that is still generating its + // first response: there is no question or summary yet, but the agent + // may already be streaming thinking deltas into the buffer faster + // than the client could establish the SSE connection. Replay every + // buffered event so the user sees the running thinking output from + // the start of generation, especially on slower mobile connections. + const buffered = planningStreamManager.getBufferedEvents(sessionId, 0); + if (!replayBufferedSSE(res, buffered)) { + res.end(); + return; + } } // Subscribe to session events