Repository navigation
Commit 6009ad0
fix(server): keep the Codex event forwarder alive while the runtime closes
The adapter handed its session scope to the runtime, and `runtime.close`
closes that scope before ending its event stream. That interrupted the
forwarder running in the same scope, so `session/closed` was still lost
and the drain wait in `stopSessionInternal` joined an interrupted fiber,
which interrupted the stop itself.
- Give the runtime a child of the session scope, so closing it stops the
app-server without touching the forwarder.
- Wait for the forwarder with `Fiber.await` instead of `Fiber.join`.
- The fake runtime now closes its supplied scope like the real one, and
the drain test runs on the live clock so a lost exit fails in 2s.
- Add a registry test that removes a live Codex instance (real adapter,
real runtime, mock app-server) and expects `session.exited`.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>1 parent d77541f commit 6009ad0
3 files changed
Lines changed: 73 additions & 13 deletions
File tree
- apps/server/src/provider/Layers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
127 | 128 | | |
128 | | - | |
| 129 | + | |
129 | 130 | | |
| 131 | + | |
130 | 132 | | |
131 | 133 | | |
132 | 134 | | |
| |||
180 | 182 | | |
181 | 183 | | |
182 | 184 | | |
183 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
184 | 188 | | |
185 | 189 | | |
186 | 190 | | |
| |||
193 | 197 | | |
194 | 198 | | |
195 | 199 | | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
201 | 207 | | |
202 | 208 | | |
203 | 209 | | |
| |||
213 | 219 | | |
214 | 220 | | |
215 | 221 | | |
216 | | - | |
| 222 | + | |
217 | 223 | | |
218 | 224 | | |
219 | 225 | | |
| |||
227 | 233 | | |
228 | 234 | | |
229 | 235 | | |
230 | | - | |
| 236 | + | |
231 | 237 | | |
232 | 238 | | |
233 | 239 | | |
| |||
1836 | 1842 | | |
1837 | 1843 | | |
1838 | 1844 | | |
1839 | | - | |
| 1845 | + | |
1840 | 1846 | | |
1841 | 1847 | | |
1842 | 1848 | | |
1843 | 1849 | | |
1844 | 1850 | | |
1845 | 1851 | | |
1846 | | - | |
| 1852 | + | |
| 1853 | + | |
1847 | 1854 | | |
1848 | 1855 | | |
1849 | 1856 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2348 | 2348 | | |
2349 | 2349 | | |
2350 | 2350 | | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
2351 | 2355 | | |
2352 | | - | |
| 2356 | + | |
2353 | 2357 | | |
2354 | 2358 | | |
2355 | 2359 | | |
| |||
2766 | 2770 | | |
2767 | 2771 | | |
2768 | 2772 | | |
2769 | | - | |
| 2773 | + | |
| 2774 | + | |
2770 | 2775 | | |
2771 | 2776 | | |
2772 | 2777 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
| 48 | + | |
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
| |||
467 | 470 | | |
468 | 471 | | |
469 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
470 | 518 | | |
471 | 519 | | |
472 | 520 | | |
| |||
0 commit comments