mirror of
https://github.com/openai/codex.git
synced 2026-11-13 21:30:47 +00:00
## Why Removing an executor must detach its selection even when older turn snapshots still reference it. Connection events queued for a removed attachment must not leak into a later selection of the same executor. ## What changed - Introduce `EnvironmentAttachment` with a detach signal shared by turn snapshots and a guard owned by the selection. - Preserve attachments across workspace and configuration changes, while giving reselections and child threads independent attachment lifetimes. - Stop forwarding connection events on detach and discard buffered events from detached attachments. - Activate initial attachments after `SessionConfigured`, using configured bindings for startup discovery. ## Testing Add coverage for discarding buffered connection events on reselection and extend snapshot tests to verify immediate detachment, fresh attachments on reselection, and independent parent and child lifetimes. GitOrigin-RevId: 6cf882e0d17a296030c13d80c6e2866c80e04638