fix(gateway): use request context for session run state

This commit is contained in:
Val Alexander
2026-05-02 10:35:27 -05:00
parent 809a42d172
commit 1f4c8728c8

View File

@@ -677,22 +677,17 @@ export const sessionsHandlers: GatewayRequestHandlers = {
modelCatalog,
opts: p,
});
const activeSessionKeys = new Set<string>();
if (chatHandlers.chatAbortControllers.size > 0) {
for (const run of chatHandlers.chatAbortControllers.values()) {
const sessionKey = resolveSessionKeyForRun(run);
if (typeof sessionKey === "string" && sessionKey.length > 0) {
activeSessionKeys.add(sessionKey);
}
}
}
respond(
true,
{
...result,
sessions: result.sessions.map((session) =>
Object.assign({}, session, {
hasActiveRun: activeSessionKeys.has(session.key),
hasActiveRun: hasTrackedActiveSessionRun({
context,
requestedKey: session.key,
canonicalKey: session.key,
}),
}),
),
},