refactor(agent-loop): declare the lifecycle disposer before its user

This commit is contained in:
_Kerman committed 2026-10-08 11:22:28 +08:00
1 parent aaf01e8182
commit d6340cc088
1 file changed
+1 -1
+1 -1
View File
@@ -589,6 +589,7 @@ export class AgentLoop extends Service implements AgentFactory {
}
throwCollectedFailures(failures, `agent "${id}" disposal failed`)
})())
let unfollowOwner: () => Promise<void> | void
const dispose = async (): Promise<void> => {
try {
await teardown()
@@ -597,7 +598,6 @@ export class AgentLoop extends Service implements AgentFactory {
}
}
const untrack = this.ownership.track(dispose)
let unfollowOwner: () => Promise<void> | void
try {
unfollowOwner = ownerCtx.effect(function* () {
machine = new ReactLoopAgent(loopCtx, id, options, session)