mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Centralize turn environment selection state (#38461)
## What changed - Store `TurnEnvironmentSelection` directly on each resolved `TurnEnvironment` instead of copying its environment ID, working directory, and workspace roots into separate fields. - Update environment resolution, tool execution, approvals, and related tests to access selection state through the retained value. GitOrigin-RevId: ab723d21e112b8af5bcaf1f772a5e376553312bc
This commit is contained in:
1 parent
18bbb585e7
commit
535795f7d1
31 files changed
+159
-146
No files matched your search
@@ -161,10 +161,10 @@ async fn build_uploaded_argument_value(
|
||||
.join(file_path)
|
||||
.map_err(|error| contextualize_error(error.to_string()))?;
|
||||
let additional_permissions = merge_permission_profiles(
|
||||
sess.granted_session_permissions(&turn_environment.environment_id)
|
||||
sess.granted_session_permissions(&turn_environment.selection.environment_id)
|
||||
.await
|
||||
.as_ref(),
|
||||
sess.granted_turn_permissions(&turn_environment.environment_id)
|
||||
sess.granted_turn_permissions(&turn_environment.selection.environment_id)
|
||||
.await
|
||||
.as_ref(),
|
||||
);
|
||||
@@ -271,7 +271,6 @@ mod tests {
|
||||
use crate::environment_selection::TurnEnvironmentState;
|
||||
use crate::session::tests::make_session_and_context;
|
||||
use crate::session::turn_context::TurnContext;
|
||||
use crate::session::turn_context::TurnEnvironment;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use codex_utils_path_uri::PathUri;
|
||||
use pretty_assertions::assert_eq;
|
||||
@@ -285,14 +284,8 @@ mod tests {
|
||||
else {
|
||||
panic!("expected ready primary environment");
|
||||
};
|
||||
*primary = TurnEnvironment::new(
|
||||
primary.environment_id.clone(),
|
||||
Arc::clone(&primary.environment),
|
||||
PathUri::from_abs_path(&cwd),
|
||||
Vec::new(),
|
||||
primary.shell.clone(),
|
||||
primary.config.clone(),
|
||||
);
|
||||
primary.selection.cwd = PathUri::from_abs_path(&cwd);
|
||||
primary.selection.workspace_roots.clear();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
Reference in new issue
Block a user