mirror of
https://github.com/openai/codex.git
synced 2026-08-27 13:49:27 +00:00
## 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
199 lines
4.3 KiB
JSON
Generated
199 lines
4.3 KiB
JSON
Generated
{
|
|
"$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",
|
|
"prolite",
|
|
"team",
|
|
"self_serve_business_usage_based",
|
|
"business",
|
|
"enterprise_cbp_usage_based",
|
|
"enterprise",
|
|
"edu",
|
|
"unknown"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"RateLimitReachedType": {
|
|
"enum": [
|
|
"rate_limit_reached",
|
|
"workspace_owner_credits_depleted",
|
|
"workspace_member_credits_depleted",
|
|
"workspace_owner_usage_limit_reached",
|
|
"workspace_member_usage_limit_reached"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"RateLimitSnapshot": {
|
|
"properties": {
|
|
"credits": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/CreditsSnapshot"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"individualLimit": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/SpendControlLimitSnapshot"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"limitId": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"limitName": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"planType": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/PlanType"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"primary": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/RateLimitWindow"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"rateLimitReachedType": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/RateLimitReachedType"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"secondary": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/RateLimitWindow"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"spendControlReached": {
|
|
"description": "Backend-reported spend-control state. `None` is unavailable, not a sparse-update recovery.",
|
|
"type": [
|
|
"boolean",
|
|
"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"
|
|
},
|
|
"SpendControlLimitSnapshot": {
|
|
"properties": {
|
|
"limit": {
|
|
"type": "string"
|
|
},
|
|
"remainingPercent": {
|
|
"format": "int32",
|
|
"type": "integer"
|
|
},
|
|
"resetsAt": {
|
|
"format": "int64",
|
|
"type": "integer"
|
|
},
|
|
"used": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"limit",
|
|
"remainingPercent",
|
|
"resetsAt",
|
|
"used"
|
|
],
|
|
"type": "object"
|
|
}
|
|
},
|
|
"description": "Sparse rolling rate-limit update.\n\nClients should merge available values into the most recent `account/rateLimits/read` response or refetch that snapshot. Nullable account metadata may be unavailable in a rolling update and does not clear a previously observed value.",
|
|
"properties": {
|
|
"rateLimits": {
|
|
"$ref": "#/definitions/RateLimitSnapshot"
|
|
}
|
|
},
|
|
"required": [
|
|
"rateLimits"
|
|
],
|
|
"title": "AccountRateLimitsUpdatedNotification",
|
|
"type": "object"
|
|
} |