mirror of
https://github.com/openai/codex.git
synced 2026-04-30 17:36:40 +00:00
Express rate limit warning as % remaining (#7795)
<img width="342" height="264" alt="image" src="https://github.com/user-attachments/assets/f1e932ff-c550-47b3-9035-0299ada4998d" /> Earlier, the warning was expressed as consumed% whereas status was expressed as remaining%. This change brings the two into sync to minimize confusion and improve visual consistency.
This commit is contained in:
@@ -199,8 +199,9 @@ impl RateLimitWarningState {
|
||||
let limit_label = secondary_window_minutes
|
||||
.map(get_limits_duration)
|
||||
.unwrap_or_else(|| "weekly".to_string());
|
||||
let remaining_percent = 100.0 - threshold;
|
||||
warnings.push(format!(
|
||||
"Heads up, you've used over {threshold:.0}% of your {limit_label} limit. Run /status for a breakdown."
|
||||
"Heads up, you have less than {remaining_percent:.0}% of your {limit_label} limit left. Run /status for a breakdown."
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -217,8 +218,9 @@ impl RateLimitWarningState {
|
||||
let limit_label = primary_window_minutes
|
||||
.map(get_limits_duration)
|
||||
.unwrap_or_else(|| "5h".to_string());
|
||||
let remaining_percent = 100.0 - threshold;
|
||||
warnings.push(format!(
|
||||
"Heads up, you've used over {threshold:.0}% of your {limit_label} limit. Run /status for a breakdown."
|
||||
"Heads up, you have less than {remaining_percent:.0}% of your {limit_label} limit left. Run /status for a breakdown."
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user