fix(core): complete supervisor flush when plugin activation fails (#45783)

This commit is contained in:
Kit Langton 2026-08-27 20:16:25 -04:00 committed by GitHub
parent a2dcf2dff0
commit 89ca9fc641
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 2 deletions

View file

@ -125,9 +125,9 @@ export const layer = Layer.effect(
Stream.debounce("100 millis"),
Stream.runForEach((target) =>
Effect.gen(function* () {
yield* activate()
yield* activate().pipe(Effect.catchCause((cause) => Effect.logError("failed to reload plugins", { cause })))
if (observed === target) yield* ready.open
}).pipe(Effect.catchCause((cause) => Effect.logError("failed to reload plugins", { cause }))),
}),
),
Effect.forkScoped({ startImmediately: true }),
)

View file

@ -427,6 +427,20 @@ describe("PluginSupervisor config", () => {
}),
),
)
it.live("unblocks flush when plugin activation fails", () =>
Effect.gen(function* () {
const sdk = yield* SdkPlugins.Service
yield* sdk.register(EffectPlugin.define({ id: "duplicate-id", effect: () => Effect.void }))
yield* sdk.register(EffectPlugin.define({ id: "duplicate-id", effect: () => Effect.void }))
yield* withLocation(
undefined,
Effect.gen(function* () {
yield* ready().pipe(Effect.timeout("2 seconds"))
}),
)
}),
)
})
const ready = Effect.fnUntraced(function* () {