Forked Effect Gets Interrupted Immediately While Parent Continues Running

I'm having such a weird bug, where deep inside my program, any Effect I fork gets immediately interrupted, even though the parent process continues running. Here's an excerpt of my code:

Effect.gen(function*(){
  //...

  yield* Effect.addFinalizer((x) => Effect.logError('parent exit', x));

  const fiber = yield* pipe(
    Effect.logDebug('test'),
    Effect.repeat(Schedule.spaced(250)),
    Effect.onExit((x) => Effect.logError('child exit', x, Exit.isInterrupted(x))),
    Effect.fork
  );

  yield* Effect.logDebug('fiber', yield* Fiber.pretty(fiber));

  //...
}).pipe(Stream.unwrapScoped);


What's happening is:

- DEBUG fiber [Fiber](#220) (0ms) Status: Running
- ERROR child exit { _op: "Failure", ... } true
- the parent never exits (the returned Stream continues to be consumed forever)

Any ideas what could be causing such behavior? The Exit value has an effect_instruction_i0 with a bunch of nested Sequentials where a few leafs are Interrupts. If I use forkDaemon, the Interrupt doesn't occur, which hints at the interrupt being triggered by auto-supervision, but then, shouldn't I see the parent finalizers running too?
Was this page helpful?