mirror of
https://github.com/openai/codex.git
synced 2026-10-28 18:58:46 +00:00
## Why A thread ID alone does not identify the backend that owns a session. Resume and fork selections must retain that ownership across connection replacement so they cannot operate on another backend, even when thread IDs match. ## What changed - Add a process-local `BackendId` to app-server sessions and session targets, preserving it across reconnects and auxiliary picker connections. - Reject selections from a different backend before changing session state or sending resume, fork, or unarchive requests. - Disable local-daemon fallback to an embedded server for auxiliary pickers and after selecting a session, while retaining fallback for fresh startup. ## Testing Add regression coverage for foreign selections with matching thread IDs, startup resume and fork rejection before requests, shared ownership across picker connections, and fallback eligibility. GitOrigin-RevId: 05a3ca0a901a8dc24337d130548aa2c048b4d586
13 lines
448 B
Rust
13 lines
448 B
Rust
//! Logical backend identity, independent of a transport connection or native thread ID.
|
|
//! Reconnecting and auxiliary picker connections reuse the launch owner; a different
|
|
//! backend gets a fresh identity. These process-local IDs never appear on the wire.
|
|
|
|
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
|
pub(crate) struct BackendId(uuid::Uuid);
|
|
|
|
impl BackendId {
|
|
pub(crate) fn new() -> Self {
|
|
Self(uuid::Uuid::new_v4())
|
|
}
|
|
}
|