Skip to content

[codex] Match usage-limit TUI copy and owner nudge type#17956

Open
richardopenai wants to merge 9 commits intomainfrom
codex/workspace-owner-usage-nudge
Open

[codex] Match usage-limit TUI copy and owner nudge type#17956
richardopenai wants to merge 9 commits intomainfrom
codex/workspace-owner-usage-nudge

Conversation

@richardopenai
Copy link
Copy Markdown
Contributor

@richardopenai richardopenai commented Apr 15, 2026

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

  • Use the existing RateLimitReachedType state in the TUI to select member/owner usage-limit copy instead of showing one generic workspace-credit prompt.
  • Send AddCreditsNudgeCreditType::Credits for workspace member credit depletion and AddCreditsNudgeCreditType::UsageLimit for workspace member usage-limit requests.
  • Track the in-flight owner nudge type so success, cooldown, and failure feedback use credits-specific or usage-limit-specific copy.
  • Keep generic RateLimitReached and missing-state behavior unchanged.

Why

Desktop already distinguishes the two owner-nudge types:

  • workspace member usage-limit increases use credit_type: "usage_limit"
  • workspace member credit depletion uses 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-tui
  • cargo insta accept -p codex-tui
  • just fmt
  • just fix -p codex-tui
  • git diff --check

Desktop smoke

Ran the dev Desktop app from /Users/richardlee/code/openai/codex/codex-apps with CODEX_CLI_PATH=/Users/richardlee/code/codex/codex-rs/target/debug/codex.

Member account richardlee+member@mail.openai.com:

  • Desktop showed the usage-limit card with Usage limit reached, Request a limit increase from your owner to continue using codex., and Request Increase.
  • Clicking the CTA showed the usage-specific cooldown toast: A limit increase was already requested recently.
  • Re-click/network monitoring did not show repeated nudge requests.

Owner account richardlee+dogfood@mail.openai.com:

  • After switching the dev app to GPT-5.4, Desktop showed owner-only limit UI: Usage limit reached, You've reached your usage limit. Increase your limits to continue using codex., and Increase Spend Cap.
  • No owner-nudge CTA was present for the owner state.
  • App-server logs showed the expected turn lifecycle and one account/rateLimits/updated, with no repeated request loop.

CLI smoke:

  • Member CLI followed the existing /api/codex/usage state, which currently returns workspace_member_credits_depleted for 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.
  • Owner CLI with the owner account showed 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/usage and the Desktop turn-failure UI. This PR intentionally does not infer state from other fields; it uses the existing CLI RateLimitReachedType as requested.

@richardopenai richardopenai changed the title [codex] Add workspace owner usage nudge [codex] Fix workspace owner nudge prompts Apr 15, 2026
@richardopenai richardopenai changed the title [codex] Fix workspace owner nudge prompts [codex] Match usage-limit TUI copy and owner nudge type Apr 15, 2026
@richardopenai richardopenai marked this pull request as ready for review April 15, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant