Repository navigation
fix(github): render GitHub Enterprise PR avatars via API avatar_url - #9107
Conversation
Fixes #8784. GitHub Enterprise user logins don't exist on github.com, so the `https://github.com/{login}.png` URL that PR author/reviewer/assignee avatars were built from returned 404 and rendered blank. - Carry the API-provided `avatar_url` through the work-item mappers (`authorAvatarUrl`) and stamp author/reviewer/assignee avatars onto the PR detail item using the same GraphQL `user(login:)` batch that already resolves comment avatars — no extra round-trip (the mention-author batch now also covers the item's reviewers/assignees). - Route all PR author/reviewer/assignee avatars through a shared `GitHubUserAvatar` component that prefers the API avatar_url, falls back to the login URL (github.com behavior unchanged), and degrades to an initials placeholder on load error. - Fix the placeholder latch: the component now tracks the failed src rather than a boolean, so a row that 404s on the early login-based URL recovers once the enriched avatar_url arrives after first paint. This was why author/requested-reviewer avatars stayed blank while late-mounted assignee/approved-reviewer avatars rendered. No host-specific logic; github.com is unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…names Address CodeRabbit review on #8831: - Pull avatarUrl/name in the GraphQL assignees connection so a non-participating assignee (common on GitHub Enterprise) no longer renders a blank avatar. - Build initials by code point and skip symbol-only words so a display name that leads with an emoji yields clean letters, not a broken surrogate half. - Convert avatar-helper why-comments to TSDoc for docstring coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Export resolveGitHubUserAvatarSrc so empty/whitespace avatarUrl and empty login never build a bogus github.com/.png request. Convert the #8784 repro into a source-guard regression and cover empty-src initials. Based on #8831 by @davkim1030 (avatar_url enrichment + GitHubUserAvatar).
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…tablyai#9107) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: davkim1030 <davkim1030@gmail.com>
Description
Fixes #8784.
On GitHub Enterprise, PR author / reviewer / assignee avatars rendered blank. Orca built the avatar URL from the login (
https://github.com/{login}.png), which 404s for Enterprise users because their login doesn't exist on github.com. The API already returns a fully-formedavatar_url, so the fix is to use it.Takes over / supersedes #8831 by @davkim1030 — core approach and commits credited to them; rebased onto current
mainwith small hardenings and the #8784 regression kit.What changed:
avatar_urlthrough the work-item mappers (authorAvatarUrlonGitHubWorkItem) and stamp author/reviewer/assignee avatars onto the PR detail item using the same GraphQLuser(login:)batch that already resolves comment avatars. No extra round-trip — the mention-author batch now also covers the item's reviewers/assignees, and the resolved avatars are reused to enrich the item.GitHubUserAvatarcomponent for all PR author/reviewer/assignee avatars: prefers the APIavatar_url, falls back to the login URL (so github.com behavior is unchanged), and degrades to an initials placeholder on image load error.avatar_urlarrives after first paint.resolveGitHubUserAvatarSrctreats whitespace-onlyavatarUrlas empty and skips empty login so we never requestgithub.com/.png; [Bug]: GitHub Enterprise — PR author avatars fail to load (built from login instead of avatar_url) #8784 repro converted to a regression source-guard.No host-specific logic is introduced; github.com is unaffected.
Evidence
github-user-avatar.test.tsx— prefers API avatar_url, login fallback, initials on error, non-BMP initials, retries whenavatarUrlchanges after an earlier src failed, empty-src initials.repro-8784-ghe-avatar-fallback.test.ts— regression guards that author/reviewer paths useGitHubUserAvatar+authorAvatarUrl(no hardcoded login.png in TaskPage / author chip).work-item-details.test.ts— GraphQL enrichment stamps author/reviewer/assignee avatars (including overridingu/0placeholders and non-participating issue assignees).Manual GHE verification was done in #8831 (author, requested reviewers, approved reviewers, assignees).
ELI5
Enterprise users don't have profiles on public github.com, so building avatars as
github.com/username.pngshows a broken image. The Enterprise API already gives a real avatar link; we now use that link, and if the picture still fails we show initials instead of a blank hole. When the real link arrives a moment later, the picture appears.User-regression-tradeoffs
gh pr listoften omits avatars<img src>Tradeoff accepted: without host detection we still briefly try login.png on GHE when enrichment hasn't arrived; failed-src tracking + initials avoids a permanent broken image, and enrichment replaces the src after first paint.
Credit: approach and primary implementation from #8831 (@davkim1030).