From 54e6e4ac325c2fd207a95bccb35f454433553a8b Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Wed, 19 Nov 2025 22:42:58 -0800 Subject: [PATCH] fix: when displaying execv, show file instead of arg0 (#6966) After merging https://github.com/openai/codex/pull/6958, I realized that the `command` I was displaying was not quite right. Since we know it, we should show the _exact_ program being executed (the first arg to `execve(3)`) rather than `arg0` to be more precise. Below is the same command I used to test https://github.com/openai/codex/pull/6958, but now you can see it shows `/Users/mbolin/.openai/bin/git` instead of just `git`. image --- codex-rs/exec-server/src/posix/mcp_escalation_policy.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/codex-rs/exec-server/src/posix/mcp_escalation_policy.rs b/codex-rs/exec-server/src/posix/mcp_escalation_policy.rs index 39958bb4f..069948ea0 100644 --- a/codex-rs/exec-server/src/posix/mcp_escalation_policy.rs +++ b/codex-rs/exec-server/src/posix/mcp_escalation_policy.rs @@ -43,12 +43,17 @@ impl McpEscalationPolicy { async fn prompt( &self, - _file: &Path, + file: &Path, argv: &[String], workdir: &Path, context: RequestContext, ) -> Result { - let command = shlex::try_join(argv.iter().map(String::as_str)).unwrap_or_default(); + let args = shlex::try_join(argv.iter().skip(1).map(String::as_str)).unwrap_or_default(); + let command = if args.is_empty() { + file.display().to_string() + } else { + format!("{} {}", file.display(), args) + }; context .peer .create_elicitation(CreateElicitationRequestParam {