Show actionable rate-limit banners in the TUI (#41742)

## What changed

- Carry optional backend-owned banner and account identity data through
  `account/rateLimits/read`, filtering banners that do not match the authenticated
  account and user.
- Render supported rate-limit notices above the composer with actions for usage,
  credits, resets, owner notifications, and plan management while preserving the
  existing fallback UI for absent or unsupported banners.
- Refresh usage after limit errors, reject stale responses, and keep queued input
  paused until recovery completes. When instructed by the banner, switch to the
  first available fallback model without changing unrelated thread settings.

## Testing

- Add protocol, banner parsing and rendering, CTA, identity filtering, refresh
  ordering, fallback-model, account-change, and queued-input recovery coverage.

GitOrigin-RevId: e03d75a82e425deb87f4b120a71cf2286c0ef6cc
This commit is contained in:
stefanstokic-oai authored and copyberry committed 2026-08-31 00:20:06 +00:00
1 parent 94cbbddafc
commit 79b04f1ab5
69 files changed
+3454 -69

No files matched your search

+3
View File
@@ -211,6 +211,7 @@ pub(crate) use agents_overview::AGENTS_OVERVIEW_VIEW_ID;
mod app_server_event_targets;
mod app_server_events;
pub(crate) mod app_server_requests;
mod backend_banner_fallback;
mod background_requests;
mod config_persistence;
mod connector_mentions;
@@ -226,6 +227,7 @@ mod permission_shortcuts;
mod pets;
mod platform_actions;
mod plugin_mentions;
mod rate_limit_refresh;
mod recap;
mod replay_filter;
mod resize_reflow;
@@ -627,6 +629,7 @@ pub(crate) struct App {
startup_pending_protected_request: bool,
/// Invalidates in-flight full rate-limit reads when a newer rolling hard stop arrives.
rate_limit_hard_stop_generation: u64,
rate_limit_refresh_state: rate_limit_refresh::RateLimitRefreshState,
// Serialize plugin enablement writes per plugin so stale completions cannot
// overwrite a newer toggle, even if the plugin is toggled from different
// cwd contexts.