Skip to content

fix(app): type the Go and ChatGPT usage limits so their dialogs fire - #57897

Open
kitlangton wants to merge 2 commits into
devfrom
go-limit-dialogs
Open

kitlangton wants to merge 2 commits into
devfrom
go-limit-dialogs

Conversation

@kitlangton

@kitlangton kitlangton commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Desktop's "Go limit reached" and ChatGPT usage dialogs never fired in v2.

  • Go limit. The dialog listened for a session.status retry reason (account_rate_limit) that nothing publishes in v2, so a Go subscriber hitting the Console's GoUsageLimitError 429 got a red error and lost their prompt. Core now classifies that body as provider.go-limit (keeping retryAfterMs), the same way feat(core): typed free-limit error with reset time #57146 types provider.free-limit. Desktop shows Go limit reached with the reset time, links "Open settings" to the workspace's Console Go page (from the body's metadata.workspace), leaves a muted timeline line, and hands the prompt back.
  • ChatGPT limit. isChatGPTUsageLimit compared against an older copy of the message than core sends. Core now tags subscription_sharing_usage_limit_exceeded as provider.chatgpt-limit and the dialog matches on that type, never a copied string.
  • TUI. Same gaps: a Go limit now restores the prompt and shows a muted notice ("You've reached your OpenCode Go usage limit. It resets at …") instead of a red error and a failure toast.

Tests: core classification (real Console body + retry-after), Go-limit link parsing, timeline projection, TUI notice + toast suppression, and a Desktop e2e for both dialogs.


Added by the opencode bot (AI-generated).

Related: #56798

Public API: session.step.failed error.type: Go Console limit provider.quota → provider.go-limit; ChatGPT usage limit → provider.chatgpt-limit (structurally compatible; consumers matching the old types need updating)

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks sound. Core now gives the Console Go-limit 429 and ChatGPT's subscription_sharing_usage_limit_exceeded their own error types, and Desktop and the TUI match on the type instead of a copied message. The removed session.status account_rate_limit listener had nothing in v2 feeding it, so removing it loses nothing.

I couldn't verify it end to end: the simulated model can only stream, so it can't return a real 429 with a GoUsageLimitError body. The new core, session-ui and TUI tests pass, and typecheck is clean in core, app, tui and session-ui. The Desktop dialog unit test fails the same way on the base (a solid-js server-side environment error), so that isn't caused by this change. Could you add before/after screenshots of the TUI notice and the Desktop "Go limit reached" dialog?

Public API: the error.type on session.step.failed events (and stored assistant errors) changes in two cases:

  • Console GoUsageLimitError: provider.quota → provider.go-limit, and its message is now core's own text
  • ChatGPT subscription_sharing_usage_limit_exceeded: whatever type the failure got before (e.g. provider.invalid-request / provider.unknown) → provider.chatgpt-limit

The schema's type is a free string, so nothing breaks structurally. Clients or plugins that matched provider.quota for Go limits, or the old type for ChatGPT limits, would need to match the new values.

No blocking concerns.

Related: #56798

core now classifies the Console's GoUsageLimitError 429 as provider.go-limit (keeping retryAfterMs) and ChatGPT's subscription_sharing_usage_limit_exceeded as provider.chatgpt-limit. Desktop opens 'Go limit reached' with the reset time, leaves a muted timeline line and hands the prompt back; the ChatGPT dialog matches the typed error instead of a stale copied string. The TUI restores the prompt and shows a muted Go-limit notice instead of a red error and failure toast.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant