core: always prepare history images

This commit is contained in:
Rohit Arunachalam
2026-06-18 13:27:00 -07:00
parent d9dace8a59
commit e264c6fae2
9 changed files with 45 additions and 17 deletions
@@ -397,6 +397,10 @@ mod tests {
#[tokio::test(flavor = "multi_thread")]
async fn handle_accepts_explicit_high_detail() {
let (session, mut turn) = make_session_and_context().await;
Arc::make_mut(&mut turn.config)
.features
.disable(Feature::ResizeAllImages)
.expect("test config should allow feature update");
let image_dir = tempfile::tempdir().expect("create image temp dir");
let image_cwd = image_dir.abs();
+2 -2
View File
@@ -718,7 +718,7 @@ async fn resume_replays_legacy_js_repl_image_rollout_shapes() {
async fn resume_replays_image_tool_outputs_with_detail() {
skip_if_no_network!();
let image_url = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEAAUAmJaACdLoB+AADsAD+8ut//NgVzXPv9//S4P0uD9Lg/9KQAAA=";
let image_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGP4z8DwHwAFAAH/iZk9HQAAAABJRU5ErkJggg==";
let function_call_id = "view-image-call";
let custom_call_id = "js-repl-call";
let rollout = vec![
@@ -744,7 +744,7 @@ async fn resume_replays_image_tool_outputs_with_detail() {
id: None,
name: "view_image".to_string(),
namespace: None,
arguments: "{\"path\":\"/tmp/example.webp\"}".to_string(),
arguments: "{\"path\":\"/tmp/example.png\"}".to_string(),
call_id: function_call_id.to_string(),
metadata: None,
}),
+1 -1
View File
@@ -4232,7 +4232,7 @@ async fn snapshot_request_shape_pre_turn_compaction_including_incoming_user_mess
)
.await
.expect("override thread settings");
let image_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGNgYAAAAAMAASsJTYQAAAAASUVORK5CYII="
let image_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGP4z8DwHwAFAAH/iZk9HQAAAABJRU5ErkJggg=="
.to_string();
codex
.submit(Op::UserInput {
+1 -1
View File
@@ -200,7 +200,7 @@ async fn drag_drop_image_persists_rollout_request_shape() -> anyhow::Result<()>
..
} = test_codex().build(&server).await?;
let image_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGNgYAAAAAMAASsJTYQAAAAASUVORK5CYII=".to_string();
let image_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGP4z8DwHwAFAAH/iZk9HQAAAABJRU5ErkJggg==".to_string();
let response = sse(vec![
ev_response_created("resp-1"),
+1 -1
View File
@@ -506,7 +506,7 @@ async fn model_change_from_image_to_text_strips_prior_image_content() -> Result<
let _ = models_manager
.list_models(RefreshStrategy::OnlineIfUncached)
.await;
let image_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGNgYAAAAAMAASsJTYQAAAAASUVORK5CYII="
let image_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGP4z8DwHwAFAAH/iZk9HQAAAABJRU5ErkJggg=="
.to_string();
test.codex
+1 -1
View File
@@ -55,7 +55,7 @@ fn has_hosted_tool(tools: &[Value], tool_type: &str) -> bool {
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn responses_lite_strips_data_image_detail_without_resize_all_images() -> Result<()> {
async fn responses_lite_strips_data_image_detail() -> Result<()> {
skip_if_no_network!(Ok(()));
let server = responses::start_mock_server().await;
+12 -7
View File
@@ -186,9 +186,11 @@ async fn assert_user_turn_local_image_resizes_to(
let server = start_mock_server().await;
let mut builder = test_codex().with_config(move |config| {
if resize_policy == TestImageResizePolicy::AllImages {
let _ = config.features.enable(Feature::ResizeAllImages);
match resize_policy {
TestImageResizePolicy::Legacy => config.features.disable(Feature::ResizeAllImages),
TestImageResizePolicy::AllImages => config.features.enable(Feature::ResizeAllImages),
}
.expect("test config should allow feature update");
});
let test = builder.build_with_remote_env(&server).await?;
let TestCodex {
@@ -1214,7 +1216,12 @@ async fn view_image_tool_errors_for_non_image_files() -> anyhow::Result<()> {
let server = start_mock_server().await;
let mut builder = test_codex();
let mut builder = test_codex().with_config(|config| {
config
.features
.disable(Feature::ResizeAllImages)
.expect("test config should allow feature update");
});
let test = builder.build_with_remote_env(&server).await?;
let TestCodex {
codex,
@@ -1286,13 +1293,11 @@ async fn view_image_tool_errors_for_non_image_files() -> anyhow::Result<()> {
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn resize_all_images_turns_invalid_view_image_into_placeholder() -> anyhow::Result<()> {
async fn view_image_tool_turns_invalid_image_into_placeholder() -> anyhow::Result<()> {
skip_if_no_network!(Ok(()));
let server = start_mock_server().await;
let mut builder = test_codex().with_config(|config| {
let _ = config.features.enable(Feature::ResizeAllImages);
});
let mut builder = test_codex();
let test = builder.build_with_remote_env(&server).await?;
let TestCodex {
codex,
+5 -4
View File
@@ -190,7 +190,8 @@ pub enum Feature {
ImageGeneration,
/// Replace hosted image generation with the standalone image-generation extension.
ImageGenExt,
/// Resize all inline data-URL images before recording them in history.
/// Removed compatibility flag now that all inline data-URL images are prepared before being
/// recorded in history.
ResizeAllImages,
/// Allow prompting and installing missing MCP dependencies.
SkillMcpDependencyInstall,
@@ -463,7 +464,7 @@ impl Features {
"tool_search" | "apps_mcp_path_override" => {
continue;
}
"image_detail_original" => {
"image_detail_original" | "resize_all_images" => {
continue;
}
"plugin_hooks" => {
@@ -1137,8 +1138,8 @@ pub const FEATURES: &[FeatureSpec] = &[
FeatureSpec {
id: Feature::ResizeAllImages,
key: "resize_all_images",
stage: Stage::UnderDevelopment,
default_enabled: false,
stage: Stage::Removed,
default_enabled: true,
},
FeatureSpec {
id: Feature::SkillMcpDependencyInstall,
+18
View File
@@ -476,6 +476,24 @@ fn from_sources_ignores_removed_image_detail_original_feature_key() {
assert_eq!(features, Features::with_defaults());
}
#[test]
fn from_sources_ignores_removed_resize_all_images_feature_key() {
let features_toml =
FeaturesToml::from(BTreeMap::from([("resize_all_images".to_string(), false)]));
let features = Features::from_sources(
FeatureConfigSource {
features: Some(&features_toml),
..Default::default()
},
FeatureConfigSource::default(),
FeatureOverrides::default(),
);
assert_eq!(features, Features::with_defaults());
assert_eq!(features.enabled(Feature::ResizeAllImages), true);
}
#[test]
fn from_sources_ignores_removed_undo_feature_key() {
let features_toml = FeaturesToml::from(BTreeMap::from([("undo".to_string(), true)]));