Suppress stale cloud stream disconnects after reopening a thread (#60327)

## Why

A queued cloud stream disconnect can outlive a successful reopen of the same conversation, causing an obsolete reconnect error to reach the TUI.

## What changed

Represent cloud reply stream losses with `AppServerEvent::ThreadStreamDisconnected` and filter queued losses superseded by a successful attachment to the same thread. Preserve losses for other threads and any newer disconnects; failed reopen attempts do not supersede pending losses.

Continue displaying current stream disconnects through the TUI's error notification handler.

## Testing

Add regression coverage for successful and failed reopens, disconnect ordering across threads, and TUI handling of disconnect events from the active and foreign backends.

GitOrigin-RevId: 640332b817970717fc816ab5a32bf658c01233bf
This commit is contained in:
Benjamin Carlsson
2026-11-09 02:31:46 +00:00
committed by copyberry
parent b9796386e5
commit ffdf2daddb
8 changed files with 174 additions and 25 deletions
+1
View File
@@ -256,6 +256,7 @@ stream_max_retries = 0
return Ok::<_, color_eyre::eyre::Report>(());
}
}
codex_app_server_client::AppServerEvent::ThreadStreamDisconnected(_) => {}
codex_app_server_client::AppServerEvent::Lagged { .. }
| codex_app_server_client::AppServerEvent::Disconnected { .. } => {
panic!("lost app-server events during the tool round trip");