Add opt-out for rate limit model nudge (#6433)

## Summary
- add a `hide_rate_limit_model_nudge` notice flag plus config edit
plumbing so the rate limit reminder preference is persisted and
documented
- extend the chat widget prompt with a "never show again" option, and
wire new app events so selecting it hides future nudges immediately and
writes the config
- add unit coverage and refresh the snapshot for the three-option prompt

## Testing
- `just fmt`
- `just fix -p codex-tui`
- `just fix -p codex-core`
- `cargo test -p codex-tui`
- `cargo test -p codex-core` *(fails at
`exec::tests::kill_child_process_group_kills_grandchildren_on_timeout`:
grandchild process still alive)*

------
[Codex
Task](https://chatgpt.com/codex/tasks/task_i_6910d7f407748321b2661fc355416994)
This commit is contained in:
Ahmed Ibrahim
2025-11-10 09:21:53 -08:00
committed by GitHub
parent 788badd221
commit e743d251a7
8 changed files with 123 additions and 2 deletions

View File

@@ -1,12 +1,15 @@
---
source: tui/src/chatwidget/tests.rs
assertion_line: 500
expression: popup
---
Approaching rate limits
Switch to gpt-5-codex-mini for lower credit usage?
1. Switch to gpt-5-codex-mini Optimized for codex. Cheaper, faster, but
less capable.
1. Switch to gpt-5-codex-mini Optimized for codex. Cheaper,
faster, but less capable.
2. Keep current model
3. Keep current model (never show again) Hide future rate limit reminders
about switching models.
Press enter to confirm or esc to go back

View File

@@ -448,6 +448,22 @@ fn rate_limit_switch_prompt_shows_once_per_session() {
));
}
#[test]
fn rate_limit_switch_prompt_respects_hidden_notice() {
let auth = CodexAuth::create_dummy_chatgpt_auth_for_testing();
let (mut chat, _, _) = make_chatwidget_manual();
chat.config.model = "gpt-5".to_string();
chat.auth_manager = AuthManager::from_auth_for_testing(auth);
chat.config.notices.hide_rate_limit_model_nudge = Some(true);
chat.on_rate_limit_snapshot(Some(snapshot(95.0)));
assert!(matches!(
chat.rate_limit_switch_prompt,
RateLimitSwitchPromptState::Idle
));
}
#[test]
fn rate_limit_switch_prompt_defers_until_task_complete() {
let auth = CodexAuth::create_dummy_chatgpt_auth_for_testing();