mirror of
https://github.com/openai/codex.git
synced 2026-10-28 18:58:46 +00:00
Route cyber Trusted Access links by plan type (#40504)
## What changed - Send `Free`, `Go`, `Plus`, `Pro`, and `ProLite` ChatGPT users to the individual Trusted Access page when a cybersecurity policy error ends a turn. - Keep the enterprise Trusted Access application for other plans and sessions without a ChatGPT account or known plan. ## Testing - Cover individual and enterprise link selection in chat widget tests and history-cell snapshots. GitOrigin-RevId: a563560d15c401b47f1865a6f58ea4692d31d457
This commit is contained in:
@@ -104,9 +104,27 @@ async fn app_server_cyber_policy_error_renders_dedicated_notice() {
|
||||
let rendered = lines_to_single_string(&cells[0]);
|
||||
assert!(rendered.contains("This content can't be shown"));
|
||||
assert!(rendered.contains("extra caution with cybersecurity requests"));
|
||||
assert!(rendered.contains("openai.com/form/enterprise-trusted-access-for-cyber"));
|
||||
assert!(!rendered.contains("server fallback message"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn app_server_cyber_policy_error_uses_individual_link_for_personal_plan() {
|
||||
let (mut chat, mut rx, _ops) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.plan_type = Some(PlanType::Free);
|
||||
chat.has_chatgpt_account = true;
|
||||
|
||||
handle_error(
|
||||
&mut chat,
|
||||
"server fallback message",
|
||||
Some(CodexErrorInfo::CyberPolicy),
|
||||
);
|
||||
|
||||
let cells = drain_insert_history(&mut rx);
|
||||
assert_eq!(cells.len(), 1);
|
||||
assert!(lines_to_single_string(&cells[0]).contains("https://chatgpt.com/cyber/"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn app_server_model_verification_renders_warning() {
|
||||
let (mut chat, mut rx, _ops) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
|
||||
@@ -385,7 +385,12 @@ impl ChatWidget {
|
||||
pub(super) fn on_cyber_policy_error(&mut self) {
|
||||
self.input_queue.submit_pending_steers_after_interrupt = false;
|
||||
self.finalize_turn();
|
||||
self.add_to_history(history_cell::new_cyber_policy_error_event());
|
||||
let plan_type = if self.has_chatgpt_account {
|
||||
self.plan_type
|
||||
} else {
|
||||
None
|
||||
};
|
||||
self.add_to_history(history_cell::new_cyber_policy_error_event(plan_type));
|
||||
self.request_redraw();
|
||||
|
||||
// After an error ends the turn, try sending the next queued input.
|
||||
|
||||
Reference in New Issue
Block a user