mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-30 14:51:58 +00:00
fix(core): complete supervisor flush when plugin activation fails (#45783)
This commit is contained in:
parent
a2dcf2dff0
commit
89ca9fc641
2 changed files with 16 additions and 2 deletions
|
|
@ -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 }),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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* () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue