diff --git a/packages/coding-agent/src/core/gateway-runtime.ts b/packages/coding-agent/src/core/gateway-runtime.ts index f3c03e54..cc5149a0 100644 --- a/packages/coding-agent/src/core/gateway-runtime.ts +++ b/packages/coding-agent/src/core/gateway-runtime.ts @@ -627,7 +627,6 @@ export class GatewayRuntime { }); response.write("\n"); - const managedSession = await this.ensureSession(sessionKey); const listener = createVercelStreamListener(response); let unsubscribe: (() => void) | undefined; let streamingActive = false; @@ -648,6 +647,7 @@ export class GatewayRuntime { // Drive the session through the existing queue infrastructure try { + const managedSession = await this.ensureSession(sessionKey); const result = await this.enqueueManagedMessage({ request: { sessionKey,