From 895e2d056f5358688fb5e3793d1e1a9c8cb262f6 Mon Sep 17 00:00:00 2001 From: jif-oai Date: Thu, 16 Apr 2026 15:51:52 +0100 Subject: [PATCH] nit: get rid of an expect (#18144) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Get rid of an `expect()` that caused a `panic` in the TUI Screenshot 2026-04-16 at 15 30 20 Basically in `from_absolute_path` there is a `absolutize::absolutize` that calls a `current_dir()` . But the dir in which Codex was running got re-generated (because of Codex I guess but I can't exactly see the source). So `current_dir()` returns an `ENOENT` and 💥 --- codex-rs/protocol/src/protocol.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/codex-rs/protocol/src/protocol.rs b/codex-rs/protocol/src/protocol.rs index ca113536e..fb1ea592d 100644 --- a/codex-rs/protocol/src/protocol.rs +++ b/codex-rs/protocol/src/protocol.rs @@ -1223,11 +1223,15 @@ impl SandboxPolicy { // Include /tmp on Unix unless explicitly excluded. if cfg!(unix) && !exclude_slash_tmp { - #[allow(clippy::expect_used)] - let slash_tmp = - AbsolutePathBuf::from_absolute_path("/tmp").expect("/tmp is absolute"); - if slash_tmp.as_path().is_dir() { - roots.push(slash_tmp); + match AbsolutePathBuf::from_absolute_path("/tmp") { + Ok(slash_tmp) => { + if slash_tmp.as_path().is_dir() { + roots.push(slash_tmp); + } + } + Err(e) => { + error!("Ignoring invalid /tmp for sandbox writable root: {e}"); + } } }