Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): show the provider account badge on thread rows #9899

Mergedvitalyiegorov(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/9899/headmerged by juliusmarminge View on GitHub

What Changed

Mobile thread rows now show which provider account a thread runs on, the way the web sidebar has since #5980. When an instance has an accent color, or several instances share one provider, the provider glyph carries the account's accent badge with its initials. Rows for a single plain instance look exactly as before.

The badge rule and the instance label rule move from the web app into client-runtime, so web and mobile name and badge an instance identically. Web keeps its call sites. Mobile replaces the inline provider lookup in the Home list and the iPad sidebar with one resolver that returns the driver, label, accent, and badge flag, scoped to the thread's own environment because default instance ids collide across servers. The legacy v1 list never drew a provider glyph and is left alone.

Fixes #9898.

Why

With a work and a personal subscription on the same provider, the phone was the one client where you could not tell them apart. The row rendered a dimmed glyph, and an accent color set on the server never appeared on mobile. The data was already on the device; the row only received the driver and dropped the display name and accent on the way.

Review guide

Eleven files, one concern. Read in this order:

  • packages/client-runtime/src/state/providerInstanceDisplay.ts (new) — shouldShowInstanceBadge, normalizeProviderAccentColor, providerInstanceInitials, and the instance label rule, moved verbatim from apps/web/src/providerInstances.ts and ProviderInstanceIcon.tsx. Only two behavior changes: initials iterate by code point so an emoji name does not split, and the label fallback (humanize a non-default instance id when the server sent the brand label) is now shared instead of web-only. Exported as @t3tools/client-runtime/state/provider-instance-display.
  • apps/web/src/providerInstances.ts, apps/web/src/components/chat/ProviderInstanceIcon.tsx — import from the shared module and re-export the old names. No web call site changes.
  • apps/mobile/src/features/threads/thread-provider-instance.ts (new) — resolveThreadProviderInstance(serverConfigs, thread), the one lookup both lists use.
  • apps/mobile/src/components/ProviderIcon.tsx — ProviderInstanceIcon: the existing glyph at 60% opacity plus the corner badge, same geometry as web.
  • apps/mobile/src/features/threads/thread-list-v2-items.tsx, HomeScreen.tsx, ThreadNavigationSidebar.tsx — the row takes the resolved instance instead of a driver string; each screen swaps its inline .find(...) for the resolver.

Risk is low: client-only, no contract or persistence change. The only web-visible effect is that deriveProviderInstanceEntries now calls the shared label resolver, which is the same code it called before.

UI Changes

Same server, same threads, one Claude Code account with a green accent color.

BeforeAfter
Before: bare dimmed provider glyph on every rowAfter: provider glyph with the green VI account badge; the Codex row stays badge-free
Before, row icon at 4xAfter, row icon at 4x: accent badge with initials hangs off the glyph corner

No motion changes, so no video.

Verification

vp test run packages/client-runtime/src/state/providerInstanceDisplay.test.ts apps/mobile/src/features/threads/thread-provider-instance.test.ts apps/web/src/providerInstances.test.ts
  • 53 tests pass, including two environments sharing a default instance id resolving to different accents, a custom instance labelled by its id so its initials differ from the default's, and emoji-safe initials.
  • Client-runtime, mobile, and web typechecks pass. Changed-file lint and formatting pass, with pre-existing lint warnings in the sidebar file.
  • Integrated pass on an Android 14 emulator against a copy of real data (screenshots above).
  • Cursor Bugbot and Macroscope each raised one finding on the first revision (duplicate initials for two instances of one driver, and surrogate-splitting initials). Both are fixed in the current head with tests; Macroscope has approved.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes (not applicable, no motion)

Written by Claude Fable 5.1 in Claude Code.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added provider instance icons with display-name initials, accent colors, and optional badges.
    • Thread lists now show provider instance details more clearly.
    • Added a “New thread on branch” action to thread menus.
    • Improved provider instance display names, initials, accent colors, and badge visibility.
    • Updated working-status colors for better adaptive visibility.
  • Bug Fixes

    • Improved provider resolution for threads across multiple environments.
    • Improved swipe-state handling when thread status or snooze details change.
  • Tests

    • Added coverage for provider instance resolution and display behavior.

Note

Show provider account badge on mobile thread rows

  • Adds ProviderInstanceIcon to mobile, which dims the provider glyph and overlays an account badge with initials and accent color
  • Adds resolveThreadProviderInstance to resolve environment-scoped provider metadata (display name, accent color, badge visibility) for each thread row; HomeScreen and ThreadNavigationSidebar now pass this metadata to rows
  • Moves provider display-name resolution, slug humanization, accent-color normalization, initials generation, and badge-visibility logic into shared client-runtime utilities; web now re-exports these instead of keeping local copies
  • Risk: ThreadListV2Row input changed from a driver string to ThreadRowProviderInstance metadata — any caller not updated via HomeScreen or ThreadNavigationSidebar will fail to compile
Macroscope summarized 1533e05.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 9673c6ccc7893b98c944d634bfc536f295145a4c. Configure [here](https://www.cursor.com/dashboard/bugbot).
    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at 31e9fd1

      Macroscope's review found this PR approvable — This is a focused client-side UI enhancement that adds account badges to mobile thread rows while preserving existing provider routing and single-instance presentation; its shared display logic is small, tested, and has no schema, deployment, security, billing, or static-analysis impact. The supplied medium findings concern account-label disambiguation and Unicode initials, and the head includes the corresponding shared fallbacks and tests.

      Notes:

      • This verdict was updated automatically after the outstanding correctness findings were resolved. Macroscope did not re-review the code.

      No code changes detected at 514d950. Prior analysis still applies.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Review Change Stack

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: Path: .coderabbit.yaml

      Review profile: CHILL

      Plan: Team

      Run ID: 66f165da-8e4b-465f-b27a-7554c693db48

      📥 Commits

      Reviewing files that changed from the base of the PR and between ddbca067ad97a6befdc88f6162f28b89e52d6cf4 and 514d950b5557774defd22437a4f29195ee8bcebb.

      📒 Files selected for processing (1)
      • apps/mobile/src/features/threads/thread-list-v2-items.tsx

      Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


      📝 Walkthrough

      Walkthrough

      The change centralizes provider-instance display logic, resolves provider instances for mobile threads, and renders account badges in mobile home and sidebar thread rows. It also adds branch-thread actions and swipeable lifecycle updates.

      Changes

      Provider instance badges

      Layer / File(s)Summary
      Shared provider display logic
      packages/client-runtime/src/state/providerInstanceDisplay.ts, packages/client-runtime/src/state/providerInstanceDisplay.test.ts, packages/client-runtime/package.json, apps/web/src/providerInstances.ts, apps/web/src/components/chat/ProviderInstanceIcon.tsx
      Shared utilities resolve display names, initials, accent colors, and badge visibility. Web code imports and re-exports the shared implementations.
      Mobile provider instance resolution
      apps/mobile/src/features/threads/thread-provider-instance.ts, apps/mobile/src/features/threads/thread-provider-instance.test.ts
      Threads resolve provider instances within their environment and derive display metadata for the row.
      Mobile thread row rendering and actions
      apps/mobile/src/components/ProviderIcon.tsx, apps/mobile/src/features/threads/thread-list-v2-items.tsx, apps/mobile/src/features/home/HomeScreen.tsx, apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
      Home and sidebar lists pass resolved provider instances to rows. Rows render provider icons with optional initials badges and pane-aware surface colors. v2 rows add a “New thread on branch” menu action and update swipeable reset behavior.

      Estimated code review effort: 3 (Moderate) | ~25 minutes

      Merge Risk: ⚪ Minimal · up to 1533e

      Mobile thread rows now display provider account badges and configured accents, improving account identification without an identified current-head merge risk.

      Suggested reviewers: juliusmarminge, t3dotgg

      🚥 Pre-merge checks | ✅ 3 | ❌ 2

      ❌ Failed checks (2 warnings)

      Check nameStatusExplanationResolution
      Out of Scope Changes check⚠️ WarningThe pull request includes changes not required by issue #9898, including the new "New thread on branch" long-press action and unrelated swipe behavior changes involving dismiss handling, thread keys, …Remove the unrelated branch-action and swipe-behavior changes, or split them into a separate pull request with appropriate linked issues and scope.
      Docstring Coverage⚠️ WarningDocstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 10 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (3 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly identifies the main change: showing provider account badges on mobile thread rows.
      Description check✅ PassedThe description includes all required sections, explains the change and rationale, documents UI changes with before-and-after screenshots, and completes the checklist.
      Linked Issues check✅ PassedThe implementation satisfies issue #9898 by resolving provider metadata per environment, displaying account badges in the mobile Home list and iPad sidebar, preserving plain single-instance behavior, …
      Full details: Out of Scope Changes check

      Explanation

      The pull request includes changes not required by issue #9898, including the new "New thread on branch" long-press action and unrelated swipe behavior changes involving dismiss handling, thread keys, and reset keys.

      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      Comment `@coderabbitai help` to get the list of available commands.
    5. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      All clear

      Posted via Macroscope — Effect Service Conventions
    6. juliusmarminge merged this2c8e95a

    7. juliusmarminge closed this

Sign in to join this conversation.