mirror of
https://github.com/openai/codex.git
synced 2026-11-23 23:10:47 +00:00
## Why Clearing the active thread could drop its receiver and discard unread events. A queued close from an old stream could also trigger close handling while the same thread was being reattached. ## What changed Keep each receiver in its thread's event channel and look it up by the active thread ID. When a live attachment replaces the active thread's stream, drain pending events and skip the old stream's `ThreadClosed` notification unless the TUI is waiting for it to finish shutting down. ## Testing Cover switching focus away and back without losing or misrouting unread events. Exercise same-thread reattachment with a queued close, both with and without a pending shutdown. GitOrigin-RevId: b58767b2666ddbb64b09e6542ec8f550538531b6