feat: deprecation warning (#5825)

<img width="955" height="311" alt="Screenshot 2025-10-28 at 14 26 25"
src="https://github.com/user-attachments/assets/99729b3d-3bc9-4503-aab3-8dc919220ab4"
/>
This commit is contained in:
jif-oai
2025-10-29 12:29:28 +00:00
committed by GitHub
parent fa92cd92fa
commit 060637b4d4
12 changed files with 195 additions and 14 deletions

View File

@@ -97,11 +97,9 @@ impl TestCodexBuilder {
let mut config = load_default_config_for_test(home);
config.cwd = cwd.path().to_path_buf();
config.model_provider = model_provider;
config.codex_linux_sandbox_exe = Some(PathBuf::from(
assert_cmd::Command::cargo_bin("codex")?
.get_program()
.to_os_string(),
));
if let Ok(cmd) = assert_cmd::Command::cargo_bin("codex") {
config.codex_linux_sandbox_exe = Some(PathBuf::from(cmd.get_program().to_os_string()));
}
let mut mutators = vec![];
swap(&mut self.config_mutators, &mut mutators);

View File

@@ -0,0 +1,51 @@
#![cfg(not(target_os = "windows"))]
use anyhow::Ok;
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_codex::TestCodex;
use core_test_support::test_codex::test_codex;
use core_test_support::wait_for_event_match;
use pretty_assertions::assert_eq;
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn emits_deprecation_notice_for_legacy_feature_flag() -> anyhow::Result<()> {
skip_if_no_network!(Ok(()));
let server = start_mock_server().await;
let mut builder = test_codex().with_config(|config| {
config.features.enable(Feature::StreamableShell);
config.features.record_legacy_usage_force(
"experimental_use_exec_command_tool",
Feature::StreamableShell,
);
config.use_experimental_streamable_shell_tool = true;
});
let TestCodex { codex, .. } = builder.build(&server).await?;
let notice = wait_for_event_match(&codex, |event| match event {
EventMsg::DeprecationNotice(ev) => Some(ev.clone()),
_ => None,
})
.await;
let DeprecationNoticeEvent { summary, details } = notice;
assert_eq!(
summary,
"`experimental_use_exec_command_tool` is deprecated. Use `streamable_shell` instead."
.to_string(),
);
assert_eq!(
details.as_deref(),
Some(
"You can either enable it using the CLI with `--enable streamable_shell` or through the config.toml file with `[features].streamable_shell`"
),
);
Ok(())
}

View File

@@ -10,6 +10,7 @@ mod cli_stream;
mod client;
mod compact;
mod compact_resume_fork;
mod deprecation_notice;
mod exec;
mod fork_conversation;
mod grep_files;