Skip to content

feat: add provider allowance indicators - #1116

Draft
ferrislucas wants to merge 34 commits into
mainfrom
circus-chief/bc77-how-support-feature-shows
Draft

feat: add provider allowance indicators#1116
ferrislucas wants to merge 34 commits into
mainfrom
circus-chief/bc77-how-support-feature-shows

Conversation

@ferrislucas

Copy link
Copy Markdown
Owner

Summary

Adds provider allowance (usage/quota) indicators so users can see at a glance how much of each provider's allowance remains.

  • Server: New ProviderAllowanceService that maintains per-provider snapshots. Providers without a verified allowance source are represented as unknown rather than inferred from call logs or credentials. Emits a PROVIDER_ALLOWANCE_UPDATED WebSocket message only when a snapshot actually changes.
  • Shared contracts: Zod schemas for ProviderAllowanceSnapshot, ProviderAllowance, status/unit/source enums, and the WS update payload. Snapshots are .strict() and carry only normalized, display-safe values (raw provider headers and account metadata stay server-side).
  • API: GET /api/providers/allowances (registered before /:id so it's never parsed as a provider id).
  • Web: New ProviderAllowanceIndicators component in the app shell — compact desktop pills showing the lowest remaining percentage per provider, an overflow button, and a mobile button with an attention badge. Opens an accessible modal (focus trap via focus management, Esc to close, focus restore) listing full allowance details, reset times, and staleness warnings. Backed by a new providerAllowances Pinia store that fetches on mount, applies WS updates, and refetches on reconnect.

Test plan

  • Unit tests added for ProviderAllowanceService, shared contracts, and the ProvidersApi resource
  • Updated SessionCard, SessionLogStream, sessionStreaming, and SessionListView tests affected by the log-stream changes
  • yarn test green across workspaces
  • E2E suite passes via ./scripts/pw.sh test

🤖 Generated with Claude Code

ferrislucas and others added 30 commits September 4, 2026 07:16
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
…on W1, findings #1 #13)

Co-authored-by: Codex <noreply@openai.com>
…2, finding #2)

Co-authored-by: Codex <noreply@openai.com>
…, findings #3 #8)

Co-authored-by: Codex <noreply@openai.com>
…ediation W4, finding #4)

Co-authored-by: Codex <noreply@openai.com>
…indings #6 #9 #11)

Co-authored-by: Codex <noreply@openai.com>
…finding #7)

Co-authored-by: Codex <noreply@openai.com>
…ndings #12 #11)

Co-authored-by: Codex <noreply@openai.com>
…W9, finding #10)

Co-authored-by: Codex <noreply@openai.com>
Add provider-allowance-indicators E2E spec with stable data-testids on
the allowance items and overflow button, constrain the indicator widths
on desktop and reset them on mobile so layout stays predictable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: z.ai <noreply@z.ai>
…into circus-chief/bc77-how-support-feature-shows
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
…into circus-chief/bc77-how-support-feature-shows
The provider allowance indicators shipped gated behind an opt-in
provider_allowance_indicators_v1 app_settings flag with no UI to enable
it, leaving the feature unreachable in normal environments. Ship the
feature unconditionally instead:

- Delete providerAllowanceFeatureFlag.js and the isEnabled gate from
  ProviderAllowanceService (getSnapshots/observe are now always-on)
- GET /api/providers/allowances always returns snapshots; the VCR-only
  test-observe harness no longer writes the flag row
- Update API and service tests that asserted flag-gated behavior

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: z.ai <noreply@z.ai>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
ferrislucas and others added 4 commits September 6, 2026 22:28
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
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