fix: address cubic review issues - abort handling, error metadata, logger binding

This commit is contained in:
YeonGyu-Kim
2026-03-16 15:18:41 +09:00
parent 40f25fb07d
commit ed92a05e59
3 changed files with 16 additions and 6 deletions
+5 -2
View File
@@ -65,6 +65,7 @@ export function createOmoRunner(options: CreateOmoRunnerOptions): OmoRunner {
onError,
} = options
let connectionPromise: Promise<ServerConnection> | null = null
let connectionController: AbortController | null = null
let closed = false
let activeRun: Promise<unknown> | null = null
@@ -78,11 +79,11 @@ export function createOmoRunner(options: CreateOmoRunnerOptions): OmoRunner {
throw new Error("Runner is closed")
}
if (connectionPromise === null) {
const controller = new AbortController()
connectionController = new AbortController()
connectionPromise = createServerConnection({
port,
attach,
signal: controller.signal,
signal: connectionController.signal,
logger: silentLogger,
})
}
@@ -178,9 +179,11 @@ export function createOmoRunner(options: CreateOmoRunnerOptions): OmoRunner {
},
async close() {
closed = true
connectionController?.abort()
const connection = await connectionPromise
connection?.cleanup()
connectionPromise = null
connectionController = null
},
}
}