From a70f5b0b3cff19f8a316665d1652a9b3ad36c651 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Thu, 8 Jan 2026 12:37:38 -0800 Subject: [PATCH] fix: correct login shell mismatch in the accept_elicitation_for_prompt_rule() test (#8931) Because the path to `git` is used to construct `elicitations_to_accept`, we need to ensure that we resolve which `git` to use the same way our Bash process will: https://github.com/openai/codex/blob/c9c65606852c0cda9d983b4917359a0826a4b7f0/codex-rs/exec-server/tests/suite/accept_elicitation.rs#L59-L69 This fixes an issue when running the test on macOS using Bazel (https://github.com/openai/codex/pull/8875) where the login shell chose `/opt/homebrew/bin/git` whereas the non-login shell chose `/usr/bin/git`. --- .../exec-server/tests/suite/accept_elicitation.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/codex-rs/exec-server/tests/suite/accept_elicitation.rs b/codex-rs/exec-server/tests/suite/accept_elicitation.rs index 1e0ea32e3..eade4f6e5 100644 --- a/codex-rs/exec-server/tests/suite/accept_elicitation.rs +++ b/codex-rs/exec-server/tests/suite/accept_elicitation.rs @@ -27,6 +27,8 @@ use std::os::unix::fs::symlink; use tempfile::TempDir; use tokio::process::Command; +const USE_LOGIN_SHELL: bool = false; + /// Verify that when using a read-only sandbox and an execpolicy that prompts, /// the proper elicitation is sent. Upon auto-approving the elicitation, the /// command should be run privileged outside the sandbox. @@ -56,7 +58,7 @@ prefix_rule( // Create an MCP client that approves expected elicitation messages. let project_root = TempDir::new()?; let project_root_path = project_root.path().canonicalize().unwrap(); - let git_path = resolve_git_path().await?; + let git_path = resolve_git_path(USE_LOGIN_SHELL).await?; let expected_elicitation_message = format!( "Allow agent to run `{} init .` in `{}`?", git_path, @@ -98,7 +100,7 @@ prefix_rule( name: Cow::Borrowed("shell"), arguments: Some(object(json!( { - "login": false, + "login": USE_LOGIN_SHELL, "command": "git init .", "workdir": project_root_path.to_string_lossy(), } @@ -166,9 +168,10 @@ fn ensure_codex_cli() -> Result { Ok(codex_cli) } -async fn resolve_git_path() -> Result { +async fn resolve_git_path(use_login_shell: bool) -> Result { + let bash_flag = if use_login_shell { "-lc" } else { "-c" }; let git = Command::new("bash") - .arg("-lc") + .arg(bash_flag) .arg("command -v git") .output() .await