Skip to content

Commit 54e6e4a

Browse files
authored
fix: when displaying execv, show file instead of arg0 (#6966)
After merging #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 #6958, but now you can see it shows `/Users/mbolin/.openai/bin/git` instead of just `git`. <img width="1526" height="1444" alt="image" src="https://github.com/user-attachments/assets/428128d1-c658-456e-a64e-fc6a0009cb34" />
1 parent e8af41d commit 54e6e4a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

codex-rs/exec-server/src/posix/mcp_escalation_policy.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,17 @@ impl McpEscalationPolicy {
4343

4444
async fn prompt(
4545
&self,
46-
_file: &Path,
46+
file: &Path,
4747
argv: &[String],
4848
workdir: &Path,
4949
context: RequestContext<RoleServer>,
5050
) -> Result<CreateElicitationResult, McpError> {
51-
let command = shlex::try_join(argv.iter().map(String::as_str)).unwrap_or_default();
51+
let args = shlex::try_join(argv.iter().skip(1).map(String::as_str)).unwrap_or_default();
52+
let command = if args.is_empty() {
53+
file.display().to_string()
54+
} else {
55+
format!("{} {}", file.display(), args)
56+
};
5257
context
5358
.peer
5459
.create_elicitation(CreateElicitationRequestParam {

0 commit comments

Comments
 (0)