rollback developer message

This commit is contained in:
won
2026-03-12 23:22:24 -07:00
parent ce64ddd3cb
commit ab7b839cab
3 changed files with 16 additions and 29 deletions

View File

@@ -58,6 +58,7 @@ use codex_app_server_protocol::AppInfo;
use codex_otel::TelemetryAuthMode;
use codex_protocol::models::BaseInstructions;
use codex_protocol::models::ContentItem;
use codex_protocol::models::DeveloperInstructions;
use codex_protocol::models::ResponseInputItem;
use codex_protocol::models::ResponseItem;
use codex_protocol::openai_models::ModelsResponse;
@@ -3218,19 +3219,12 @@ async fn handle_output_item_done_records_image_save_history_message() {
.expect("image generation item should succeed");
let history = session.clone_history().await;
let save_message = ResponseItem::Message {
id: None,
role: "user".to_string(),
content: vec![ContentItem::InputText {
text: format!(
"Generated images are saved to {} as {} by default.",
std::env::temp_dir().display(),
std::env::temp_dir().join("<image_id>.png").display(),
),
}],
end_turn: None,
phase: None,
};
let save_message: ResponseItem = DeveloperInstructions::new(format!(
"Generated images are saved to {} as {} by default.",
std::env::temp_dir().display(),
std::env::temp_dir().join("<image_id>.png").display(),
))
.into();
assert_eq!(history.raw_items(), &[save_message, item]);
assert_eq!(
std::fs::read(&expected_saved_path).expect("saved file"),

View File

@@ -19,7 +19,7 @@ use crate::parse_turn_item;
use crate::state_db;
use crate::tools::parallel::ToolCallRuntime;
use crate::tools::router::ToolRouter;
use codex_protocol::models::ContentItem;
use codex_protocol::models::DeveloperInstructions;
use codex_protocol::models::FunctionCallOutputBody;
use codex_protocol::models::FunctionCallOutputPayload;
use codex_protocol::models::ResponseInputItem;
@@ -306,19 +306,12 @@ pub(crate) async fn handle_non_tool_response_item(
Ok(path) => {
image_item.saved_path = Some(path.to_string_lossy().into_owned());
let image_output_dir = std::env::temp_dir();
let message = ResponseItem::Message {
id: None,
role: "user".to_string(),
content: vec![ContentItem::InputText {
text: format!(
"Generated images are saved to {} as {} by default.",
image_output_dir.display(),
image_output_dir.join("<image_id>.png").display(),
),
}],
end_turn: None,
phase: None,
};
let message: ResponseItem = DeveloperInstructions::new(format!(
"Generated images are saved to {} as {} by default.",
image_output_dir.display(),
image_output_dir.join("<image_id>.png").display(),
))
.into();
sess.record_conversation_items(
turn_context,
std::slice::from_ref(&message),

View File

@@ -548,7 +548,7 @@ async fn generated_image_is_replayed_for_image_capable_models() -> Result<()> {
);
assert!(
second_request
.message_input_texts("user")
.message_input_texts("developer")
.iter()
.any(|text| text.contains("Generated images are saved to")),
"second request should include the saved-path note in model-visible history"
@@ -680,7 +680,7 @@ async fn model_change_from_generated_image_to_text_preserves_prior_generated_ima
);
assert!(
second_request
.message_input_texts("user")
.message_input_texts("developer")
.iter()
.any(|text| text.contains("Generated images are saved to")),
"second request should include the saved-path note in model-visible history"