Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions codex-rs/exec-server/tests/suite/accept_elicitation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
}
Expand Down Expand Up @@ -166,9 +168,10 @@ fn ensure_codex_cli() -> Result<PathBuf> {
Ok(codex_cli)
}

async fn resolve_git_path() -> Result<String> {
async fn resolve_git_path(use_login_shell: bool) -> Result<String> {
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
Expand Down
Loading