From ec561894cb9fe39ca04950fe46afba8be29aa1d0 Mon Sep 17 00:00:00 2001 From: kumarabhirup Date: Thu, 19 Feb 2026 21:52:15 -0800 Subject: [PATCH] web: activate gateway subscription for rehydrated subagent streams --- apps/web/app/api/chat/subagent-stream/route.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/web/app/api/chat/subagent-stream/route.ts b/apps/web/app/api/chat/subagent-stream/route.ts index a0d1c8f74ba..75a93999587 100644 --- a/apps/web/app/api/chat/subagent-stream/route.ts +++ b/apps/web/app/api/chat/subagent-stream/route.ts @@ -1,4 +1,4 @@ -import { subscribeToSubagent, hasActiveSubagent, isSubagentRunning, ensureRegisteredFromDisk } from "@/lib/subagent-runs"; +import { subscribeToSubagent, hasActiveSubagent, isSubagentRunning, ensureRegisteredFromDisk, ensureSubagentStreamable } from "@/lib/subagent-runs"; import type { SseEvent } from "@/lib/subagent-runs"; import { existsSync, readFileSync } from "node:fs"; import { join } from "node:path"; @@ -51,6 +51,10 @@ export async function GET(req: Request) { return new Response("Subagent not found", { status: 404 }); } + // For still-running subagents rehydrated from disk, activate the gateway + // WebSocket subscription so new events arrive in real time. + ensureSubagentStreamable(sessionKey); + const isActive = isSubagentRunning(sessionKey); const encoder = new TextEncoder(); let closed = false;