mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Split DeveloperInstructions into individual fragments. (#18813)
Split DeveloperInstructions into individual fragments.
This commit is contained in:
committed by
GitHub
Unverified
parent
5fe767e8e1
commit
2a226096f6
@@ -88,7 +88,6 @@ use codex_protocol::config_types::ModeKind;
|
||||
use codex_protocol::config_types::Settings;
|
||||
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::protocol::AskForApproval;
|
||||
@@ -5026,7 +5025,7 @@ async fn build_initial_context_trims_skill_metadata_from_context_window_budget()
|
||||
#[test]
|
||||
fn emit_thread_start_skill_metrics_records_enabled_kept_and_truncated_values() {
|
||||
let session_telemetry = test_session_telemetry_without_metadata();
|
||||
let rendered = render_skills_section(
|
||||
let rendered = build_available_skills(
|
||||
&[SkillMetadata {
|
||||
name: "repo-skill".to_string(),
|
||||
description: "desc".to_string(),
|
||||
@@ -5147,12 +5146,12 @@ async fn handle_output_item_done_records_image_save_history_message() {
|
||||
let image_output_dir = image_output_path
|
||||
.parent()
|
||||
.expect("generated image path should have a parent");
|
||||
let image_message: ResponseItem = DeveloperInstructions::new(format!(
|
||||
"Generated images are saved to {} as {} by default.\nIf you need to use a generated image at another path, copy it and leave the original in place unless the user explicitly asks you to delete it.",
|
||||
image_output_dir.display(),
|
||||
image_output_path.display(),
|
||||
))
|
||||
.into();
|
||||
let image_message: ResponseItem = crate::context::ContextualUserFragment::into(
|
||||
crate::context::ImageGenerationInstructions::new(
|
||||
image_output_dir.display(),
|
||||
image_output_path.display(),
|
||||
),
|
||||
);
|
||||
assert_eq!(history.raw_items(), &[image_message, item]);
|
||||
assert_eq!(
|
||||
std::fs::read(&expected_saved_path).expect("saved file"),
|
||||
@@ -6449,7 +6448,9 @@ async fn sample_rollout(
|
||||
.as_ref()
|
||||
.and_then(|m| m.get_personality_message(Some(p)).filter(|s| !s.is_empty()))
|
||||
{
|
||||
let msg = DeveloperInstructions::personality_spec_message(personality_message).into();
|
||||
let msg = crate::context::ContextualUserFragment::into(
|
||||
crate::context::PersonalitySpecInstructions::new(personality_message),
|
||||
);
|
||||
let insert_at = initial_context
|
||||
.iter()
|
||||
.position(|m| matches!(m, ResponseItem::Message { role, .. } if role == "developer"))
|
||||
|
||||
Reference in New Issue
Block a user