Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

fix: make sure the shell exists (#10222)

jif-oai09d25e91e96a
diff --git a/codex-rs/core/src/shell.rs b/codex-rs/core/src/shell.rs
index c866afd3bd..6cde28d2f1 100644
--- a/codex-rs/core/src/shell.rs
+++ b/codex-rs/core/src/shell.rs
@@ -137,6 +137,7 @@ fn get_shell_path(
let default_shell_path = get_user_shell_path();
if let Some(default_shell_path) = default_shell_path
&& detect_shell_type(&default_shell_path) == Some(shell_type)
+ && file_exists(&default_shell_path).is_some()
{
return Some(default_shell_path);
}
diff --git a/codex-rs/core/tests/suite/view_image.rs b/codex-rs/core/tests/suite/view_image.rs
index 8c79190383..b72f66fce8 100644
--- a/codex-rs/core/tests/suite/view_image.rs
+++ b/codex-rs/core/tests/suite/view_image.rs
@@ -64,7 +64,9 @@ async fn user_turn_with_local_image_attaches_image() -> anyhow::Result<()> {
if let Some(parent) = abs_path.parent() {
std::fs::create_dir_all(parent)?;
}
- let image = ImageBuffer::from_pixel(4096, 1024, Rgba([20u8, 40, 60, 255]));
+ let original_width = 2304;
+ let original_height = 864;
+ let image = ImageBuffer::from_pixel(original_width, original_height, Rgba([20u8, 40, 60, 255]));
image.save(&abs_path)?;
let response = sse(vec![
@@ -93,7 +95,13 @@ async fn user_turn_with_local_image_attaches_image() -> anyhow::Result<()> {
})
.await?;
- wait_for_event(&codex, |event| matches!(event, EventMsg::TurnComplete(_))).await;
+ wait_for_event_with_timeout(
+ &codex,
+ |event| matches!(event, EventMsg::TurnComplete(_)),
+ // Empirically, image attachment can be slow under Bazel/RBE.
+ Duration::from_secs(10),
+ )
+ .await;
let body = mock.single_request().body_json();
let image_message =
@@ -124,8 +132,8 @@ async fn user_turn_with_local_image_attaches_image() -> anyhow::Result<()> {
let (width, height) = resized.dimensions();
assert!(width <= 2048);
assert!(height <= 768);
- assert!(width < 4096);
- assert!(height < 1024);
+ assert!(width < original_width);
+ assert!(height < original_height);
Ok(())
}
@@ -148,7 +156,9 @@ async fn view_image_tool_attaches_local_image() -> anyhow::Result<()> {
if let Some(parent) = abs_path.parent() {
std::fs::create_dir_all(parent)?;
}
- let image = ImageBuffer::from_pixel(4096, 1024, Rgba([255u8, 0, 0, 255]));
+ let original_width = 2304;
+ let original_height = 864;
+ let image = ImageBuffer::from_pixel(original_width, original_height, Rgba([255u8, 0, 0, 255]));
image.save(&abs_path)?;
let call_id = "view-image-call";
@@ -261,8 +271,8 @@ async fn view_image_tool_attaches_local_image() -> anyhow::Result<()> {
let (resized_width, resized_height) = resized.dimensions();
assert!(resized_width <= 2048);
assert!(resized_height <= 768);
- assert!(resized_width < 4096);
- assert!(resized_height < 1024);
+ assert!(resized_width < original_width);
+ assert!(resized_height < original_height);
Ok(())
}