mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
Promote Codex App on Windows in tooltips
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
</p>
|
||||
</br>
|
||||
If you want Codex in your code editor (VS Code, Cursor, Windsurf), <a href="https://developers.openai.com/codex/ide">install in your IDE.</a>
|
||||
</br>If you want the desktop app experience, run <code>codex app</code> or visit <a href="https://chatgpt.com/codex?app-landing-page=true">the Codex App page</a>.
|
||||
</br>If you want the desktop app experience on macOS or Windows, run <code>codex app</code> or visit <a href="https://chatgpt.com/codex?app-landing-page=true">the Codex App page</a>.
|
||||
</br>If you are looking for the <em>cloud-based agent</em> from OpenAI, <strong>Codex Web</strong>, go to <a href="https://chatgpt.com/codex">chatgpt.com/codex</a>.</p>
|
||||
|
||||
---
|
||||
|
||||
@@ -6,13 +6,12 @@ use rand::Rng;
|
||||
const ANNOUNCEMENT_TIP_URL: &str =
|
||||
"https://raw.githubusercontent.com/openai/codex/main/announcement_tip.toml";
|
||||
|
||||
const IS_MACOS: bool = cfg!(target_os = "macos");
|
||||
const IS_WINDOWS: bool = cfg!(target_os = "windows");
|
||||
const SUPPORTS_DESKTOP_APP: bool = cfg!(any(target_os = "macos", target_os = "windows"));
|
||||
|
||||
const APP_TOOLTIP: &str = "Try the **Codex App**. Run 'codex app' or visit https://chatgpt.com/codex?app-landing-page=true";
|
||||
const APP_TOOLTIP: &str = "Try the **Codex App** on Windows and macOS. Run 'codex app' or visit https://chatgpt.com/codex?app-landing-page=true";
|
||||
const FAST_TOOLTIP: &str =
|
||||
"*New* Use **/fast** to enable our fastest inference with increased plan usage.";
|
||||
const OTHER_TOOLTIP: &str = "*New* Build faster with the **Codex App**. Run 'codex app' or visit https://chatgpt.com/codex?app-landing-page=true";
|
||||
const OTHER_TOOLTIP: &str = "*New* Build faster with the **Codex App** on Windows and macOS. Run 'codex app' or visit https://chatgpt.com/codex?app-landing-page=true";
|
||||
const OTHER_TOOLTIP_NON_MAC: &str = "*New* Build faster with Codex.";
|
||||
const FREE_GO_TOOLTIP: &str =
|
||||
"*New* For a limited time, Codex is included in your plan for free – let’s build together.";
|
||||
@@ -27,7 +26,7 @@ lazy_static! {
|
||||
if line.is_empty() || line.starts_with('#') {
|
||||
return false;
|
||||
}
|
||||
if !IS_MACOS && !IS_WINDOWS && line.contains("codex app") {
|
||||
if !SUPPORTS_DESKTOP_APP && line.contains("codex app") {
|
||||
return false;
|
||||
}
|
||||
true
|
||||
@@ -71,10 +70,10 @@ pub(crate) fn get_tooltip(plan: Option<PlanType>, fast_mode_enabled: bool) -> Op
|
||||
}
|
||||
}
|
||||
Some(PlanType::Go) | Some(PlanType::Free) => {
|
||||
return Some(FREE_GO_TOOLTIP.to_string());
|
||||
return Some(pick_free_go_tooltip(&mut rng, SUPPORTS_DESKTOP_APP).to_string());
|
||||
}
|
||||
_ => {
|
||||
let tooltip = if IS_MACOS {
|
||||
let tooltip = if SUPPORTS_DESKTOP_APP {
|
||||
OTHER_TOOLTIP
|
||||
} else {
|
||||
OTHER_TOOLTIP_NON_MAC
|
||||
@@ -88,7 +87,7 @@ pub(crate) fn get_tooltip(plan: Option<PlanType>, fast_mode_enabled: bool) -> Op
|
||||
}
|
||||
|
||||
fn paid_app_tooltip() -> Option<&'static str> {
|
||||
if IS_MACOS || IS_WINDOWS {
|
||||
if SUPPORTS_DESKTOP_APP {
|
||||
Some(APP_TOOLTIP)
|
||||
} else {
|
||||
None
|
||||
@@ -110,6 +109,14 @@ fn pick_paid_tooltip<R: Rng + ?Sized>(
|
||||
}
|
||||
}
|
||||
|
||||
fn pick_free_go_tooltip<R: Rng + ?Sized>(rng: &mut R, supports_desktop_app: bool) -> &'static str {
|
||||
if supports_desktop_app && rng.random_bool(0.5) {
|
||||
APP_TOOLTIP
|
||||
} else {
|
||||
FREE_GO_TOOLTIP
|
||||
}
|
||||
}
|
||||
|
||||
fn pick_tooltip<R: Rng + ?Sized>(rng: &mut R) -> Option<&'static str> {
|
||||
if ALL_TOOLTIPS.is_empty() {
|
||||
None
|
||||
@@ -373,6 +380,34 @@ mod tests {
|
||||
assert!(!seen.contains(&Some(FAST_TOOLTIP)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn free_go_tooltip_rotates_between_plan_and_desktop_promos() {
|
||||
let mut seen = std::collections::BTreeSet::new();
|
||||
for seed in 0..16 {
|
||||
let mut rng = StdRng::seed_from_u64(seed);
|
||||
seen.insert(pick_free_go_tooltip(
|
||||
&mut rng, /*supports_desktop_app*/ true,
|
||||
));
|
||||
}
|
||||
|
||||
let expected = std::collections::BTreeSet::from([APP_TOOLTIP, FREE_GO_TOOLTIP]);
|
||||
assert_eq!(seen, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn free_go_tooltip_skips_desktop_promo_on_other_platforms() {
|
||||
let mut seen = std::collections::BTreeSet::new();
|
||||
for seed in 0..16 {
|
||||
let mut rng = StdRng::seed_from_u64(seed);
|
||||
seen.insert(pick_free_go_tooltip(
|
||||
&mut rng, /*supports_desktop_app*/ false,
|
||||
));
|
||||
}
|
||||
|
||||
let expected = std::collections::BTreeSet::from([FREE_GO_TOOLTIP]);
|
||||
assert_eq!(seen, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn announcement_tip_toml_picks_last_matching() {
|
||||
let toml = r#"
|
||||
|
||||
@@ -11,7 +11,7 @@ Use /fork to branch the current chat into a new thread.
|
||||
Use /side to start a side conversation in a temporary fork without polluting the main thread.
|
||||
Use /init to create an AGENTS.md with project-specific guidance.
|
||||
Use /mcp to list configured MCP tools.
|
||||
Run `codex app` to open Codex Desktop (it installs on macOS if needed).
|
||||
Run `codex app` to open the Codex App or get the macOS or Windows installer.
|
||||
Use /personality to customize how Codex communicates.
|
||||
Use /rename to rename your threads for easier thread resuming.
|
||||
Use the OpenAI docs MCP for API questions; enable it with `codex mcp add openaiDeveloperDocs --url https://developers.openai.com/mcp`.
|
||||
|
||||
Reference in New Issue
Block a user