Spawning a fiber will disable effect handlers installed after main loop

I feel like there are two issues discussed there. One issue is exhibited by the following code:

The above program does NOT crash with my current version of OCaml and the libraries. So that’s no longer an issue it seems. I believe it was solved here.

However, my issue is that when I switch these statements

 let main () =
-  Echo.run (fun () ->
-      Eio_main.run (fun _ ->
+  Eio_main.run (fun _ ->
+      Echo.run (fun () ->
           Eio.Fiber.both
             (fun () ->

then the effect won’t be handled.

This is the same problem as exhibited in the program in my OP in this topic (and if I’m not mistaken, then the OP of the other thread also installs the effect handler between the event loop and the fiber creation).

One might ask, why not install all handlers outside the Eio_main.run event loop. Well, that’s not always practical. In particular, a function x might receive a callback y and make use of fibers internally which then use the callback y. If that callback y makes use of effects, we can’t call x with those effect being handled locally because the fibers will disable the handlers (like in my example code in the beginning of this thread).

To my understanding, one purpose of effects is to “pass” them through the stack without any functions in between on the stack needing to know something about them (similar to exceptions bubbling up the stack). Now this goal seems to be missed by the current implementation in some (corner?) cases.