[codex] Match usage-limit TUI copy and owner nudge type#17956
Open
richardopenai wants to merge 9 commits intomainfrom
Open
[codex] Match usage-limit TUI copy and owner nudge type#17956richardopenai wants to merge 9 commits intomainfrom
richardopenai wants to merge 9 commits intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR is the second try at implementing an option for workspace members to notify their workspace owners when they run out of usage. Original PR: #16969
The original PR caused a sev because it introduced a new auth endpoint check that caused an infinite loop in Codex desktop. This PR does not add any additional auth checks and re-uses the existing endpoint - https://github.com/openai/openai/pull/820331
So this time around, this PR is much lower risk since it's just adding new UI when the user hits their rate limit and then sending a backend call to send the notification
RateLimitReachedTypestate in the TUI to select member/owner usage-limit copy instead of showing one generic workspace-credit prompt.AddCreditsNudgeCreditType::Creditsfor workspace member credit depletion andAddCreditsNudgeCreditType::UsageLimitfor workspace member usage-limit requests.RateLimitReachedand missing-state behavior unchanged.Why
Desktop already distinguishes the two owner-nudge types:
credit_type: "usage_limit"credit_type: "credits"The CLI already had the corresponding enum values, but the TUI prompt and completion feedback were not state-specific. This aligns the CLI with the data it already receives without adding endpoints, changing protocol shapes, or refactoring Desktop.
Testing
cargo test -p codex-tui workspace_cargo test -p codex-tui status_cargo insta pending-snapshots -p codex-tuicargo insta accept -p codex-tuijust fmtjust fix -p codex-tuigit diff --checkDesktop smoke
Ran the dev Desktop app from
/Users/richardlee/code/openai/codex/codex-appswithCODEX_CLI_PATH=/Users/richardlee/code/codex/codex-rs/target/debug/codex.Member account
richardlee+member@mail.openai.com:Usage limit reached,Request a limit increase from your owner to continue using codex., andRequest Increase.A limit increase was already requested recently.Owner account
richardlee+dogfood@mail.openai.com:Usage limit reached,You've reached your usage limit. Increase your limits to continue using codex., andIncrease Spend Cap.account/rateLimits/updated, with no repeated request loop.CLI smoke:
/api/codex/usagestate, which currently returnsworkspace_member_credits_depletedfor the dogfood member account. That produced the credits prompt as designed from the CLI state source, while Desktop's failed turn showed usage-limit UI.You're out of credits. Your workspace is out of credits. Add credits to continue using Codex.and did not show an owner-nudge prompt.Note
The live dogfood member account currently has a backend state mismatch between
/api/codex/usageand the Desktop turn-failure UI. This PR intentionally does not infer state from other fields; it uses the existing CLIRateLimitReachedTypeas requested.