Skip to content

fix(mobile): usage widget never gives two accounts the same name - #43683

Merged
juliusmarminge merged 3 commits into
pingdotgg:mainfrom
only21mil:fix/mobile-usage-account-label-collision
Nov 26, 2026
Merged

juliusmarminge merged 3 commits into
pingdotgg:mainfrom
only21mil:fix/mobile-usage-account-label-collision

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

When a pooled usage limit has accounts named codex, codex2, codex, the Android usage widget labels two of them codex2 instead of codex3. widgetAccounts (apps/mobile/src/widgets/subscriptionUsageSnapshot.ts) appended a count to duplicate names without checking that another account already had that name.

CLI Proxy accounts without an email are named after their auth file, so codex.json + codex2.json on one hub and codex.json on another hit this. SubscriptionUsage.android.tsx uses the name as label and React key.

Change

All names are reserved first; the first account with a name keeps it, and a later duplicate takes the next free ${base}${n}. No account is given another account's name: codex, codex, codex2 becomes codex, codex3, codex2.

Scope

Small fix for an obvious bug; no issue needed. iOS has no per-account segments; web and client-runtime have no copy of this code. Gap keys (gap-${name}) can still meet a segment key for an account literally named gap-<name>; that is on main already and left out.

Verification

An AI agent ran each check below.

Setup: Android 16 emulator (Pixel 10), light theme, landscape home screen (wide enough for names); isolated dev server, no seeded data, two CLI Proxy sources on a local stub (codex.json + codex2.json, and codex.json); one dev client running each commit's JavaScript.

Steps: relaunch T3 Code Dev → open Usage → Home → rotate to landscape → read the Subscription usage widget.

8c6a4a57 (before) a3f9686e (after)
Two different accounts are both labelled codex2 (50% and 30%)
Two different accounts are both labelled codex2 (50% and 30%)
Every account has its own label: codex, codex2, codex3
Every account has its own label: codex, codex2, codex3
Regression test, checks and builder output
  • Two new it.each cases in subscriptionUsageSnapshot.test.ts (["AB","AB2","AB"] and ["AB","AB","AB2"]). On base both fail: expected [ 'AB', 'AB2', 'AB2' ] to strictly equal [ 'AB', 'AB2', 'AB3' ] and … [ 'AB', 'AB3', 'AB2' ]. On head the file passes 12/12 in 3 of 3 runs.
  • vp run check:changed: exit 0 (format, lint, knip, typecheck, test, React Compiler), no warnings.
  • buildSubscriptionUsageSnapshot on the same two hubs, both reset orders:
base 8c6a4a57
  order 1: codex: 70% | codex2: 50% | codex2: 30%   (2/3 unique)
  order 2: codex: 70% | codex2: 30% | codex2: 50%   (2/3 unique)
head a3f9686e
  order 1: codex: 70% | codex2: 50% | codex3: 30%   (3/3 unique)
  order 2: codex: 70% | codex3: 30% | codex2: 50%   (3/3 unique)

Links: commits above, regression test, stub, steps, builder harness, base and head observations. No recordings: nothing moves.

Not shown:

  • Portrait phone widget: three segments are narrower than the 76 dp needed to draw names. The duplicate key is there either way.
  • iOS: its widget has no per-account segments.

Generated with Claude Opus 5.5 in T3 Code Nightly

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Widget account names now avoid collisions with other accounts’ base names and previously assigned suffixes. The first occurrence keeps its base name. Tests cover repeated names and names that resemble generated suffixes.

Changes: Widget account names

Layer / File(s) Summary
Resolve widget account name collisions
apps/mobile/src/widgets/subscriptionUsageSnapshot.ts, apps/mobile/src/widgets/subscriptionUsageSnapshot.test.ts
widgetAccounts reserves base names and assigns duplicate names the next available numeric suffix. Tests cover two collision patterns.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: koushikxd

Merge Risk: Minimal · up to 8f056

This fixes duplicate account labels in the Android usage widget so each account gets a distinct name. The change is small and covered by tests, and no merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: the Android usage widget no longer gives two accounts the same name. The raw summary, the objectives, and the PR description all describe a fix that reserves names so…
Description check Passed The description follows the repository template closely. It has Problem, Change, Scope, and Verification sections, and each section gives concrete content. The Problem section explains the bug and rep…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title states the main change: the Android usage widget no longer gives two accounts the same name. The raw summary, the objectives, and the PR description all describe a fix that reserves names so duplicates get the next free numeric suffix. The title uses the conventional commit format and is specific enough for a teammate scanning history. It is 64 characters, which is slightly long but acceptable.

Full details: Description check

Explanation

The description follows the repository template closely. It has Problem, Change, Scope, and Verification sections, and each section gives concrete content. The Problem section explains the bug and reproduction setup. The Change section explains the reservation-first naming approach. The Scope section explains why no issue is linked and why the change is small. The Verification section gives focused regression tests, check results, before and after emulator screenshots, and builder output. It also states what was not checked: the portrait phone layout and iOS. The description has minor gaps. The Scope section does not link an issue or a maintainer request, but it gives a reason for omitting one, which the template allows. The template's closing note about naming the model and harness is present ('Generated with Claude Opus 5.5 in T3 Code Nightly'). Overall the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a3f9686 and 8f056a0.

Files selected for processing: 1

  • apps/mobile/src/widgets/subscriptionUsageSnapshot.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 26, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

On a Pixel 9 emulator (Android API 36), configured two synthetic CLI Proxy hubs with pooled names codex, codex2, codex, opened Usage > Limits to refresh the snapshot, then viewed the 4x3 Subscription usage widget in landscape. Both sides use fresh server databases, light theme, and a 2424×1080 viewport. Base repeats codex2; head preserves the original names and assigns codex3 to the third account in both rows.

Before After
Before: duplicate codex2 labels After: unique codex3 labels
d6061ec8ad 8f056a0bfa

Synthetic hub driver · RPC seed script

Both final screenshots were visually inspected and pixel-identical to follow-up captures.

Not shown:

  • iOS widget rendering was not exercised; this proof covers the reported Android reproduction.
  • React keys were not directly inspected at runtime; the captures establish visible account-label uniqueness.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 26, 2026
@juliusmarminge
juliusmarminge merged commit 83d7e53 into pingdotgg:main Nov 26, 2026
55 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants