mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Restrict shell_command to a single local environment (#36329)
## What changed - Register the legacy `shell_command` handler only when exactly one local environment is available, including when unified exec keeps it hidden for compatibility. - Reserve the unnamespaced `shell_command` name so external tools cannot claim it when the built-in handler is unavailable. Namespaced tools with that name remain supported. ## Testing - Cover remote and multiple-environment tool plans, unified exec routing, and external tool registration for reserved and namespaced variants. GitOrigin-RevId: 93834539b31ac8a7fea072bfa4de792bcc3e053b
This commit is contained in:
1 parent
66d63afd18
commit
ef293f7ac9
5 files changed
+137
-11
No files matched your search
@@ -234,6 +234,26 @@ fn registry_preserves_external_winners_and_trusted_synthetic_order() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reserved_shell_command_rejects_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.tool(&shell_command_name).is_none());
|
||||
|
||||
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))
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn readiness_selects_exact_tool_and_forwards_exposure_overrides() {
|
||||
let (session, _turn) = crate::session::tests::make_session_and_context().await;
|
||||
|
||||
Reference in new issue
Block a user