fix(openai): refresh macOS client identity presets

Use macOS 27.2.1 for Desktop and CLI defaults. Select the TUI entry and Apple_Terminal/488.9 in the macOS CLI preset while preserving saved identity choices.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Zyy
2026-11-25 21:05:27 +08:00
co-authored by Codex
parent 3e747cb233
commit d777945c93
6 changed files with 32 additions and 17 deletions
@@ -10,6 +10,7 @@ pub(super) const CLI_ORIGINATOR: &str = "codex_cli_rs";
pub(super) const TUI_ORIGINATOR: &str = "codex-tui";
pub(super) const EXEC_ORIGINATOR: &str = "codex_exec";
pub(super) const TERMINAL: &str = "unknown";
pub(super) const MACOS_CLI_TERMINAL: &str = "Apple_Terminal/488.9";
pub(super) struct Environment {
pub os_type: &'static str,
@@ -19,7 +20,7 @@ pub(super) struct Environment {
pub(super) const MACOS_ENVIRONMENT: Environment = Environment {
os_type: "Mac OS",
os_version: "15.7.1",
os_version: "27.2.1",
arch: "arm64",
};
pub(super) const LINUX_ENVIRONMENT: Environment = Environment {
@@ -362,6 +362,10 @@ impl CodexWireProfileState {
let configuration = ClientProfileSelection {
client,
platform,
cli_entry: (client == ClientKind::Cli && platform == ClientPlatform::Macos)
.then_some(CliEntry::Tui),
terminal: (client == ClientKind::Cli && platform == ClientPlatform::Macos)
.then(|| baseline::MACOS_CLI_TERMINAL.to_owned()),
..ClientProfileSelection::default()
};
let available = configuration.resolve(self).is_ok();
@@ -247,7 +247,7 @@ async fn restored_cache_release_should_stay_in_version_lag_history() {
assert_eq!(lagged.desktop_version, "26.810.41047");
assert_eq!(
lagged.user_agent(),
"Codex Desktop/0.148.0-alpha.9 (Mac OS 15.7.1; arm64) unknown (Codex Desktop; 26.810.41047)"
"Codex Desktop/0.148.0-alpha.9 (Mac OS 27.2.1; arm64) unknown (Codex Desktop; 26.810.41047)"
);
// 滞后两档落到启动种子,恢复观察与启动种子共同构成启动历史。
assert_eq!(
@@ -10,7 +10,7 @@ use provider_openai::profile::{
use serde_json::json;
#[test]
fn six_presets_have_explicit_availability_and_cli_has_no_desktop_suffix() {
fn six_presets_resolve_available_client_identities() {
let state = CodexWireProfileState::new(CodexWireProfile::default());
assert_eq!(
ClientProfileSelection::default().resolve(&state).unwrap(),
@@ -25,22 +25,29 @@ fn six_presets_have_explicit_availability_and_cli_has_no_desktop_suffix() {
.iter()
.all(|preset| preset["automaticAvailable"] == true)
);
for platform in [
ClientPlatform::Macos,
ClientPlatform::Linux,
ClientPlatform::Windows,
] {
let selection = ClientProfileSelection {
client: ClientKind::Cli,
platform,
..Default::default()
};
for preset in presets
.iter()
.filter(|preset| preset["configuration"]["client"] == "cli")
{
let selection: ClientProfileSelection =
serde_json::from_value(preset["configuration"].clone()).unwrap();
let profile = selection.resolve(&state).unwrap();
assert_eq!(profile.originator, "codex_cli_rs");
assert_eq!(profile.os_type, platform.os_type());
if selection.platform == ClientPlatform::Macos {
let version = &profile.codex_version;
assert_eq!(
profile.user_agent(),
format!(
"codex-tui/{version} (Mac OS 27.2.1; arm64) Apple_Terminal/488.9 (codex-tui; {version})"
)
);
assert_eq!(profile.originator, "codex-tui");
} else {
assert_eq!(profile.originator, "codex_cli_rs");
assert!(profile.user_agent().ends_with("unknown"));
}
assert_eq!(profile.os_type, selection.platform.os_type());
assert!(profile.desktop_version.is_empty());
assert!(!profile.user_agent().contains("Desktop"));
assert!(profile.user_agent().ends_with("unknown"));
assert!(profile.verified_at > chrono::DateTime::UNIX_EPOCH);
}
for platform in [ClientPlatform::Linux, ClientPlatform::Windows] {
@@ -73,7 +73,7 @@ async fn lagged_profiles_track_observed_release_history() {
assert_eq!(lagged.desktop_version, "26.810.41047");
assert_eq!(
lagged.user_agent(),
"Codex Desktop/0.148.0-alpha.9 (Mac OS 15.7.1; arm64) unknown (Codex Desktop; 26.810.41047)"
"Codex Desktop/0.148.0-alpha.9 (Mac OS 27.2.1; arm64) unknown (Codex Desktop; 26.810.41047)"
);
assert_eq!(
selection(Some(2)).resolve(&state).unwrap().codex_version,
+3
View File
@@ -2711,6 +2711,9 @@ TUI 默认标识为 `codex-tui`,Exec 为 `codex_exec`,入口后缀使用同
`originator` 覆盖只更改产品名前缀和配套头,后缀仍表示所选入口。省略 `osType` 使用平台名称;
自定义运行环境在自动更新时保持不变。未指定 `cliEntry` 时使用 `codex_cli_rs` 默认值且不添加入口后缀
macOS 的默认系统版本为 `27.2.1`。选择 macOS CLI 预设时,配置包含 `cliEntry: "tui"` 和
`terminal: "Apple_Terminal/488.9"`;已保存的入口和终端配置不随预设变化而改写
`terminal` 填写官方客户端的真实终端标记,如 `iTerm.app/3.5.0`、`vscode/1.99.0`、`Apple_Terminal`、
`Ghostty`、`WindowsTerminal`、`tmux-256color`、`xterm-256color`。省略时使用 `unknown`:
官方 Desktop 由 GUI 启动、无终端环境变量,其 UA 中的终端标记本就是 `unknown`,