Files
codex/codex-rs
Adam Perry @ OpenAI 7e8143a897 Tie executor attachments to environment selection lifetimes (#59043)
## 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
2026-11-03 02:37:20 +00:00
..
…
…
…
…