mirror of
https://github.com/openai/codex.git
synced 2026-11-18 23:02:23 +00:00
Honor workspace spend controls in rate-limit handling (#33187)
## Why Sparse and out-of-order rate-limit updates can omit account metadata or let an older full read overwrite a newer workspace hard stop. Credit availability also does not always include a displayable balance. ## What changed - Propagate the backend's `spendControlReached` state through rate-limit snapshots and the app-server protocol, preserving it across sparse updates. - Keep workspace hard-stop classifications for error routing and ignore stale full-read results after a newer hard-stop notification. - Base TUI warnings and model-switch prompts on credit availability and hard-stop state, and show `Credits: Available` when a finite balance is hidden. ## Testing Added coverage for spend-control mapping, snapshot merging, out-of-order reads, workspace error routing, warning and prompt behavior, and credit status display. GitOrigin-RevId: 18b09d493d5a620a7c079fb721ec50b38dd5b04c
This commit is contained in:
1 parent
be0e0d791a
commit
4df8027a97
42 files changed
+1259
-120
No files matched your search
@@ -577,6 +577,8 @@ pub(crate) struct App {
|
||||
pending_primary_events: VecDeque<ThreadBufferedEvent>,
|
||||
pending_app_server_requests: PendingAppServerRequests,
|
||||
pending_startup_thread_start: bool,
|
||||
/// Invalidates in-flight full rate-limit reads when a newer rolling hard stop arrives.
|
||||
rate_limit_hard_stop_generation: u64,
|
||||
// Serialize plugin enablement writes per plugin so stale completions cannot
|
||||
// overwrite a newer toggle, even if the plugin is toggled from different
|
||||
// cwd contexts.
|
||||
@@ -1066,6 +1068,7 @@ See the Codex keymap documentation for supported actions and examples."
|
||||
pending_primary_events: VecDeque::new(),
|
||||
pending_app_server_requests: PendingAppServerRequests::default(),
|
||||
pending_startup_thread_start,
|
||||
rate_limit_hard_stop_generation: 0,
|
||||
pending_plugin_enabled_writes: HashMap::new(),
|
||||
pending_hook_enabled_writes: HashMap::new(),
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user