From 77c7b047de8cb6e6416742b08539e9164e162d9b Mon Sep 17 00:00:00 2001 From: ani Date: Thu, 18 Jun 2026 09:38:58 -0700 Subject: [PATCH] Verify model-owned skills guidance routing --- codex-rs/core/src/session/mod.rs | 4 +++- codex-rs/core/tests/suite/client.rs | 23 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/codex-rs/core/src/session/mod.rs b/codex-rs/core/src/session/mod.rs index 28782e6298..c912c74839 100644 --- a/codex-rs/core/src/session/mod.rs +++ b/codex-rs/core/src/session/mod.rs @@ -460,7 +460,9 @@ pub(crate) const INITIAL_SUBMIT_ID: &str = ""; pub(crate) const SUBMISSION_CHANNEL_CAPACITY: usize = 512; const CYBER_VERIFY_URL: &str = "https://chatgpt.com/cyber"; const CYBER_SAFETY_URL: &str = "https://developers.openai.com/codex/concepts/cyber-safety"; -// Compatibility list for models through GPT-5.5. Newer models own this guidance. +// Snapshot of the models in bundled models.json when skills guidance moved into +// model-owned instructions. Do not add new models here: new slugs should carry +// the guidance in their resolved model instructions. const MODELS_REQUIRING_LEGACY_SKILLS_INSTRUCTIONS: &[&str] = &[ "gpt-5.5", "gpt-5.4", diff --git a/codex-rs/core/tests/suite/client.rs b/codex-rs/core/tests/suite/client.rs index cf000f541c..0757f356c1 100644 --- a/codex-rs/core/tests/suite/client.rs +++ b/codex-rs/core/tests/suite/client.rs @@ -1654,7 +1654,9 @@ async fn skills_append_to_developer_message() { } #[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn models_outside_legacy_list_omit_legacy_guidance() { +async fn models_outside_legacy_list_use_model_owned_guidance() { + const MODEL_OWNED_SKILLS_GUIDANCE: &str = "model-owned skills guidance"; + skip_if_no_network!(); let server = MockServer::start().await; @@ -1679,6 +1681,19 @@ async fn models_outside_legacy_list_omit_legacy_guidance() { .with_auth(CodexAuth::from_api_key("Test API Key")) .with_model_info_override("gpt-5.4", |model_info| { model_info.slug = "future-model".to_string(); + if let Some(instructions_template) = model_info + .model_messages + .as_mut() + .and_then(|messages| messages.instructions_template.as_mut()) + { + instructions_template.push_str("\n\n"); + instructions_template.push_str(MODEL_OWNED_SKILLS_GUIDANCE); + } else { + model_info.base_instructions.push_str("\n\n"); + model_info + .base_instructions + .push_str(MODEL_OWNED_SKILLS_GUIDANCE); + } }) .with_model("future-model") .with_config(move |config| { @@ -1707,6 +1722,12 @@ async fn models_outside_legacy_list_omit_legacy_guidance() { wait_for_event(&codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await; let request = resp_mock.single_request(); + assert!( + request + .instructions_text() + .contains(MODEL_OWNED_SKILLS_GUIDANCE), + "expected model-owned skills guidance in the resolved base instructions" + ); let developer_messages = request.message_input_texts("developer"); let developer_text = developer_messages.join("\n\n"); assert!(