mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Standardize shell execution on unified exec (#39757)
## What changed - Remove the legacy `shell_command` handler and runtime, leaving `exec_command` and `write_stdin` as the shell execution tools. - Treat legacy `shell_command` model metadata as `unified_exec`, and normalize legacy user opt-outs so they do not disable command execution. Managed feature requirements and `shell_tool` can still disable it. - Preserve shell approvals, sandboxing, zsh-fork support, and output truncation through the unified execution path. ## Testing - Cover legacy configuration and model-metadata compatibility. - Exercise unified shell execution, approvals, truncation, and `apply_patch` serialization across the app-server and core test suites. GitOrigin-RevId: 5c2fd6164fc3519cdae4944cb9db276b8467311c
This commit is contained in:
1 parent
d0cc662b8c
commit
8a40095ea3
116 files changed
+1338
-4711
No files matched your search
@@ -296,39 +296,41 @@ fn registry_preserves_external_winners_and_trusted_synthetic_order() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reserved_shell_command_rejects_external_runtimes_without_a_builtin() {
|
||||
fn reserved_command_tools_reject_external_runtimes_without_a_builtin() {
|
||||
let handler = |tool_name| Arc::new(TestHandler { tool_name }) as Arc<dyn CoreToolRuntime>;
|
||||
let shell_command_name = codex_tools::ToolName::plain("shell_command");
|
||||
let namespaced_shell_command_name =
|
||||
codex_tools::ToolName::namespaced("client", "shell_command");
|
||||
let mut registry = ToolRegistry::default();
|
||||
|
||||
assert!(!registry.register_external(handler(shell_command_name.clone())));
|
||||
assert!(!registry.register_external_with_exposure(
|
||||
handler(shell_command_name.clone()),
|
||||
ToolExposure::Direct,
|
||||
));
|
||||
assert!(
|
||||
!registry.register_external(handler(codex_tools::ToolName::namespaced(
|
||||
DEFAULT_FUNCTION_NAMESPACE,
|
||||
"shell_command",
|
||||
)))
|
||||
);
|
||||
assert!(registry.tool(&shell_command_name).is_none());
|
||||
assert_eq!(registry.first_collision(), None);
|
||||
for reserved_name in ["exec_command", "shell_command"] {
|
||||
let tool_name = codex_tools::ToolName::plain(reserved_name);
|
||||
let namespaced_tool_name = codex_tools::ToolName::namespaced("client", reserved_name);
|
||||
|
||||
let namespaced_handler = handler(namespaced_shell_command_name.clone());
|
||||
assert!(registry.register_external(Arc::clone(&namespaced_handler)));
|
||||
assert!(
|
||||
registry
|
||||
.tool(&namespaced_shell_command_name)
|
||||
.is_some_and(|runtime| Arc::ptr_eq(&runtime, &namespaced_handler))
|
||||
);
|
||||
assert!(!registry.register_external(handler(tool_name.clone())));
|
||||
assert!(
|
||||
!registry
|
||||
.register_external_with_exposure(handler(tool_name.clone()), ToolExposure::Direct)
|
||||
);
|
||||
assert!(
|
||||
!registry.register_external(handler(codex_tools::ToolName::namespaced(
|
||||
DEFAULT_FUNCTION_NAMESPACE,
|
||||
reserved_name,
|
||||
)))
|
||||
);
|
||||
assert!(registry.tool(&tool_name).is_none());
|
||||
assert_eq!(registry.first_collision(), None);
|
||||
|
||||
let namespaced_handler = handler(namespaced_tool_name.clone());
|
||||
assert!(registry.register_external(Arc::clone(&namespaced_handler)));
|
||||
assert!(
|
||||
registry
|
||||
.tool(&namespaced_tool_name)
|
||||
.is_some_and(|runtime| Arc::ptr_eq(&runtime, &namespaced_handler))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn registry_records_reserved_shell_command_when_a_matching_tool_exists() {
|
||||
let tool_name = codex_tools::ToolName::plain("shell_command");
|
||||
fn registry_records_reserved_exec_command_when_a_matching_tool_exists() {
|
||||
let tool_name = codex_tools::ToolName::plain("exec_command");
|
||||
let trusted = Arc::new(TestHandler {
|
||||
tool_name: tool_name.clone(),
|
||||
}) as Arc<dyn CoreToolRuntime>;
|
||||
|
||||
Reference in new issue
Block a user