test(agent-loop): exclude unreachable teardown paths

This commit is contained in:
_Kerman committed 2026-08-31 13:37:19 +08:00
1 parent fcad57b3af
commit d776df1106
1 file changed
+2
+2
View File
@@ -564,7 +564,9 @@ export class AgentLoop extends Service implements AgentFactory {
// Disposal IS a disposed-cause cancel followed by quiescence. New work
// sent after this point is the sender's bug — the registries are about
// to drop the agent, so nothing should still hold it.
/* v8 ignore next -- Cordis effect teardown waits for synchronous setup before observing the machine slot. */
if (machine === undefined) await machineReady.promise
/* v8 ignore next -- setup failure untracks this disposer before resolving without a machine. */
if (machine !== undefined) {
machine.cancel({ kind: 'disposed' })
await machine.whenIdle()