Files
codex/codex-rs/tui/src/app_server_session/events.rs
T
Benjamin Carlsson e4568a3538 Reject TUI events from a different backend (#55304)
## Why

Events from another backend must not mutate the current backend's thread or connection state, even when native thread IDs collide.

## What changed

Attach the session's `BackendId` to incoming app-server events and check it before dispatching to thread caches or UI handlers. Apply the same check when waiting for a thread revert notification.

## Testing

Add regression tests covering ignored foreign notifications, approval requests, lag and disconnect events, accepted events from the current backend, and preservation of backend identity on transport events.

GitOrigin-RevId: 2577ab78e0592726f5f05e3426772899e6cb7c7e
2026-10-19 15:20:42 +00:00

11 lines
370 B
Rust

//! Retains the logical backend that produced a session event before UI dispatch.
//! Backend identity survives reconnects; it is not a transport generation or wire ID.
use crate::backend_id::BackendId;
use codex_app_server_client::AppServerEvent;
pub(crate) struct AppServerSessionEvent {
pub(crate) backend_id: BackendId,
pub(crate) event: AppServerEvent,
}