fix(core): drain cross-realm execution promises

This commit is contained in:
Yichen Jiang
2026-07-16 18:07:23 +08:00
parent 5a5591205f
commit b1e19d8b69
3 changed files with 29 additions and 2 deletions
+2 -1
View File
@@ -6,6 +6,7 @@
import type { Context } from 'cordis'
import { AsyncLocalStorage } from 'node:async_hooks'
import { isPromise } from 'node:util/types'
import type { AgentExecution } from './types.ts'
export type { AgentExecution } from './types.ts'
@@ -75,7 +76,7 @@ class DefaultAgentExecutionService implements AgentExecutionService {
this.releaseRun()
throw error
}
if (result instanceof Promise) {
if (isPromise(result)) {
void result.then(
() => { this.releaseRun() },
() => { this.releaseRun() },