From 5ca92fea3fcf3c905d4fad064b12fb7df731af15 Mon Sep 17 00:00:00 2001 From: jayp-oai Date: Mon, 6 Jul 2026 11:59:05 -0700 Subject: [PATCH] avoid promising referral rewards --- codex-rs/chatgpt/src/referrals.rs | 28 +------------------ ...tests__usage_menu_with_referral_offer.snap | 2 +- .../tui/src/chatwidget/tests/referrals.rs | 2 +- ...tests__referrals__referral_popup_flow.snap | 2 +- 4 files changed, 4 insertions(+), 30 deletions(-) diff --git a/codex-rs/chatgpt/src/referrals.rs b/codex-rs/chatgpt/src/referrals.rs index f305146d95..2c2e572b1b 100644 --- a/codex-rs/chatgpt/src/referrals.rs +++ b/codex-rs/chatgpt/src/referrals.rs @@ -179,7 +179,7 @@ impl ReferralClient { let description = eligibility .description .clone() - .unwrap_or_else(|| fallback_description(&eligibility)); + .unwrap_or_else(|| "Invite someone to Codex. Rewards may apply.".to_string()); Ok(Some(ReferralOffer { description, @@ -317,29 +317,3 @@ fn preflight_failure(message: impl Into) -> anyhow::Error { } .into() } - -fn fallback_description(eligibility: &EligibilityResponse) -> String { - match (&eligibility.grant_amount, &eligibility.grant_action) { - (Some(amount), Some(action)) => format!( - "Invite someone and earn {} {}.", - reward_value_to_string(amount), - reward_value_to_string(action) - ), - (Some(amount), None) => format!( - "Invite someone and earn a Codex reward worth {}.", - reward_value_to_string(amount) - ), - (None, Some(action)) => format!( - "Invite someone and earn a Codex {} reward.", - reward_value_to_string(action) - ), - (None, None) => "Invite someone and earn a Codex reward.".to_string(), - } -} - -fn reward_value_to_string(value: &Value) -> String { - value - .as_str() - .map(str::to_string) - .unwrap_or_else(|| value.to_string()) -} diff --git a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__usage_menu_with_referral_offer.snap b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__usage_menu_with_referral_offer.snap index 492e2e6af1..b3a5963d49 100644 --- a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__usage_menu_with_referral_offer.snap +++ b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__usage_menu_with_referral_offer.snap @@ -7,6 +7,6 @@ expression: "render_bottom_popup(&chat, 80)" › 1. Show usage View recent account token usage. 2. Redeem usage limit reset Check reset availability. - 3. Invite someone to Codex Invite a friend and earn a usage reset. + 3. Invite someone to Codex Invite someone to Codex. Rewards may apply. Press enter to confirm or esc to go back diff --git a/codex-rs/tui/src/chatwidget/tests/referrals.rs b/codex-rs/tui/src/chatwidget/tests/referrals.rs index e6263c4fac..e656bad63a 100644 --- a/codex-rs/tui/src/chatwidget/tests/referrals.rs +++ b/codex-rs/tui/src/chatwidget/tests/referrals.rs @@ -173,7 +173,7 @@ async fn changed_referral_offer_requires_reconfirmation_before_send() { fn test_offer() -> ReferralOffer { ReferralOffer { - description: "Invite a friend and earn a usage reset.".to_string(), + description: "Invite someone to Codex. Rewards may apply.".to_string(), rules: vec!["Your friend must be new to Codex.".to_string()], grant_action: Some(serde_json::json!("usage_reset")), grant_amount: Some(serde_json::json!(1)), diff --git a/codex-rs/tui/src/chatwidget/tests/snapshots/codex_tui__chatwidget__tests__referrals__referral_popup_flow.snap b/codex-rs/tui/src/chatwidget/tests/snapshots/codex_tui__chatwidget__tests__referrals__referral_popup_flow.snap index 243a8553cd..be09bc3883 100644 --- a/codex-rs/tui/src/chatwidget/tests/snapshots/codex_tui__chatwidget__tests__referrals__referral_popup_flow.snap +++ b/codex-rs/tui/src/chatwidget/tests/snapshots/codex_tui__chatwidget__tests__referrals__referral_popup_flow.snap @@ -11,7 +11,7 @@ EMAIL Press enter to confirm or esc to go back CONFIRMATION Send referral invite? - Invite a friend and earn a usage reset. + Invite someone to Codex. Rewards may apply. Recipient: friend@example.com • Your friend must be new to Codex. By sending, you confirm that you have this