mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
Align environment selection tests with cwd invariants
Keep the explicit turn-environment cwd assertion focused on the selected environment cwd, and remove fallback wording from the RMCP stored-environment test identifiers. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -6607,13 +6607,9 @@ impl CodexMessageProcessor {
|
||||
self.track_error_response(&request_id, error, /*error_type*/ None);
|
||||
})?;
|
||||
|
||||
let collaboration_modes_config = CollaborationModesConfig {
|
||||
default_mode_request_user_input: thread
|
||||
.enabled(Feature::DefaultModeRequestUserInput),
|
||||
};
|
||||
let collaboration_mode = params.collaboration_mode.map(|mode| {
|
||||
self.normalize_turn_start_collaboration_mode(mode, collaboration_modes_config)
|
||||
});
|
||||
let collaboration_mode = params
|
||||
.collaboration_mode
|
||||
.map(|mode| self.normalize_turn_start_collaboration_mode(mode));
|
||||
let environment_selections = self.parse_environment_selections(params.environments)?;
|
||||
|
||||
// Map v2 input items to core input items.
|
||||
|
||||
@@ -3330,9 +3330,9 @@ async fn relative_cwd_update_without_environments_resolves_under_session_cwd() {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn relative_cwd_update_with_turn_environment_resolves_under_turn_environment_cwd() {
|
||||
async fn relative_cwd_update_with_turn_environment_keeps_turn_environment_cwd() {
|
||||
let (session, _turn_context, _rx) = make_session_and_context_with_rx().await;
|
||||
let (stored_cwd, turn_environment_cwd, expected_cwd) = {
|
||||
let (stored_cwd, turn_environment_cwd, expected_session_cwd) = {
|
||||
let mut state = session.state.lock().await;
|
||||
let stored_cwd = state.session_configuration.cwd.clone();
|
||||
let stored_environment_cwd = stored_cwd.join("stored-environment");
|
||||
@@ -3341,10 +3341,10 @@ async fn relative_cwd_update_with_turn_environment_resolves_under_turn_environme
|
||||
environment_id: codex_exec_server::LOCAL_ENVIRONMENT_ID.to_string(),
|
||||
cwd: stored_environment_cwd,
|
||||
}];
|
||||
let expected_cwd = turn_environment_cwd.join("project");
|
||||
(stored_cwd, turn_environment_cwd, expected_cwd)
|
||||
let expected_session_cwd = turn_environment_cwd.join("project");
|
||||
(stored_cwd, turn_environment_cwd, expected_session_cwd)
|
||||
};
|
||||
std::fs::create_dir_all(expected_cwd.as_path()).expect("create project dir");
|
||||
std::fs::create_dir_all(expected_session_cwd.as_path()).expect("create project dir");
|
||||
|
||||
let turn_context = session
|
||||
.new_turn_with_sub_id(
|
||||
@@ -3362,18 +3362,18 @@ async fn relative_cwd_update_with_turn_environment_resolves_under_turn_environme
|
||||
.expect("turn should start");
|
||||
|
||||
let state = session.state.lock().await;
|
||||
assert_eq!(state.session_configuration.cwd, expected_cwd);
|
||||
assert_eq!(state.session_configuration.cwd, expected_session_cwd);
|
||||
assert_eq!(
|
||||
state.session_configuration.environments[0].cwd,
|
||||
stored_cwd.join("stored-environment")
|
||||
);
|
||||
assert_eq!(turn_context.cwd, expected_cwd);
|
||||
assert_eq!(turn_context.cwd, turn_environment_cwd);
|
||||
assert_eq!(
|
||||
turn_context
|
||||
.primary_environment()
|
||||
.expect("primary environment")
|
||||
.cwd,
|
||||
expected_cwd
|
||||
turn_environment_cwd
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -570,7 +570,7 @@ async fn refreshed_stdio_server_uses_stored_environment_cwd() -> anyhow::Result<
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = responses::start_mock_server().await;
|
||||
let server_name = "rmcp_stored_environment_fallback_cwd";
|
||||
let server_name = "rmcp_stored_environment_cwd";
|
||||
let selected_dir = "mcp-turn-environment-cwd";
|
||||
let selected_cwd = Arc::new(Mutex::new(None::<PathBuf>));
|
||||
let selected_cwd_for_setup = Arc::clone(&selected_cwd);
|
||||
@@ -614,7 +614,7 @@ async fn refreshed_stdio_server_uses_stored_environment_cwd() -> anyhow::Result<
|
||||
rmcp_test_server_bin,
|
||||
Some(HashMap::from([(
|
||||
"MCP_TEST_VALUE".to_string(),
|
||||
"stored-environment-fallback-cwd".to_string(),
|
||||
"stored-environment-cwd".to_string(),
|
||||
)])),
|
||||
Vec::new(),
|
||||
),
|
||||
@@ -677,7 +677,7 @@ async fn refreshed_stdio_server_uses_stored_environment_cwd() -> anyhow::Result<
|
||||
&server,
|
||||
&fixture,
|
||||
server_name,
|
||||
"call-stored-environment-fallback-cwd",
|
||||
"call-stored-environment-cwd",
|
||||
read_only_user_turn(&fixture, "call the rmcp cwd tool"),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user