chore: clean up argument-comment lint and roll out all-target CI on macOS (#16054)

## Why

`argument-comment-lint` was green in CI even though the repo still had
many uncommented literal arguments. The main gap was target coverage:
the repo wrapper did not force Cargo to inspect test-only call sites, so
examples like the `latest_session_lookup_params(true, ...)` tests in
`codex-rs/tui_app_server/src/lib.rs` never entered the blocking CI path.

This change cleans up the existing backlog, makes the default repo lint
path cover all Cargo targets, and starts rolling that stricter CI
enforcement out on the platform where it is currently validated.

## What changed

- mechanically fixed existing `argument-comment-lint` violations across
the `codex-rs` workspace, including tests, examples, and benches
- updated `tools/argument-comment-lint/run-prebuilt-linter.sh` and
`tools/argument-comment-lint/run.sh` so non-`--fix` runs default to
`--all-targets` unless the caller explicitly narrows the target set
- fixed both wrappers so forwarded cargo arguments after `--` are
preserved with a single separator
- documented the new default behavior in
`tools/argument-comment-lint/README.md`
- updated `rust-ci` so the macOS lint lane keeps the plain wrapper
invocation and therefore enforces `--all-targets`, while Linux and
Windows temporarily pass `-- --lib --bins`

That temporary CI split keeps the stricter all-targets check where it is
already cleaned up, while leaving room to finish the remaining Linux-
and Windows-specific target-gated cleanup before enabling
`--all-targets` on those runners. The Linux and Windows failures on the
intermediate revision were caused by the wrapper forwarding bug, not by
additional lint findings in those lanes.

## Validation

- `bash -n tools/argument-comment-lint/run.sh`
- `bash -n tools/argument-comment-lint/run-prebuilt-linter.sh`
- shell-level wrapper forwarding check for `-- --lib --bins`
- shell-level wrapper forwarding check for `-- --tests`
- `just argument-comment-lint`
- `cargo test` in `tools/argument-comment-lint`
- `cargo test -p codex-terminal-detection`

## Follow-up

- Clean up remaining Linux-only target-gated callsites, then switch the
Linux lint lane back to the plain wrapper invocation.
- Clean up remaining Windows-only target-gated callsites, then switch
the Windows lint lane back to the plain wrapper invocation.
This commit is contained in:
Michael Bolin
2026-03-27 19:00:44 -07:00
committed by GitHub
parent ed977b42ac
commit 61dfe0b86c
307 changed files with 7724 additions and 4710 deletions
@@ -58,7 +58,7 @@ async fn emit_js_repl_exec_end_sends_event() {
turn.as_ref(),
"call-1",
"hello",
None,
/*error*/ None,
Duration::from_millis(12),
)
.await;
@@ -34,9 +34,11 @@ async fn lists_directory_entries() {
symlink(dir_path.join("entry.txt"), &link_path).expect("create symlink");
}
let entries = list_dir_slice(dir_path, 1, 20, 3)
.await
.expect("list directory");
let entries = list_dir_slice(
dir_path, /*offset*/ 1, /*limit*/ 20, /*depth*/ 3,
)
.await
.expect("list directory");
#[cfg(unix)]
let expected = vec![
@@ -68,9 +70,11 @@ async fn errors_when_offset_exceeds_entries() {
.await
.expect("create sub dir");
let err = list_dir_slice(dir_path, 10, 1, 2)
.await
.expect_err("offset exceeds entries");
let err = list_dir_slice(
dir_path, /*offset*/ 10, /*limit*/ 1, /*depth*/ 2,
)
.await
.expect_err("offset exceeds entries");
assert_eq!(
err,
FunctionCallError::RespondToModel("offset exceeds directory entry count".to_string())
@@ -95,17 +99,21 @@ async fn respects_depth_parameter() {
.await
.expect("write deeper");
let entries_depth_one = list_dir_slice(dir_path, 1, 10, 1)
.await
.expect("list depth 1");
let entries_depth_one = list_dir_slice(
dir_path, /*offset*/ 1, /*limit*/ 10, /*depth*/ 1,
)
.await
.expect("list depth 1");
assert_eq!(
entries_depth_one,
vec!["nested/".to_string(), "root.txt".to_string(),]
);
let entries_depth_two = list_dir_slice(dir_path, 1, 20, 2)
.await
.expect("list depth 2");
let entries_depth_two = list_dir_slice(
dir_path, /*offset*/ 1, /*limit*/ 20, /*depth*/ 2,
)
.await
.expect("list depth 2");
assert_eq!(
entries_depth_two,
vec![
@@ -116,9 +124,11 @@ async fn respects_depth_parameter() {
]
);
let entries_depth_three = list_dir_slice(dir_path, 1, 30, 3)
.await
.expect("list depth 3");
let entries_depth_three = list_dir_slice(
dir_path, /*offset*/ 1, /*limit*/ 30, /*depth*/ 3,
)
.await
.expect("list depth 3");
assert_eq!(
entries_depth_three,
vec![
@@ -148,9 +158,11 @@ async fn paginates_in_sorted_order() {
.await
.expect("write b child");
let first_page = list_dir_slice(dir_path, 1, 2, 2)
.await
.expect("list page one");
let first_page = list_dir_slice(
dir_path, /*offset*/ 1, /*limit*/ 2, /*depth*/ 2,
)
.await
.expect("list page one");
assert_eq!(
first_page,
vec![
@@ -160,9 +172,11 @@ async fn paginates_in_sorted_order() {
]
);
let second_page = list_dir_slice(dir_path, 3, 2, 2)
.await
.expect("list page two");
let second_page = list_dir_slice(
dir_path, /*offset*/ 3, /*limit*/ 2, /*depth*/ 2,
)
.await
.expect("list page two");
assert_eq!(
second_page,
vec!["b/".to_string(), " b_child.txt".to_string()]
@@ -183,7 +197,7 @@ async fn handles_large_limit_without_overflow() {
.await
.expect("write gamma");
let entries = list_dir_slice(dir_path, 2, usize::MAX, 1)
let entries = list_dir_slice(dir_path, /*offset*/ 2, usize::MAX, /*depth*/ 1)
.await
.expect("list without overflow");
assert_eq!(
@@ -204,9 +218,11 @@ async fn indicates_truncated_results() {
.expect("write file");
}
let entries = list_dir_slice(dir_path, 1, 25, 1)
.await
.expect("list directory");
let entries = list_dir_slice(
dir_path, /*offset*/ 1, /*limit*/ 25, /*depth*/ 1,
)
.await
.expect("list directory");
assert_eq!(entries.len(), 26);
assert_eq!(
entries.last(),
@@ -226,7 +242,10 @@ async fn truncation_respects_sorted_order() -> anyhow::Result<()> {
tokio::fs::write(nested.join("child.txt"), b"child").await?;
tokio::fs::write(deeper.join("grandchild.txt"), b"deep").await?;
let entries_depth_three = list_dir_slice(dir_path, 1, 3, 3).await?;
let entries_depth_three = list_dir_slice(
dir_path, /*offset*/ 1, /*limit*/ 3, /*depth*/ 3,
)
.await?;
assert_eq!(
entries_depth_three,
vec![
+5 -5
View File
@@ -261,7 +261,7 @@ mod tests {
let cwd = tempdir().expect("tempdir");
let normalized = normalize_and_validate_additional_permissions(
false,
/*additional_permissions_allowed*/ false,
AskForApproval::Granular(GranularApprovalConfig {
sandbox_approval: true,
rules: true,
@@ -271,7 +271,7 @@ mod tests {
}),
SandboxPermissions::WithAdditionalPermissions,
Some(network_permissions()),
true,
/*permissions_preapproved*/ true,
cwd.path(),
)
.expect("preapproved permissions should be allowed");
@@ -284,11 +284,11 @@ mod tests {
let cwd = tempdir().expect("tempdir");
let err = normalize_and_validate_additional_permissions(
false,
/*additional_permissions_allowed*/ false,
AskForApproval::OnRequest,
SandboxPermissions::WithAdditionalPermissions,
Some(network_permissions()),
false,
/*permissions_preapproved*/ false,
cwd.path(),
)
.expect_err("fresh inline permission requests should remain disabled");
@@ -305,7 +305,7 @@ mod tests {
let granted_permissions = file_system_permissions(cwd.path());
let implicit_permissions = implicit_granted_permissions(
SandboxPermissions::UseDefault,
None,
/*additional_permissions*/ None,
&EffectiveAdditionalPermissions {
sandbox_permissions: SandboxPermissions::WithAdditionalPermissions,
additional_permissions: Some(granted_permissions.clone()),
@@ -82,7 +82,7 @@ fn parse_agent_id(id: &str) -> ThreadId {
fn thread_manager() -> ThreadManager {
ThreadManager::with_models_provider_for_tests(
CodexAuth::from_api_key("dummy"),
built_in_model_providers(/* openai_base_url */ None)["openai"].clone(),
built_in_model_providers(/* openai_base_url */ /*openai_base_url*/ None)["openai"].clone(),
)
}
@@ -247,7 +247,8 @@ async fn spawn_agent_uses_explorer_role_and_preserves_approval_policy() {
let manager = thread_manager();
session.services.agent_control = manager.agent_control();
let mut config = (*turn.config).clone();
let provider = built_in_model_providers(/* openai_base_url */ None)["ollama"].clone();
let provider =
built_in_model_providers(/* openai_base_url */ /*openai_base_url*/ None)["ollama"].clone();
config.model_provider_id = "ollama".to_string();
config.model_provider = provider.clone();
config
@@ -962,7 +963,7 @@ async fn multi_agent_v2_send_message_interrupts_busy_child_without_triggering_tu
AgentPath::try_from("/root/worker").expect("agent path"),
Vec::new(),
"continue".to_string(),
false,
/*trigger_turn*/ false,
),
);
let saw_user_message = history_items.iter().any(|item| {
@@ -1094,7 +1095,7 @@ async fn multi_agent_v2_assign_task_interrupts_busy_child_without_losing_message
AgentPath::try_from("/root/worker").expect("agent path"),
Vec::new(),
"continue".to_string(),
true,
/*trigger_turn*/ true,
),
);
let saw_user_message = history_items.iter().any(|item| {
@@ -1636,8 +1637,8 @@ async fn resume_agent_restores_closed_agent_and_accepts_send_input() {
phase: None,
})]),
AuthManager::from_auth_for_testing(CodexAuth::from_api_key("dummy")),
false,
None,
/*persist_extended_history*/ false,
/*parent_trace*/ None,
)
.await
.expect("start thread");
@@ -2557,7 +2558,7 @@ async fn build_agent_resume_config_clears_base_instructions() {
.set(AskForApproval::OnRequest)
.expect("approval policy set");
let config = build_agent_resume_config(&turn, 0).expect("resume config");
let config = build_agent_resume_config(&turn, /*child_depth*/ 0).expect("resume config");
let mut expected = (*turn.config).clone();
expected.base_instructions = None;
@@ -12,23 +12,38 @@ fn request_user_input_mode_availability_defaults_to_plan_only() {
#[test]
fn request_user_input_unavailable_messages_respect_default_mode_feature_flag() {
assert_eq!(
request_user_input_unavailable_message(ModeKind::Plan, false),
request_user_input_unavailable_message(
ModeKind::Plan,
/*default_mode_request_user_input*/ false
),
None
);
assert_eq!(
request_user_input_unavailable_message(ModeKind::Default, false),
request_user_input_unavailable_message(
ModeKind::Default,
/*default_mode_request_user_input*/ false
),
Some("request_user_input is unavailable in Default mode".to_string())
);
assert_eq!(
request_user_input_unavailable_message(ModeKind::Default, true),
request_user_input_unavailable_message(
ModeKind::Default,
/*default_mode_request_user_input*/ true
),
None
);
assert_eq!(
request_user_input_unavailable_message(ModeKind::Execute, false),
request_user_input_unavailable_message(
ModeKind::Execute,
/*default_mode_request_user_input*/ false
),
Some("request_user_input is unavailable in Execute mode".to_string())
);
assert_eq!(
request_user_input_unavailable_message(ModeKind::PairProgramming, false),
request_user_input_unavailable_message(
ModeKind::PairProgramming,
/*default_mode_request_user_input*/ false
),
Some("request_user_input is unavailable in Pair Programming mode".to_string())
);
}
@@ -36,11 +51,11 @@ fn request_user_input_unavailable_messages_respect_default_mode_feature_flag() {
#[test]
fn request_user_input_tool_description_mentions_available_modes() {
assert_eq!(
request_user_input_tool_description(false),
request_user_input_tool_description(/*default_mode_request_user_input*/ false),
"Request user input for one to three short questions and wait for the response. This tool is only available in Plan mode.".to_string()
);
assert_eq!(
request_user_input_tool_description(true),
request_user_input_tool_description(/*default_mode_request_user_input*/ true),
"Request user input for one to three short questions and wait for the response. This tool is only available in Default or Plan mode.".to_string()
);
}
+29 -17
View File
@@ -63,12 +63,12 @@ fn commands_generated_by_shell_command_handler_can_be_matched_by_is_known_safe_c
}
fn assert_safe(shell: &Shell, command: &str) {
assert!(is_known_safe_command(
&shell.derive_exec_args(command, /* use_login_shell */ true)
));
assert!(is_known_safe_command(
&shell.derive_exec_args(command, /* use_login_shell */ false)
));
assert!(is_known_safe_command(&shell.derive_exec_args(
command, /* use_login_shell */ /*use_login_shell*/ true
)));
assert!(is_known_safe_command(&shell.derive_exec_args(
command, /* use_login_shell */ /*use_login_shell*/ false
)));
}
#[tokio::test]
@@ -82,7 +82,9 @@ async fn shell_command_handler_to_exec_params_uses_session_shell_and_turn_contex
let sandbox_permissions = SandboxPermissions::RequireEscalated;
let justification = Some("because tests".to_string());
let expected_command = session.user_shell().derive_exec_args(&command, true);
let expected_command = session
.user_shell()
.derive_exec_args(&command, /*use_login_shell*/ true);
let expected_cwd = turn_context.resolve_path(workdir.clone());
let expected_env = create_env(
&turn_context.shell_environment_policy,
@@ -105,7 +107,7 @@ async fn shell_command_handler_to_exec_params_uses_session_shell_and_turn_contex
&session,
&turn_context,
session.conversation_id,
true,
/*allow_login_shell*/ true,
)
.expect("login shells should be allowed");
@@ -132,17 +134,24 @@ fn shell_command_handler_respects_explicit_login_flag() {
shell_snapshot,
};
let login_command = ShellCommandHandler::base_command(&shell, "echo login shell", true);
let login_command = ShellCommandHandler::base_command(
&shell,
"echo login shell",
/*use_login_shell*/ true,
);
assert_eq!(
login_command,
shell.derive_exec_args("echo login shell", true)
shell.derive_exec_args("echo login shell", /*use_login_shell*/ true)
);
let non_login_command =
ShellCommandHandler::base_command(&shell, "echo non login shell", false);
let non_login_command = ShellCommandHandler::base_command(
&shell,
"echo non login shell",
/*use_login_shell*/ false,
);
assert_eq!(
non_login_command,
shell.derive_exec_args("echo non login shell", false)
shell.derive_exec_args("echo non login shell", /*use_login_shell*/ false)
);
}
@@ -165,20 +174,23 @@ async fn shell_command_handler_defaults_to_non_login_when_disallowed() {
&session,
&turn_context,
session.conversation_id,
false,
/*allow_login_shell*/ false,
)
.expect("non-login shells should still be allowed");
assert_eq!(
exec_params.command,
session.user_shell().derive_exec_args("echo hello", false)
session
.user_shell()
.derive_exec_args("echo hello", /*use_login_shell*/ false)
);
}
#[test]
fn shell_command_handler_rejects_login_when_disallowed() {
let err = ShellCommandHandler::resolve_use_login_shell(Some(true), false)
.expect_err("explicit login should be rejected");
let err =
ShellCommandHandler::resolve_use_login_shell(Some(true), /*allow_login_shell*/ false)
.expect_err("explicit login should be rejected");
assert!(
err.to_string()
@@ -31,7 +31,7 @@ fn test_get_command_uses_default_shell_when_unspecified() -> anyhow::Result<()>
&args,
Arc::new(default_user_shell()),
&UnifiedExecShellMode::Direct,
true,
/*allow_login_shell*/ true,
)
.map_err(anyhow::Error::msg)?;
@@ -52,7 +52,7 @@ fn test_get_command_respects_explicit_bash_shell() -> anyhow::Result<()> {
&args,
Arc::new(default_user_shell()),
&UnifiedExecShellMode::Direct,
true,
/*allow_login_shell*/ true,
)
.map_err(anyhow::Error::msg)?;
@@ -78,7 +78,7 @@ fn test_get_command_respects_explicit_powershell_shell() -> anyhow::Result<()> {
&args,
Arc::new(default_user_shell()),
&UnifiedExecShellMode::Direct,
true,
/*allow_login_shell*/ true,
)
.map_err(anyhow::Error::msg)?;
@@ -98,7 +98,7 @@ fn test_get_command_respects_explicit_cmd_shell() -> anyhow::Result<()> {
&args,
Arc::new(default_user_shell()),
&UnifiedExecShellMode::Direct,
true,
/*allow_login_shell*/ true,
)
.map_err(anyhow::Error::msg)?;
@@ -115,7 +115,7 @@ fn test_get_command_rejects_explicit_login_when_disallowed() -> anyhow::Result<(
&args,
Arc::new(default_user_shell()),
&UnifiedExecShellMode::Direct,
false,
/*allow_login_shell*/ false,
)
.expect_err("explicit login should be rejected");
@@ -144,8 +144,13 @@ fn test_get_command_ignores_explicit_shell_in_zsh_fork_mode() -> anyhow::Result<
})?,
});
let command = get_command(&args, Arc::new(default_user_shell()), &shell_mode, true)
.map_err(anyhow::Error::msg)?;
let command = get_command(
&args,
Arc::new(default_user_shell()),
&shell_mode,
/*allow_login_shell*/ true,
)
.map_err(anyhow::Error::msg)?;
assert_eq!(
command,
+27 -18
View File
@@ -47,13 +47,19 @@ fn node_version_parses_v_prefix_and_suffix() {
#[test]
fn truncate_utf8_prefix_by_bytes_preserves_character_boundaries() {
let input = "aé🙂z";
assert_eq!(truncate_utf8_prefix_by_bytes(input, 0), "");
assert_eq!(truncate_utf8_prefix_by_bytes(input, 1), "a");
assert_eq!(truncate_utf8_prefix_by_bytes(input, 2), "a");
assert_eq!(truncate_utf8_prefix_by_bytes(input, 3), "");
assert_eq!(truncate_utf8_prefix_by_bytes(input, 6), "");
assert_eq!(truncate_utf8_prefix_by_bytes(input, 7), "aé🙂");
assert_eq!(truncate_utf8_prefix_by_bytes(input, 8), "aé🙂z");
assert_eq!(truncate_utf8_prefix_by_bytes(input, /*max_bytes*/ 0), "");
assert_eq!(truncate_utf8_prefix_by_bytes(input, /*max_bytes*/ 1), "a");
assert_eq!(truncate_utf8_prefix_by_bytes(input, /*max_bytes*/ 2), "a");
assert_eq!(truncate_utf8_prefix_by_bytes(input, /*max_bytes*/ 3), "");
assert_eq!(truncate_utf8_prefix_by_bytes(input, /*max_bytes*/ 6), "");
assert_eq!(
truncate_utf8_prefix_by_bytes(input, /*max_bytes*/ 7),
"aé🙂"
);
assert_eq!(
truncate_utf8_prefix_by_bytes(input, /*max_bytes*/ 8),
"aé🙂z"
);
}
#[test]
@@ -203,7 +209,7 @@ async fn wait_for_exec_tool_calls_map_drains_inflight_calls_without_hanging() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn reset_waits_for_exec_lock_before_clearing_exec_tool_calls() {
let manager = JsReplManager::new(None, Vec::new())
let manager = JsReplManager::new(/*node_path*/ None, Vec::new())
.await
.expect("manager should initialize");
let permit = manager
@@ -300,8 +306,11 @@ async fn emitted_image_content_item_does_not_force_original_when_enabled() {
.expect("test turn features should allow feature update");
turn.model_info.supports_image_detail_original = true;
let content_item =
emitted_image_content_item(&turn, "data:image/png;base64,AAA".to_string(), None);
let content_item = emitted_image_content_item(
&turn,
"data:image/png;base64,AAA".to_string(),
/*detail*/ None,
);
assert_eq!(
content_item,
@@ -427,7 +436,7 @@ fn summarize_tool_call_error_marks_error_payload() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn reset_clears_inflight_exec_tool_calls_without_waiting() {
let manager = JsReplManager::new(None, Vec::new())
let manager = JsReplManager::new(/*node_path*/ None, Vec::new())
.await
.expect("manager should initialize");
let exec_id = Uuid::new_v4().to_string();
@@ -460,7 +469,7 @@ async fn reset_clears_inflight_exec_tool_calls_without_waiting() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn reset_aborts_inflight_exec_tool_tasks() {
let manager = JsReplManager::new(None, Vec::new())
let manager = JsReplManager::new(/*node_path*/ None, Vec::new())
.await
.expect("manager should initialize");
let exec_id = Uuid::new_v4().to_string();
@@ -621,14 +630,14 @@ async fn interrupt_turn_exec_clears_matching_submitted_exec() -> anyhow::Result<
return Ok(());
}
let manager = JsReplManager::new(None, Vec::new())
let manager = JsReplManager::new(/*node_path*/ None, Vec::new())
.await
.expect("manager should initialize");
let (_session, turn) = make_session_and_context().await;
let turn = Arc::new(turn);
let dependency_env = HashMap::new();
let mut state = manager
.start_kernel(Arc::clone(&turn), &dependency_env, None)
.start_kernel(Arc::clone(&turn), &dependency_env, /*thread_id*/ None)
.await
.map_err(anyhow::Error::msg)?;
let child = Arc::clone(&state.child);
@@ -667,14 +676,14 @@ async fn interrupt_turn_exec_resets_matching_pending_kernel_start() -> anyhow::R
return Ok(());
}
let manager = JsReplManager::new(None, Vec::new())
let manager = JsReplManager::new(/*node_path*/ None, Vec::new())
.await
.expect("manager should initialize");
let (_session, turn) = make_session_and_context().await;
let turn = Arc::new(turn);
let dependency_env = HashMap::new();
let mut state = manager
.start_kernel(Arc::clone(&turn), &dependency_env, None)
.start_kernel(Arc::clone(&turn), &dependency_env, /*thread_id*/ None)
.await
.map_err(anyhow::Error::msg)?;
state.top_level_exec_state = TopLevelExecState::FreshKernel {
@@ -711,14 +720,14 @@ async fn interrupt_turn_exec_does_not_reset_reused_kernel_before_submit() -> any
return Ok(());
}
let manager = JsReplManager::new(None, Vec::new())
let manager = JsReplManager::new(/*node_path*/ None, Vec::new())
.await
.expect("manager should initialize");
let (_session, turn) = make_session_and_context().await;
let turn = Arc::new(turn);
let dependency_env = HashMap::new();
let mut state = manager
.start_kernel(Arc::clone(&turn), &dependency_env, None)
.start_kernel(Arc::clone(&turn), &dependency_env, /*thread_id*/ None)
.await
.map_err(anyhow::Error::msg)?;
state.top_level_exec_state = TopLevelExecState::ReusedKernelPending {
+1 -1
View File
@@ -29,7 +29,7 @@ fn handler_looks_up_namespaced_aliases_explicitly() {
(namespaced_name, Arc::clone(&namespaced_handler)),
]));
let plain = registry.handler(tool_name, None);
let plain = registry.handler(tool_name, /*namespace*/ None);
let namespaced = registry.handler(tool_name, Some(namespace));
let missing_namespaced = registry.handler(tool_name, Some("mcp__codex_apps__calendar"));
@@ -126,8 +126,8 @@ fn build_sandbox_command_falls_back_to_current_exe_for_apply_patch() {
timeout_ms: None,
};
let command =
ApplyPatchRuntime::build_sandbox_command(&request, None).expect("build sandbox command");
let command = ApplyPatchRuntime::build_sandbox_command(&request, /*codex_self_exe*/ None)
.expect("build sandbox command");
assert_eq!(
command.program,
@@ -95,15 +95,24 @@ fn execve_prompt_rejection_keeps_unmatched_commands_on_sandbox_flag() {
#[test]
fn approval_sandbox_permissions_only_downgrades_preapproved_additional_permissions() {
assert_eq!(
super::approval_sandbox_permissions(SandboxPermissions::WithAdditionalPermissions, true),
super::approval_sandbox_permissions(
SandboxPermissions::WithAdditionalPermissions,
/*additional_permissions_preapproved*/ true
),
SandboxPermissions::UseDefault,
);
assert_eq!(
super::approval_sandbox_permissions(SandboxPermissions::WithAdditionalPermissions, false),
super::approval_sandbox_permissions(
SandboxPermissions::WithAdditionalPermissions,
/*additional_permissions_preapproved*/ false
),
SandboxPermissions::WithAdditionalPermissions,
);
assert_eq!(
super::approval_sandbox_permissions(SandboxPermissions::RequireEscalated, true),
super::approval_sandbox_permissions(
SandboxPermissions::RequireEscalated,
/*additional_permissions_preapproved*/ true
),
SandboxPermissions::RequireEscalated,
);
}
@@ -278,7 +287,7 @@ fn shell_request_escalation_execution_is_explicit() {
&sandbox_policy,
&file_system_sandbox_policy,
network_sandbox_policy,
None,
/*additional_permissions*/ None,
),
EscalationExecution::TurnDefault,
);
@@ -288,7 +297,7 @@ fn shell_request_escalation_execution_is_explicit() {
&sandbox_policy,
&file_system_sandbox_policy,
network_sandbox_policy,
None,
/*additional_permissions*/ None,
),
EscalationExecution::Unsandboxed,
);
@@ -466,7 +475,7 @@ fn intercepted_exec_policy_treats_preapproved_additional_permissions_as_default(
file_system_sandbox_policy: &file_system_sandbox_policy,
sandbox_permissions: super::approval_sandbox_permissions(
SandboxPermissions::WithAdditionalPermissions,
true,
/*additional_permissions_preapproved*/ true,
),
enable_shell_wrapper_parsing: false,
},
+7 -1
View File
@@ -2389,7 +2389,13 @@ pub(crate) fn build_specs(
app_tools: Option<HashMap<String, ToolInfo>>,
dynamic_tools: &[DynamicToolSpec],
) -> ToolRegistryBuilder {
build_specs_with_discoverable_tools(config, mcp_tools, app_tools, None, dynamic_tools)
build_specs_with_discoverable_tools(
config,
mcp_tools,
app_tools,
/*discoverable_tools*/ None,
dynamic_tools,
)
}
pub(crate) fn build_specs_with_discoverable_tools(
+267 -63
View File
@@ -220,22 +220,22 @@ fn model_info_from_models_json(slug: &str) -> ModelInfo {
#[test]
fn unified_exec_is_blocked_for_windows_sandboxed_policies_only() {
assert!(!unified_exec_allowed_in_environment(
true,
/*is_windows*/ true,
&SandboxPolicy::new_read_only_policy(),
WindowsSandboxLevel::RestrictedToken,
));
assert!(!unified_exec_allowed_in_environment(
true,
/*is_windows*/ true,
&SandboxPolicy::new_workspace_write_policy(),
WindowsSandboxLevel::RestrictedToken,
));
assert!(unified_exec_allowed_in_environment(
true,
/*is_windows*/ true,
&SandboxPolicy::DangerFullAccess,
WindowsSandboxLevel::RestrictedToken,
));
assert!(unified_exec_allowed_in_environment(
true,
/*is_windows*/ true,
&SandboxPolicy::DangerFullAccess,
WindowsSandboxLevel::Disabled,
));
@@ -280,7 +280,13 @@ fn test_full_toolset_specs_for_gpt5_codex_unified_exec_web_search() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&config, None, None, &[]).build();
let (tools, _) = build_specs(
&config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
// Build actual map name -> spec
use std::collections::BTreeMap;
@@ -301,7 +307,9 @@ fn test_full_toolset_specs_for_gpt5_codex_unified_exec_web_search() {
// Build expected from the same helpers used by the builder.
let mut expected: BTreeMap<String, ToolSpec> = BTreeMap::from([]);
for spec in [
create_exec_command_tool(true, false),
create_exec_command_tool(
/*allow_login_shell*/ true, /*exec_permission_approvals_enabled*/ false,
),
create_write_stdin_tool(),
PLAN_TOOL.clone(),
create_request_user_input_tool(CollaborationModesConfig::default()),
@@ -376,7 +384,13 @@ fn test_build_specs_collab_tools_enabled() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
assert_contains_tool_names(
&tools,
&["spawn_agent", "send_input", "wait_agent", "close_agent"],
@@ -402,7 +416,13 @@ fn test_build_specs_multi_agent_v2_uses_task_names_and_hides_resume() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
assert_contains_tool_names(
&tools,
&[
@@ -554,7 +574,13 @@ fn test_build_specs_enable_fanout_enables_agent_jobs_and_collab_tools() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
assert_contains_tool_names(
&tools,
&[
@@ -584,7 +610,13 @@ fn view_image_tool_omits_detail_without_original_detail_feature() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
let view_image = find_tool(&tools, VIEW_IMAGE_TOOL_NAME);
let ToolSpec::Function(ResponsesApiTool { parameters, .. }) = &view_image.spec else {
panic!("view_image should be a function tool");
@@ -613,7 +645,13 @@ fn view_image_tool_includes_detail_with_original_detail_feature() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
let view_image = find_tool(&tools, VIEW_IMAGE_TOOL_NAME);
let ToolSpec::Function(ResponsesApiTool { parameters, .. }) = &view_image.spec else {
panic!("view_image should be a function tool");
@@ -652,7 +690,13 @@ fn test_build_specs_agent_job_worker_tools_enabled() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
assert_contains_tool_names(
&tools,
&[
@@ -683,7 +727,13 @@ fn request_user_input_description_reflects_default_mode_feature_flag() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
let request_user_input_tool = find_tool(&tools, "request_user_input");
assert_eq!(
request_user_input_tool.spec,
@@ -701,7 +751,13 @@ fn request_user_input_description_reflects_default_mode_feature_flag() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
let request_user_input_tool = find_tool(&tools, "request_user_input");
assert_eq!(
request_user_input_tool.spec,
@@ -726,7 +782,13 @@ fn request_permissions_requires_feature_flag() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
assert_lacks_tool_name(&tools, "request_permissions");
let mut features = Features::with_defaults();
@@ -741,7 +803,13 @@ fn request_permissions_requires_feature_flag() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
let request_permissions_tool = find_tool(&tools, "request_permissions");
assert_eq!(
request_permissions_tool.spec,
@@ -765,7 +833,13 @@ fn request_permissions_tool_is_independent_from_additional_permissions() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
assert_lacks_tool_name(&tools, "request_permissions");
}
@@ -786,7 +860,13 @@ fn get_memory_requires_feature_flag() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
assert!(
!tools.iter().any(|t| t.spec.name() == "get_memory"),
"get_memory should be disabled when memory_tool feature is off"
@@ -809,7 +889,13 @@ fn js_repl_requires_feature_flag() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
assert!(
!tools.iter().any(|tool| tool.spec.name() == "js_repl"),
@@ -838,7 +924,13 @@ fn js_repl_enabled_adds_tools() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
assert_contains_tool_names(&tools, &["js_repl", "js_repl_reset"]);
}
@@ -864,7 +956,13 @@ fn image_generation_tools_require_feature_and_supported_model() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (default_tools, _) = build_specs(&default_tools_config, None, None, &[]).build();
let (default_tools, _) = build_specs(
&default_tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
assert!(
!default_tools
.iter()
@@ -881,7 +979,13 @@ fn image_generation_tools_require_feature_and_supported_model() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (supported_tools, _) = build_specs(&supported_tools_config, None, None, &[]).build();
let (supported_tools, _) = build_specs(
&supported_tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
assert_contains_tool_names(&supported_tools, &["image_generation"]);
let image_generation_tool = find_tool(&supported_tools, "image_generation");
assert_eq!(
@@ -901,7 +1005,13 @@ fn image_generation_tools_require_feature_and_supported_model() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
assert!(
!tools
.iter()
@@ -992,7 +1102,13 @@ fn web_search_mode_cached_sets_external_web_access_false() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
let tool = find_tool(&tools, "web_search");
assert_eq!(
@@ -1023,7 +1139,13 @@ fn web_search_mode_live_sets_external_web_access_true() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
let tool = find_tool(&tools, "web_search");
assert_eq!(
@@ -1068,7 +1190,13 @@ fn web_search_config_is_forwarded_to_tool_spec() {
windows_sandbox_level: WindowsSandboxLevel::Disabled,
})
.with_web_search_config(Some(web_search_config.clone()));
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
let tool = find_tool(&tools, "web_search");
assert_eq!(
@@ -1105,7 +1233,13 @@ fn web_search_tool_type_text_and_image_sets_search_content_types() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
let tool = find_tool(&tools, "web_search");
assert_eq!(
@@ -1140,7 +1274,13 @@ fn mcp_resource_tools_are_hidden_without_mcp_servers() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
assert!(
!tools.iter().any(|tool| matches!(
@@ -1166,7 +1306,13 @@ fn mcp_resource_tools_are_included_when_mcp_servers_are_present() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, Some(HashMap::new()), None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
Some(HashMap::new()),
/*app_tools*/ None,
&[],
)
.build();
assert_contains_tool_names(
&tools,
@@ -1406,7 +1552,13 @@ fn test_build_specs_default_shell_present() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, Some(HashMap::new()), None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
Some(HashMap::new()),
/*app_tools*/ None,
&[],
)
.build();
// Only check the shell variant and a couple of core tools.
let mut subset = vec!["exec_command", "write_stdin", "update_plan"];
@@ -1496,7 +1648,13 @@ fn test_parallel_support_flags() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
assert!(find_tool(&tools, "exec_command").supports_parallel_tool_calls);
assert!(!find_tool(&tools, "write_stdin").supports_parallel_tool_calls);
@@ -1518,7 +1676,13 @@ fn test_test_model_info_includes_sync_tool() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
assert!(
tools
@@ -1568,7 +1732,7 @@ fn test_build_specs_mcp_tools_converted() {
}),
),
)])),
None,
/*app_tools*/ None,
&[],
)
.build();
@@ -1653,7 +1817,7 @@ fn test_build_specs_mcp_tools_sorted_by_name() {
),
]);
let (tools, _) = build_specs(&tools_config, Some(tools_map), None, &[]).build();
let (tools, _) = build_specs(&tools_config, Some(tools_map), /*app_tools*/ None, &[]).build();
// Only assert that the MCP tools themselves are sorted by fully-qualified name.
let mcp_names: Vec<_> = tools
@@ -1827,7 +1991,13 @@ fn search_tool_requires_model_capability_and_feature_flag() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, app_tools.clone(), &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
app_tools.clone(),
&[],
)
.build();
assert_lacks_tool_name(&tools, TOOL_SEARCH_TOOL_NAME);
let available_models = Vec::new();
@@ -1840,7 +2010,13 @@ fn search_tool_requires_model_capability_and_feature_flag() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, app_tools.clone(), &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
app_tools.clone(),
&[],
)
.build();
assert_lacks_tool_name(&tools, TOOL_SEARCH_TOOL_NAME);
let mut features = Features::with_defaults();
@@ -1855,7 +2031,7 @@ fn search_tool_requires_model_capability_and_feature_flag() {
sandbox_policy: &SandboxPolicy::DangerFullAccess,
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, app_tools, &[]).build();
let (tools, _) = build_specs(&tools_config, /*mcp_tools*/ None, app_tools, &[]).build();
assert_contains_tool_names(&tools, &[TOOL_SEARCH_TOOL_NAME]);
}
@@ -1879,8 +2055,8 @@ fn tool_suggest_is_not_registered_without_feature_flag() {
});
let (tools, _) = build_specs_with_discoverable_tools(
&tools_config,
None,
None,
/*mcp_tools*/ None,
/*app_tools*/ None,
Some(vec![discoverable_connector(
"connector_2128aebfecb84f64a069897515042a44",
"Google Calendar",
@@ -1919,8 +2095,8 @@ fn tool_suggest_can_be_registered_without_search_tool() {
});
let (tools, _) = build_specs_with_discoverable_tools(
&tools_config,
None,
None,
/*mcp_tools*/ None,
/*app_tools*/ None,
Some(vec![discoverable_connector(
"connector_2128aebfecb84f64a069897515042a44",
"Google Calendar",
@@ -1974,8 +2150,8 @@ fn tool_suggest_requires_apps_and_plugins_features() {
});
let (tools, _) = build_specs_with_discoverable_tools(
&tools_config,
None,
None,
/*mcp_tools*/ None,
/*app_tools*/ None,
discoverable_tools.clone(),
&[],
)
@@ -2007,7 +2183,13 @@ fn search_tool_description_handles_no_enabled_apps() {
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, Some(HashMap::new()), &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
Some(HashMap::new()),
&[],
)
.build();
let search_tool = find_tool(&tools, TOOL_SEARCH_TOOL_NAME);
let ToolSpec::ToolSearch { description, .. } = &search_tool.spec else {
panic!("expected tool_search tool");
@@ -2036,7 +2218,7 @@ fn search_tool_description_falls_back_to_connector_name_without_description() {
let (tools, _) = build_specs(
&tools_config,
None,
/*mcp_tools*/ None,
Some(HashMap::from([(
"mcp__codex_apps__calendar_create_event".to_string(),
ToolInfo {
@@ -2085,7 +2267,7 @@ fn search_tool_registers_namespaced_app_tool_aliases() {
let (_, registry) = build_specs(
&tools_config,
None,
/*mcp_tools*/ None,
Some(HashMap::from([
(
"mcp__codex_apps__calendar_create_event".to_string(),
@@ -2128,8 +2310,8 @@ fn search_tool_registers_namespaced_app_tool_aliases() {
let alias = tool_handler_key("_create_event", Some("mcp__codex_apps__calendar"));
assert!(registry.has_handler(TOOL_SEARCH_TOOL_NAME, None));
assert!(registry.has_handler(alias.as_str(), None));
assert!(registry.has_handler(TOOL_SEARCH_TOOL_NAME, /*namespace*/ None));
assert!(registry.has_handler(alias.as_str(), /*namespace*/ None));
}
#[test]
@@ -2174,8 +2356,8 @@ fn tool_suggest_description_lists_discoverable_tools() {
let (tools, _) = build_specs_with_discoverable_tools(
&tools_config,
None,
None,
/*mcp_tools*/ None,
/*app_tools*/ None,
Some(discoverable_tools),
&[],
)
@@ -2269,7 +2451,7 @@ fn test_mcp_tool_property_missing_type_defaults_to_string() {
}),
),
)])),
None,
/*app_tools*/ None,
&[],
)
.build();
@@ -2327,7 +2509,7 @@ fn test_mcp_tool_integer_normalized_to_number() {
}),
),
)])),
None,
/*app_tools*/ None,
&[],
)
.build();
@@ -2384,7 +2566,7 @@ fn test_mcp_tool_array_without_items_gets_default_string_items() {
}),
),
)])),
None,
/*app_tools*/ None,
&[],
)
.build();
@@ -2445,7 +2627,7 @@ fn test_mcp_tool_anyof_defaults_to_string() {
}),
),
)])),
None,
/*app_tools*/ None,
&[],
)
.build();
@@ -2473,7 +2655,7 @@ fn test_mcp_tool_anyof_defaults_to_string() {
#[test]
fn test_shell_tool() {
let tool = super::create_shell_tool(false);
let tool = super::create_shell_tool(/*exec_permission_approvals_enabled*/ false);
let ToolSpec::Function(ResponsesApiTool {
description, name, ..
}) = &tool
@@ -2506,7 +2688,9 @@ Examples of valid command strings:
#[test]
fn test_exec_command_tool_windows_description_includes_shell_safety_guidance() {
let tool = super::create_exec_command_tool(true, false);
let tool = super::create_exec_command_tool(
/*allow_login_shell*/ true, /*exec_permission_approvals_enabled*/ false,
);
let ToolSpec::Function(ResponsesApiTool {
description, name, ..
}) = &tool
@@ -2529,7 +2713,7 @@ fn test_exec_command_tool_windows_description_includes_shell_safety_guidance() {
#[test]
fn shell_tool_with_request_permission_includes_additional_permissions() {
let tool = super::create_shell_tool(true);
let tool = super::create_shell_tool(/*exec_permission_approvals_enabled*/ true);
let ToolSpec::Function(ResponsesApiTool { parameters, .. }) = tool else {
panic!("expected function tool");
};
@@ -2609,7 +2793,9 @@ fn request_permissions_tool_includes_full_permission_schema() {
#[test]
fn test_shell_command_tool() {
let tool = super::create_shell_command_tool(true, false);
let tool = super::create_shell_command_tool(
/*allow_login_shell*/ true, /*exec_permission_approvals_enabled*/ false,
);
let ToolSpec::Function(ResponsesApiTool {
description, name, ..
}) = &tool
@@ -2686,7 +2872,7 @@ fn test_get_openai_tools_mcp_tools_with_additional_properties_schema() {
}),
),
)])),
None,
/*app_tools*/ None,
&[],
)
.build();
@@ -2766,7 +2952,13 @@ fn code_mode_augments_builtin_tool_descriptions_with_typed_sample() {
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
let ToolSpec::Function(ResponsesApiTool { description, .. }) =
&find_tool(&tools, "view_image").spec
else {
@@ -2814,7 +3006,7 @@ fn code_mode_augments_mcp_tool_descriptions_with_namespaced_sample() {
}),
),
)])),
None,
/*app_tools*/ None,
&[],
)
.build();
@@ -2863,7 +3055,13 @@ fn code_mode_only_exec_description_includes_full_nested_tool_details() {
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
let ToolSpec::Freeform(FreeformTool { description, .. }) = &find_tool(&tools, "exec").spec
else {
panic!("expected freeform tool");
@@ -2895,7 +3093,13 @@ fn code_mode_exec_description_omits_nested_tool_details_when_not_code_mode_only(
windows_sandbox_level: WindowsSandboxLevel::Disabled,
});
let (tools, _) = build_specs(&tools_config, None, None, &[]).build();
let (tools, _) = build_specs(
&tools_config,
/*mcp_tools*/ None,
/*app_tools*/ None,
&[],
)
.build();
let ToolSpec::Freeform(FreeformTool { description, .. }) = &find_tool(&tools, "exec").spec
else {
panic!("expected freeform tool");