Commit 4e4055c
committed
Fix detached fiber in ClaudeCodeAdapter to use Effect.forkDetach with explicit interruption
Replace Effect.runFork(runSdkStream(context)) with yield* Effect.forkDetach()
to properly inherit provided services (e.g. deterministic Random in tests)
and enable deterministic cleanup.
Store the fiber reference in ClaudeSessionContext and interrupt it in
stopSessionInternal before other cleanup, eliminating the race window
where the stream fiber could offer events to runtimeEventQueue after
it has been shut down by the scope finalizer.1 parent dc91dc5 commit 4e4055c
1 file changed
+21
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
35 | 46 | | |
36 | 47 | | |
37 | 48 | | |
| |||
99 | 110 | | |
100 | 111 | | |
101 | 112 | | |
| 113 | + | |
102 | 114 | | |
103 | 115 | | |
104 | 116 | | |
| |||
117 | 129 | | |
118 | 130 | | |
119 | 131 | | |
120 | | - | |
121 | | - | |
122 | | - | |
| 132 | + | |
123 | 133 | | |
124 | 134 | | |
125 | 135 | | |
| |||
695 | 705 | | |
696 | 706 | | |
697 | 707 | | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
698 | 713 | | |
699 | 714 | | |
700 | 715 | | |
| |||
967 | 982 | | |
968 | 983 | | |
969 | 984 | | |
| 985 | + | |
970 | 986 | | |
971 | 987 | | |
972 | 988 | | |
| |||
981 | 997 | | |
982 | 998 | | |
983 | 999 | | |
984 | | - | |
| 1000 | + | |
985 | 1001 | | |
986 | 1002 | | |
987 | 1003 | | |
| |||
0 commit comments