mirror of
https://github.com/openai/codex.git
synced 2026-04-25 15:15:15 +00:00
## Summary - Replace the manual `/notify-owner` flow with an inline confirmation prompt when a usage-based workspace member hits a credits-depleted limit. - Fetch the current workspace role from the live ChatGPT `accounts/check/v4-2023-04-27` endpoint so owner/member behavior matches the desktop and web clients. - Keep owner, member, and spend-cap messaging distinct so we only offer the owner nudge when the workspace is actually out of credits. ## What Changed - `backend-client` - Added a typed fetch for the current account role from `accounts/check`. - Mapped backend role values into a Rust workspace-role enum. - `app-server` and protocol - Added `workspaceRole` to `account/read` and `account/updated`. - Derived `isWorkspaceOwner` from the live role, with a fallback to the cached token claim when the role fetch is unavailable. - `tui` - Removed the explicit `/notify-owner` slash command. - When a member is blocked because the workspace is out of credits, the error now prompts: - `Your workspace is out of credits. Request more from your workspace owner? [y/N]` - Choosing `y` sends the existing owner-notification request. - Choosing `n`, pressing `Esc`, or accepting the default selection dismisses the prompt without sending anything. - Selection popups now honor explicit item shortcuts, which is how the `y` / `n` interaction is wired. ## Reviewer Notes - The main behavior change is scoped to usage-based workspace members whose workspace credits are depleted. - Spend-cap reached should not show the owner-notification prompt. - Owners and admins should continue to see `/usage` guidance instead of the member prompt. - The live role fetch is best-effort; if it fails, we fall back to the existing token-derived ownership signal. ## Testing - Manual verification - Workspace owner does not see the member prompt. - Workspace member with depleted credits sees the confirmation prompt and can send the nudge with `y`. - Workspace member with spend cap reached does not see the owner-notification prompt. ### Workspace member out of usage https://github.com/user-attachments/assets/341ac396-eff4-4a7f-bf0c-60660becbea1 ### Workspace owner <img width="1728" height="1086" alt="Screenshot 2026-04-09 at 11 48 22 AM" src="https://github.com/user-attachments/assets/06262a45-e3fc-4cc4-8326-1cbedad46ed6" />
156 lines
2.9 KiB
JSON
156 lines
2.9 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"definitions": {
|
|
"CreditsSnapshot": {
|
|
"properties": {
|
|
"balance": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"hasCredits": {
|
|
"type": "boolean"
|
|
},
|
|
"unlimited": {
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"required": [
|
|
"hasCredits",
|
|
"unlimited"
|
|
],
|
|
"type": "object"
|
|
},
|
|
"PlanType": {
|
|
"enum": [
|
|
"free",
|
|
"go",
|
|
"plus",
|
|
"pro",
|
|
"team",
|
|
"self_serve_business_usage_based",
|
|
"business",
|
|
"enterprise_cbp_usage_based",
|
|
"enterprise",
|
|
"edu",
|
|
"unknown"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"RateLimitSnapshot": {
|
|
"properties": {
|
|
"credits": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/CreditsSnapshot"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"limitId": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"limitName": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"planType": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/PlanType"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"primary": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/RateLimitWindow"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"secondary": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/RateLimitWindow"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"spendControl": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/SpendControlSnapshot"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"type": "object"
|
|
},
|
|
"RateLimitWindow": {
|
|
"properties": {
|
|
"resetsAt": {
|
|
"format": "int64",
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
]
|
|
},
|
|
"usedPercent": {
|
|
"format": "int32",
|
|
"type": "integer"
|
|
},
|
|
"windowDurationMins": {
|
|
"format": "int64",
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
]
|
|
}
|
|
},
|
|
"required": [
|
|
"usedPercent"
|
|
],
|
|
"type": "object"
|
|
},
|
|
"SpendControlSnapshot": {
|
|
"properties": {
|
|
"reached": {
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"required": [
|
|
"reached"
|
|
],
|
|
"type": "object"
|
|
}
|
|
},
|
|
"properties": {
|
|
"rateLimits": {
|
|
"$ref": "#/definitions/RateLimitSnapshot"
|
|
}
|
|
},
|
|
"required": [
|
|
"rateLimits"
|
|
],
|
|
"title": "AccountRateLimitsUpdatedNotification",
|
|
"type": "object"
|
|
} |