mirror of
https://github.com/openai/codex.git
synced 2026-04-29 00:55:38 +00:00
feat: rename experimental_instructions_file to model_instructions_file (#9555)
A user who has `experimental_instructions_file` set will now see this: <img width="888" height="660" alt="image" src="https://github.com/user-attachments/assets/51c98312-eb9b-4881-81f1-bea6677e158d" /> And a `codex exec` would include this warning: <img width="888" height="660" alt="image" src="https://github.com/user-attachments/assets/a89f62be-1edf-4593-a75e-e0b4a762ed7d" />
This commit is contained in:
@@ -109,11 +109,11 @@ async fn chat_mode_stream_cli() {
|
||||
);
|
||||
}
|
||||
|
||||
/// Verify that passing `-c experimental_instructions_file=...` to the CLI
|
||||
/// Verify that passing `-c model_instructions_file=...` to the CLI
|
||||
/// overrides the built-in base instructions by inspecting the request body
|
||||
/// received by a mock OpenAI Responses endpoint.
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn exec_cli_applies_experimental_instructions_file() {
|
||||
async fn exec_cli_applies_model_instructions_file() {
|
||||
skip_if_no_network!();
|
||||
|
||||
// Start mock server which will capture the request and return a minimal
|
||||
@@ -128,7 +128,7 @@ async fn exec_cli_applies_experimental_instructions_file() {
|
||||
// Create a temporary instructions file with a unique marker we can assert
|
||||
// appears in the outbound request payload.
|
||||
let custom = TempDir::new().unwrap();
|
||||
let marker = "cli-experimental-instructions-marker";
|
||||
let marker = "cli-model-instructions-file-marker";
|
||||
let custom_path = custom.path().join("instr.md");
|
||||
std::fs::write(&custom_path, marker).unwrap();
|
||||
let custom_path_str = custom_path.to_string_lossy().replace('\\', "/");
|
||||
@@ -151,9 +151,7 @@ async fn exec_cli_applies_experimental_instructions_file() {
|
||||
.arg("-c")
|
||||
.arg("model_provider=\"mock\"")
|
||||
.arg("-c")
|
||||
.arg(format!(
|
||||
"experimental_instructions_file=\"{custom_path_str}\""
|
||||
))
|
||||
.arg(format!("model_instructions_file=\"{custom_path_str}\""))
|
||||
.arg("-C")
|
||||
.arg(&repo_root)
|
||||
.arg("hello?\n");
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
#![cfg(not(target_os = "windows"))]
|
||||
|
||||
use anyhow::Ok;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_core::config_loader::ConfigLayerEntry;
|
||||
use codex_core::config_loader::ConfigLayerStack;
|
||||
use codex_core::config_loader::ConfigRequirements;
|
||||
use codex_core::config_loader::ConfigRequirementsToml;
|
||||
use codex_core::features::Feature;
|
||||
use codex_core::protocol::DeprecationNoticeEvent;
|
||||
use codex_core::protocol::EventMsg;
|
||||
use core_test_support::responses::start_mock_server;
|
||||
use core_test_support::skip_if_no_network;
|
||||
use core_test_support::test_absolute_path;
|
||||
use core_test_support::test_codex::TestCodex;
|
||||
use core_test_support::test_codex::test_codex;
|
||||
use core_test_support::wait_for_event_match;
|
||||
use pretty_assertions::assert_eq;
|
||||
use toml::Value as TomlValue;
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn emits_deprecation_notice_for_legacy_feature_flag() -> anyhow::Result<()> {
|
||||
@@ -48,3 +55,58 @@ async fn emits_deprecation_notice_for_legacy_feature_flag() -> anyhow::Result<()
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn emits_deprecation_notice_for_experimental_instructions_file() -> anyhow::Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = start_mock_server().await;
|
||||
|
||||
let mut builder = test_codex().with_config(|config| {
|
||||
let mut table = toml::map::Map::new();
|
||||
table.insert(
|
||||
"experimental_instructions_file".to_string(),
|
||||
TomlValue::String("legacy.md".to_string()),
|
||||
);
|
||||
let config_layer = ConfigLayerEntry::new(
|
||||
ConfigLayerSource::User {
|
||||
file: test_absolute_path("/tmp/config.toml"),
|
||||
},
|
||||
TomlValue::Table(table),
|
||||
);
|
||||
let config_layer_stack = ConfigLayerStack::new(
|
||||
vec![config_layer],
|
||||
ConfigRequirements::default(),
|
||||
ConfigRequirementsToml::default(),
|
||||
)
|
||||
.expect("build config layer stack");
|
||||
config.config_layer_stack = config_layer_stack;
|
||||
});
|
||||
|
||||
let TestCodex { codex, .. } = builder.build(&server).await?;
|
||||
|
||||
let notice = wait_for_event_match(&codex, |event| match event {
|
||||
EventMsg::DeprecationNotice(ev)
|
||||
if ev.summary.contains("experimental_instructions_file") =>
|
||||
{
|
||||
Some(ev.clone())
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.await;
|
||||
|
||||
let DeprecationNoticeEvent { summary, details } = notice;
|
||||
assert_eq!(
|
||||
summary,
|
||||
"`experimental_instructions_file` is deprecated and ignored. Use `model_instructions_file` instead."
|
||||
.to_string(),
|
||||
);
|
||||
assert_eq!(
|
||||
details.as_deref(),
|
||||
Some(
|
||||
"Move the setting to `model_instructions_file` in config.toml (or under a profile) to load instructions from a file."
|
||||
),
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user