Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

fix(exec): skip git repo check when --yolo flag is used (#9590)

zerone0xae7d3e1b492c
diff --git a/codex-rs/exec/src/lib.rs b/codex-rs/exec/src/lib.rs
index d5fb0f6ed2..533b328e22 100644
--- a/codex-rs/exec/src/lib.rs
+++ b/codex-rs/exec/src/lib.rs
@@ -297,7 +297,12 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option<PathBuf>) -> any
let default_effort = config.model_reasoning_effort;
let default_summary = config.model_reasoning_summary;
- if !skip_git_repo_check && get_git_repo_root(&default_cwd).is_none() {
+ // When --yolo (dangerously_bypass_approvals_and_sandbox) is set, also skip the git repo check
+ // since the user is explicitly running in an externally sandboxed environment.
+ if !skip_git_repo_check
+ && !dangerously_bypass_approvals_and_sandbox
+ && get_git_repo_root(&default_cwd).is_none()
+ {
eprintln!("Not inside a trusted directory and --skip-git-repo-check was not specified.");
std::process::exit(1);
}