mirror of
https://github.com/openai/codex.git
synced 2026-11-05 08:28:29 +00:00
Match Windows shell guidance to the executor platform (#41368)
## What changed - Include Windows safety guidance in the `exec_command` tool description when a single ready environment reports Windows as its executor platform. - Omit that guidance when the selected executor reports a non-Windows platform. - Preserve the host-based behavior when platform information is unavailable or the tool can target multiple environments. ## Testing - Cover Windows, non-Windows, unknown-platform, and multi-environment tool plans. - Verify remote environments expose guidance that matches their target OS. GitOrigin-RevId: 95e09790446c684ffaff2a0be077db426fff4618
This commit is contained in:
1 parent
7e41be641e
commit
5ed294d49d
6 files changed
+95
-11
No files matched your search
@@ -327,7 +327,7 @@ async fn remote_test_env_can_connect_and_use_filesystem() -> Result<()> {
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn remote_test_env_exposes_target_shell_to_model() -> Result<()> {
|
||||
async fn remote_test_env_exposes_target_shell_and_exec_guidance_to_model() -> Result<()> {
|
||||
skip_if_no_remote_env!(Ok(()));
|
||||
|
||||
let server = start_mock_server().await;
|
||||
@@ -340,19 +340,26 @@ async fn remote_test_env_exposes_target_shell_to_model() -> Result<()> {
|
||||
]),
|
||||
)
|
||||
.await;
|
||||
let mut builder = test_codex().with_config(|config| {
|
||||
config
|
||||
.features
|
||||
.disable(Feature::ShellTool)
|
||||
.expect("test config should allow feature update");
|
||||
});
|
||||
let mut builder = test_codex();
|
||||
let test = builder.build_with_auto_env(&server).await?;
|
||||
|
||||
test.submit_turn("report remote environment").await?;
|
||||
|
||||
let request = response_mock.single_request();
|
||||
let tools = tool_names(&request.body_json());
|
||||
assert!(!tools.contains(&"exec_command".to_string()));
|
||||
let body = request.body_json();
|
||||
let exec_command = body["tools"]
|
||||
.as_array()
|
||||
.context("tools should be an array")?
|
||||
.iter()
|
||||
.find(|tool| tool["name"] == "exec_command")
|
||||
.context("exec_command should be available")?;
|
||||
let has_windows_guidance = exec_command["description"]
|
||||
.as_str()
|
||||
.is_some_and(|description| description.contains("Windows safety rules:"));
|
||||
assert_eq!(
|
||||
has_windows_guidance,
|
||||
matches!(test_target_os(), TestTargetOs::Windows)
|
||||
);
|
||||
let environment_context = request
|
||||
.message_input_texts("user")
|
||||
.into_iter()
|
||||
|
||||
Reference in new issue
Block a user