Repository navigation
feat(web): show provider plan limits in the sidebar - #7
Merged
Merged
Conversation
Providers meter subscription plans on rolling windows — Claude's 5-hour and weekly windows, Codex's primary/secondary pair, plus spend and credit ceilings — and T3 Code never surfaced any of it. You found out you were out of headroom by getting rate limited mid-turn. Adapters now normalize their native payload into one provider-agnostic shape, a queue-backed reactor records each observation onto the provider snapshot clients already subscribe to, and the per-instance status cache carries the last observation across restarts. The sidebar footer gets a gauge next to Settings, Pull Requests and Usage: the ring fills to the most constrained live window across every provider and environment, and its popover breaks down each provider, plan, window, and time left. A window whose reset instant has passed renders as reset instead of repeating a spent number. Providers only report while they run, so the meter is explicit about having no data yet rather than implying zero usage. Model: claude-opus-5[1m] · Harness: T3 Code (Claude Code)
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.
Problema
Providers medem o plano em janelas rolantes — 5 horas e semanais no Claude, o par
primary/secondaryno Codex, mais tetos de gasto e crédito — e o T3 Code nunca mostrou nada disso. Você descobria que ficou sem margem sendo rate limited no meio de um turn.Como resolvi
packages/contracts/src/providerRateLimits.ts): uma forma agnóstica de provider —{ observedAt, planLabel?, notice?, windows[] }, cada janela comid,label,kind,usedPercent,resetsAt,status. Pendurada emServerProvider.rateLimitscomooptionalKey, então cliente antigo ignora e nenhuma subscription nova é necessária.rate_limit_eventdo Claude,account/rateLimits/updateddo Codex) e anexam ao evento — a complexidade fica na fronteira do adapter, o resto do sistema só vê janelas rotuladas.ProviderRateLimitsReactor(quarto worker drenável, ao lado dos três existentes) grava cada observação viaProviderRegistry.setProviderRateLimits, que mescla por id de janela — updates são esparsos, uma janela ausente não pode sumir da UI — e projeta emServerProvider.rateLimits. O cache de status por instância é o que carrega a última observação através de um restart.Uma janela cujo instante de reset já passou aparece como reset em vez de repetir um número gasto, e sai do cálculo do anel. Como provider só reporta enquanto roda, o estado vazio diz isso explicitamente em vez de insinuar uso zero.
Superfícies
sidebarRateLimits.logic.tsparaclient-runtimee desenhar a tela.docs/user/plan-limits.md(+ link no README), seção emdocs/internals/providers.md, dois verbetes no glossário.Verificação
ProviderRegistry(44), adapters (106),OrchestrationReactor,providerStatusCache.Model:
claude-opus-5[1m]· Harness: T3 Code (Claude Code)