Skip to content

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

Open
vitalyiegorov wants to merge 1 commit into
pingdotgg:mainfrom
vitalyiegorov:fix/mobile-provider-badge
Open

fix(mobile): show the provider account badge on thread rows#9899
vitalyiegorov wants to merge 1 commit into
pingdotgg:mainfrom
vitalyiegorov:fix/mobile-provider-badge

Conversation

@vitalyiegorov

@vitalyiegorov vitalyiegorov commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

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.tsxProviderInstanceIcon: 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.

Before After
Before: bare dimmed provider glyph on every row After: provider glyph with the green VI account badge; the Codex row stays badge-free
Before, row icon at 4x After, 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 514d950.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 5, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Reviewed by Cursor Bugbot for commit 9673c6c. Configure here.

Comment thread apps/mobile/src/features/threads/thread-provider-instance.ts Outdated
Comment thread apps/mobile/src/features/threads/thread-provider-instance.ts Outdated
Comment thread packages/client-runtime/src/state/providerInstanceBadge.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

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.

@vitalyiegorov
vitalyiegorov force-pushed the fix/mobile-provider-badge branch from 9673c6c to 31e9fd1 Compare September 5, 2026 04:27
@vitalyiegorov
vitalyiegorov force-pushed the fix/mobile-provider-badge branch 5 times, most recently from 0685e1f to d3fcee6 Compare September 7, 2026 05:16

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All clear

Posted via Macroscope — Effect Service Conventions

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

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 ddbca06 and 514d950.

📒 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 514d9

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 name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning 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, … 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 ⚠️ Warning Docstring 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 name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: showing provider account badges on mobile thread rows.
Description check ✅ Passed The 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 ✅ Passed The 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.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@vitalyiegorov
vitalyiegorov force-pushed the fix/mobile-provider-badge branch from d3fcee6 to 0753eb9 Compare September 7, 2026 08:19

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All clear

Posted via Macroscope — Effect Service Conventions

@macroscopeapp

macroscopeapp Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

All clear

Posted via Macroscope — Effect Service Conventions

Thread rows drew a bare provider glyph, so two accounts on the same
provider looked identical. Rows now carry the same accent-color initials
badge the web sidebar shows, driven by the badge rule shared through
client-runtime so the two clients cannot drift.

Built with Claude Fable 5.1 in Claude Code.
@vitalyiegorov
vitalyiegorov force-pushed the fix/mobile-provider-badge branch from ddbca06 to 514d950 Compare September 7, 2026 17:28
@macroscopeapp

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Mobile thread rows hide the provider account badge the web sidebar shows

1 participant