sisyfyZhang 259e1d1377
fix(runtime): yield once in RunJournal.flush() so cross-thread events survive on Python 3.13+ (#6565)
Since CPython gh-105836 (backported to 3.13) an awaited executor future can
complete without a loop iteration when the worker finished before the future
was chained, so a middleware event a worker handed to the owner loop with
call_soon_threadsafe may still be pending when flush() starts. The run-end
flush() -> _detach_runtime_dependencies() sequence then dropped it. Yield to
the loop once before draining and re-check _closed.

Fixes #6564

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-09 18:40:59 +08:00
..