Skip to content

fix(openrouter): drop BYOK from saved rows, share one popup empty state, name every account - #1552

Merged
robinebers merged 2 commits into
mainfrom
capy/drop-byok-from-saved
Nov 3, 2026
Merged

robinebers merged 2 commits into
mainfrom
capy/drop-byok-from-saved

Conversation

@robinebers

@robinebers robinebers commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

TL;DR — OpenRouter rows no longer show BYOK on any path, every provider's popup gets the same empty state (" didn't report any data for this range."), and an account can no longer end up with no visible name.

What was happening

  • On fix(openrouter): show dollars in history rows and tokens and BYOK in a Cursor-style popup #1550's build, Robin's OpenRouter card still read $0 · $0 BYOK. A fresh read on fix(openrouter): show dollars in history rows and tokens and BYOK in a Cursor-style popup #1550 is already dollars-only (the new zero-value test passes its row checks on main). The BYOK came from the snapshot an earlier build saved under the same cache key: it shows at launch and stays until a refresh succeeds, on a cache hit within 5 minutes or for as long as refreshes fail.
  • Robin's card has Balance, so it is a Management key; with no Yesterday or Prior 30 Days, its activity read returned nothing.
  • The popup treated a $0-only range as having data ("a free request is possible"), so Today showed just $0. Cursor's popup had its own empty wording ("No Usage Today / Nothing charged and no tokens counted.").
  • API-key accounts (and the 0.7.x key import) were named exactly the provider's name, OpenRouter, and the card hides a name that only repeats the provider's, so the account showed no name. Rename already refused an empty field, but AccountStore itself accepted a blank or provider-only name.

What this changes

  • The snapshot cache key moves to openusage.providerSnapshots.v12, as earlier shape changes did, so a snapshot saved with BYOK in the rows is never shown. The first launch after the update reads every account before its cards fill. BYOK stays in the popup.
  • UsageBreakdown.isEmpty is now true whenever every reported figure is zero, and the shared UsageBreakdownContent empty state reads "(provider.displayName) didn't report any data for this range." for every provider. noUsageTitle is removed. A range with any non-zero figure still shows what exists; missing days still count as 0.
  • AccountStore names every account at the boundary: add, rename, and load turn a blank or provider-only name into <Provider> Account (the default Claude, ChatGPT, Cursor, Grok, and Devin sign-ins already use), and a repaired load is saved and logged. Logins and the 0.7.x import go through the same store, so they get the name too. Robin's existing account becomes OpenRouter Account on next launch.
  • Docs (dashboard, accounts, providers) and CHANGELOG updated.

Heads-up

  • Every popup whose range is all zeros now shows the empty state, including spend-only $0 ranges that used to show $0, and ChatGPT credit-only zero ranges.
  • Accounts named exactly after their provider (Claude, Ollama, …) are renamed to <Provider> Account on load, and the card now shows that name above the rows. fullName reads e.g. OpenRouter · OpenRouter Account, as Cursor's default already does.

Tests (Mac mini, macOS 15.7.7, nice -n 10 script/test_quiet.sh --filter, one suite at a time)

  • Red on main 1acc905 with only the test changes: OpenRouterProviderTests (new zero-value standard and Management key test: Today popup not empty; new saved-snapshot test: a v11 snapshot with BYOK was a cache hit and showed $0 · $0 BYOK), AccountStoreTests (blank/provider-only add, rename, and stored-name repair), UsageBreakdownDetailTests ($0-only is empty), APIKeyV1FilesTests (imported name).
  • Green with the fix: those five plus AccountRenameStore, AddAccountFlow, DuplicateLogin, CLIProxyHub, OpenRouterUsageHistory, UsageHistory, Cursor/Codex/OllamaUsageHistory, WidgetDataStore, AccountChange, ShareCardRenderer, DashboardSection, DashboardLiveLayout, SignInAgain, ProviderSnapshotCache, UsageReader, RetainedProviderUsage, LimitsEnvelope, ProviderLogin.
  • Renders: offscreen from an uncommitted scratch test, using Robin's card (stored name OpenRouter, a snapshot saved under the old key with $0 · $0 BYOK, Management key, activity unreadable, $0 everywhere).

Screenshots

Before (main) After
OpenRouter card
OpenRouter Today popup
Cursor Today popup (zero range)

Dark:

Open in Capy


Note

Medium Risk
On load it rewrites stored account labels and bumps the snapshot cache, changing visible names and forcing fresh provider reads; empty-popup behavior changes for zero-only ranges across providers.

Overview
OpenRouter dashboard rows no longer resurrect BYOK from older cached snapshots: the provider snapshot storage key moves to v12, so stale Today/This Week/This Month lines with inline BYOK are discarded and fresh reads repopulate the card. BYOK remains available only in the range popup on hover.

Usage range popups share one empty state: when every reported figure is zero, UsageBreakdown.isEmpty is true (including spend-only $0), and the UI shows “<Provider> didn't report any data for this range.” instead of per-window “No Usage …” titles or a lone $0 line.

Account labels are normalized in AccountStore on add, rename, and load: blank or provider-only names become \<Provider\> Account, existing stored accounts are repaired and persisted on launch, and imports/tests expect the new default names so dashboard cards always show a visible label.

Reviewed by Cursor Bugbot for commit cbbf39b. Bugbot is set up for automated code reviews on this repo. Configure here.

…te, name every account

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes Reviewed the complete diff and traced saved-row rendering, shared usage breakdowns, and account naming through their callers and regression tests.

  • Saved history rows: Descriptor-based filtering removes legacy BYOK figures from OpenRouter rows while preserving breakdown data and other providers' declared row values.
  • Empty breakdowns: All-zero reported totals use the shared provider-specific message; non-zero totals and unread-day handling remain intact.
  • Account names: Creation, rename, and stored-account repair provide visible default names, with API-key login and legacy import using the same convention.
  • Validation: All changed Swift files passed syntax parsing. Full build and UI tests could not run on this Linux runner; the PR's Build and Test check was pending when inspected.

Pullfrog  | View workflow run | Using gpt-6-astra | 𝕏

…counts in the store only

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes Reviewed the incremental changes from 8659041 to cbbf39b, including cache loading, refresh behavior, and account-creation callers.

  • Replaced saved-row filtering: Bumped the snapshot cache to v12, preventing legacy BYOK rows from loading and requiring fresh reads for all accounts.
  • Centralized account naming: Removed redundant login/import naming changes while retaining normalization at the AccountStore boundary.
  • Updated regression coverage: Changed the saved-snapshot test to verify that a v11 snapshot is bypassed and a fresh dollar-only row is displayed.
  • Validated syntax: All nine Swift files affected by the incremental commit passed syntax parsing. Full build and runtime tests require macOS and could not run on this Linux host; CI's Build and Test check was still running when inspected.

Pullfrog  | View workflow run | Using gpt-6-astra | 𝕏

@robinebers
robinebers merged commit 8b21637 into main Nov 3, 2026
6 of 7 checks passed
@robinebers
robinebers deleted the capy/drop-byok-from-saved branch November 3, 2026 06:25
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