fix: update tests so bazel test //codex-rs/core:core-all-test passes on my Mac

This commit is contained in:
Michael Bolin
2026-01-10 08:25:38 -08:00
parent 6709ad8975
commit d60adfd74a
4 changed files with 158 additions and 95 deletions

View File

@@ -509,12 +509,17 @@ pub fn ev_apply_patch_function_call(call_id: &str, patch: &str) -> Value {
}
pub fn ev_shell_command_call(call_id: &str, command: &str) -> Value {
let args = serde_json::json!({ "command": command });
let args = serde_json::json!({ "command": command, "login": false });
ev_shell_command_call_with_args(call_id, &args)
}
pub fn ev_shell_command_call_with_args(call_id: &str, args: &serde_json::Value) -> Value {
let arguments = serde_json::to_string(args).expect("serialize shell command arguments");
let mut args = args.clone();
if let serde_json::Value::Object(map) = &mut args {
map.entry("login".to_string())
.or_insert_with(|| serde_json::Value::Bool(false));
}
let arguments = serde_json::to_string(&args).expect("serialize shell command arguments");
ev_function_call(call_id, "shell_command", &arguments)
}
@@ -527,17 +532,18 @@ pub fn ev_apply_patch_shell_call(call_id: &str, patch: &str) -> Value {
pub fn ev_apply_patch_shell_call_via_heredoc(call_id: &str, patch: &str) -> Value {
let script = format!("apply_patch <<'EOF'\n{patch}\nEOF\n");
let args = serde_json::json!({ "command": ["bash", "-lc", script] });
let args = serde_json::json!({ "command": ["bash", "-c", script] });
let arguments = serde_json::to_string(&args).expect("serialize apply_patch arguments");
ev_function_call(call_id, "shell", &arguments)
}
pub fn ev_apply_patch_shell_command_call_via_heredoc(call_id: &str, patch: &str) -> Value {
let args = serde_json::json!({ "command": format!("apply_patch <<'EOF'\n{patch}\nEOF\n") });
let arguments = serde_json::to_string(&args).expect("serialize apply_patch arguments");
ev_function_call(call_id, "shell_command", &arguments)
let args = serde_json::json!({
"command": format!("apply_patch <<'EOF'\n{patch}\nEOF\n"),
"login": false,
});
ev_shell_command_call_with_args(call_id, &args)
}
pub fn sse_failed(id: &str, code: &str, message: &str) -> String {