Revert "Option to Notify Workspace Owner When Usage Limit is Reached" (#17391)

Reverts openai/codex#16969

#sev3-2026-04-10-accountscheckversion-500s-for-openai-workspace-7300
This commit is contained in:
Shijie Rao
2026-04-10 16:33:13 -07:00
committed by GitHub
Unverified
parent a3be74143a
commit 930e5adb7e
82 changed files with 60 additions and 3233 deletions
-20
View File
@@ -1,20 +0,0 @@
use crate::config::Config;
use codex_account::AddCreditsNudgeEmailStatus;
use codex_account::SendAddCreditsNudgeEmailError;
use codex_account::WorkspaceOwnership;
use codex_login::AuthManager;
use codex_login::CodexAuth;
pub async fn send_add_credits_nudge_email(
config: &Config,
auth_manager: &AuthManager,
) -> Result<AddCreditsNudgeEmailStatus, SendAddCreditsNudgeEmailError> {
codex_account::send_add_credits_nudge_email(config.chatgpt_base_url.clone(), auth_manager).await
}
pub async fn resolve_workspace_role_and_owner_for_auth(
chatgpt_base_url: &str,
auth: Option<&CodexAuth>,
) -> WorkspaceOwnership {
codex_account::resolve_workspace_role_and_owner_for_auth(chatgpt_base_url, auth).await
}
-49
View File
@@ -4796,10 +4796,6 @@ async fn submission_loop(sess: Arc<Session>, config: Arc<Config>, rx_sub: Receiv
handlers::set_thread_name(&sess, sub.id.clone(), name).await;
false
}
Op::SendAddCreditsNudgeEmail => {
handlers::send_add_credits_nudge_email(&sess, &config, sub.id.clone()).await;
false
}
Op::RunUserShellCommand { command } => {
handlers::run_user_shell_command(&sess, sub.id.clone(), command).await;
false
@@ -4896,8 +4892,6 @@ mod handlers {
use crate::tasks::execute_user_shell_command;
use codex_mcp::collect_mcp_snapshot_from_manager;
use codex_mcp::compute_auth_statuses;
use codex_protocol::protocol::AddCreditsNudgeEmailResponseEvent;
use codex_protocol::protocol::AddCreditsNudgeEmailStatus;
use codex_protocol::protocol::CodexErrorInfo;
use codex_protocol::protocol::ErrorEvent;
use codex_protocol::protocol::Event;
@@ -4942,48 +4936,6 @@ mod handlers {
sess.close_unified_exec_processes().await;
}
pub async fn send_add_credits_nudge_email(
sess: &Arc<Session>,
config: &Config,
sub_id: String,
) {
match crate::send_add_credits_nudge_email(config, &sess.services.auth_manager).await {
Ok(status) => {
sess.send_event_raw(Event {
id: sub_id,
msg: EventMsg::AddCreditsNudgeEmailResponse(
AddCreditsNudgeEmailResponseEvent {
result: Ok(add_credits_nudge_email_status_to_event(status)),
},
),
})
.await;
}
Err(err) => {
sess.send_event_raw(Event {
id: sub_id,
msg: EventMsg::AddCreditsNudgeEmailResponse(
AddCreditsNudgeEmailResponseEvent {
result: Err(err.to_string()),
},
),
})
.await;
}
}
}
fn add_credits_nudge_email_status_to_event(
status: crate::AddCreditsNudgeEmailStatus,
) -> AddCreditsNudgeEmailStatus {
match status {
crate::AddCreditsNudgeEmailStatus::Sent => AddCreditsNudgeEmailStatus::Sent,
crate::AddCreditsNudgeEmailStatus::CooldownActive => {
AddCreditsNudgeEmailStatus::CooldownActive
}
}
}
pub async fn realtime_conversation_list_voices(sess: &Session, sub_id: String) {
sess.send_event_raw(Event {
id: sub_id,
@@ -7290,7 +7242,6 @@ fn realtime_text_for_event(msg: &EventMsg) -> Option<String> {
| EventMsg::GetHistoryEntryResponse(_)
| EventMsg::McpListToolsResponse(_)
| EventMsg::ListSkillsResponse(_)
| EventMsg::AddCreditsNudgeEmailResponse(_)
| EventMsg::RealtimeConversationListVoicesResponse(_)
| EventMsg::SkillsUpdateAvailable
| EventMsg::PlanUpdate(_)
-6
View File
@@ -2012,7 +2012,6 @@ async fn set_rate_limits_retains_previous_credits() {
unlimited: false,
balance: Some("10.00".to_string()),
}),
spend_control: None,
plan_type: Some(codex_protocol::account::PlanType::Plus),
};
state.set_rate_limits(initial.clone());
@@ -2031,7 +2030,6 @@ async fn set_rate_limits_retains_previous_credits() {
resets_at: Some(1_900),
}),
credits: None,
spend_control: None,
plan_type: None,
};
state.set_rate_limits(update.clone());
@@ -2044,7 +2042,6 @@ async fn set_rate_limits_retains_previous_credits() {
primary: update.primary.clone(),
secondary: update.secondary,
credits: initial.credits,
spend_control: None,
plan_type: initial.plan_type,
})
);
@@ -2121,7 +2118,6 @@ async fn set_rate_limits_updates_plan_type_when_present() {
unlimited: false,
balance: Some("15.00".to_string()),
}),
spend_control: None,
plan_type: Some(codex_protocol::account::PlanType::Plus),
};
state.set_rate_limits(initial.clone());
@@ -2136,7 +2132,6 @@ async fn set_rate_limits_updates_plan_type_when_present() {
}),
secondary: None,
credits: None,
spend_control: None,
plan_type: Some(codex_protocol::account::PlanType::Pro),
};
state.set_rate_limits(update.clone());
@@ -2149,7 +2144,6 @@ async fn set_rate_limits_updates_plan_type_when_present() {
primary: update.primary,
secondary: update.secondary,
credits: initial.credits,
spend_control: None,
plan_type: update.plan_type,
})
);
-7
View File
@@ -5,7 +5,6 @@
// the TUI or the tracing stack).
#![deny(clippy::print_stdout, clippy::print_stderr)]
mod account;
mod apply_patch;
mod apps;
mod arc_monitor;
@@ -113,13 +112,7 @@ mod stream_events_utils;
pub mod test_support;
mod unified_exec;
pub mod windows_sandbox;
pub use account::resolve_workspace_role_and_owner_for_auth;
pub use account::send_add_credits_nudge_email;
pub use client::X_RESPONSESAPI_INCLUDE_TIMING_METRICS_HEADER;
pub use codex_account::AddCreditsNudgeEmailStatus;
pub use codex_account::SendAddCreditsNudgeEmailError;
pub use codex_account::WorkspaceOwnership;
pub use codex_account::WorkspaceRole;
pub use codex_protocol::config_types::ModelProviderAuthInfo;
mod event_mapping;
pub mod review_format;
-3
View File
@@ -229,9 +229,6 @@ fn merge_rate_limit_fields(
if snapshot.credits.is_none() {
snapshot.credits = previous.and_then(|prior| prior.credits.clone());
}
if snapshot.spend_control.is_none() {
snapshot.spend_control = previous.and_then(|prior| prior.spend_control.clone());
}
if snapshot.plan_type.is_none() {
snapshot.plan_type = previous.and_then(|prior| prior.plan_type);
}
-6
View File
@@ -48,7 +48,6 @@ async fn set_rate_limits_defaults_limit_id_to_codex_when_missing() {
}),
secondary: None,
credits: None,
spend_control: None,
plan_type: None,
});
@@ -76,7 +75,6 @@ async fn set_rate_limits_defaults_to_codex_when_limit_id_missing_after_other_buc
}),
secondary: None,
credits: None,
spend_control: None,
plan_type: None,
});
state.set_rate_limits(RateLimitSnapshot {
@@ -89,7 +87,6 @@ async fn set_rate_limits_defaults_to_codex_when_limit_id_missing_after_other_buc
}),
secondary: None,
credits: None,
spend_control: None,
plan_type: None,
});
@@ -121,7 +118,6 @@ async fn set_rate_limits_carries_credits_and_plan_type_from_codex_to_codex_other
unlimited: false,
balance: Some("50".to_string()),
}),
spend_control: None,
plan_type: Some(codex_protocol::account::PlanType::Plus),
});
@@ -135,7 +131,6 @@ async fn set_rate_limits_carries_credits_and_plan_type_from_codex_to_codex_other
}),
secondary: None,
credits: None,
spend_control: None,
plan_type: None,
});
@@ -155,7 +150,6 @@ async fn set_rate_limits_carries_credits_and_plan_type_from_codex_to_codex_other
unlimited: false,
balance: Some("50".to_string()),
}),
spend_control: None,
plan_type: Some(codex_protocol::account::PlanType::Plus),
})
);