Centralize thread environment selection state (#38423)

## What changed

- Make `ThreadEnvironments` the source of truth for live environment selections and use it when building configuration snapshots, permission profiles, per-turn configuration, and MCP refresh inputs.
- Keep settings previews side-effect free while applying accepted environment updates consistently to subsequent turns.
- Move `EnvironmentConfig` into `codex-protocol` so environment ownership no longer depends on a core-only type.

## Testing

- Cover environment previews and snapshots, accepted and rejected steer updates, and active-turn environment stability.

GitOrigin-RevId: 7bcf8fb5df1215f720e4e9c419541a51a871aa5e
This commit is contained in:
sayan-oai authored and copyberry committed 2026-08-13 19:25:05 +00:00
1 parent 588e18aae5
commit 781445f7c6
16 files changed
+428 -327

No files matched your search

+1 -2
View File
@@ -31,11 +31,11 @@ mod compact_remote;
mod compact_remote_history;
mod compact_remote_v2;
mod compact_token_budget;
pub use codex_protocol::protocol::EnvironmentConfig;
pub use codex_thread::BackgroundTerminalInfo;
pub use codex_thread::CodexThread;
pub use codex_thread::CodexThreadSettingsOverrides;
pub use codex_thread::ThreadConfigSnapshot;
pub use environment_config::EnvironmentConfig;
pub use session::turn_context::TurnContext;
mod agent;
mod agent_communication;
@@ -48,7 +48,6 @@ pub mod context;
mod context_manager;
mod current_time;
mod elicitation;
mod environment_config;
mod environment_selection;
pub mod exec;
pub mod exec_env;