Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Fix undefined cache key access
Tomas Valenta28562afdf32a
diff --git a/api-service/playground/src/sessions/session.ts b/api-service/playground/src/sessions/session.tsindex a24779c80..f73a668bb 100644--- a/api-service/playground/src/sessions/session.ts+++ b/api-service/playground/src/sessions/session.ts@@ -21,6 +21,8 @@ sessionCache.on('expired', async function (_, cached: CachedSession) {export class CachedSession {private readonly cachedProcesses: CachedProcess[] = []+ private closed = false+ports: OpenPort[] = []id?: string@@ -60,11 +62,11 @@ export class CachedSession {async delete() {if (!this.id) return+ if (this.closed) return+ this.closed = trueawait this.session.close()sessionCache.del(this.id)-- this.id = undefined}async stopProcess(processID: string) {@@ -95,6 +97,7 @@ export class CachedSession {}static findSession(id: string) {+const cachedSession = sessionCache.get(id) as CachedSessionif (!cachedSession) throw new Error('Session does not exist')return cachedSession