Fix sidebar Sign In button and account avatar not rendering on Intel Macs

Merged
AU
2mo ago
+550-36

Summary

On Intel Macs running macOS 15, SwiftUI draws nothing for raster images (Image(nsImage:), Image(decorative:) from a CGImage, and AsyncImage results), while SwiftUI's own vector symbols and AppKit image views hosted in SwiftUI paint normally. Sidebar footer controls (Sign In, Help, the profile picture, sidebar top-bar icons) all went through CmuxSystemSymbolImage, whose primary branch handed a rasterized template NSImage to SwiftUI, so they disappeared. The signed-in avatar disappeared for the same reason inside AsyncImage.

  • CmuxSystemSymbolImage now always draws through the AppKit-hosted CmuxResolvedIconImage, masking a .foreground fill so callers keep their .foregroundStyle tinting. The materialized bitmap only supplies the configured symbol's natural layout size.
  • CmuxResolvedIconRequest gains an explicit symbolPointSize; the shared renderer draws such symbols at their natural size inside the slot, matching NSImage.SymbolConfiguration(pointSize:weight:) geometry on every platform.
  • StackAccountAvatarView replaces AsyncImage with StackAccountAvatarImageLoader, which fetches through the shared URL cache, center-crops the picture to a square bitmap, and draws it through the hosted renderer. Initial/person fallbacks are unchanged.

Two-commit regression-first history:

  1. 26be5ec1ba — failing tests only (CmuxResolvedIconSymbolPointSizeTests, CmuxHostedSystemSymbolImageTests, StackAccountAvatarImageLoaderTests + pbxproj wiring)
  2. 064b36fb3a — production fix

No user-facing strings, shortcuts, settings, or localization catalogs changed.

Testing

  • Ran swift test --filter CmuxResolvedIconSymbolPointSizeTests from Packages/macOS/CmuxAppKitSupportUI on this Intel Mac (macOS 15, x86_64). All 3 tests passed.
  • CmuxHostedSystemSymbolImageTests and StackAccountAvatarImageLoaderTests are wired into cmux-unit but were not executed locally: this machine has Command Line Tools only (xcode-select → /Library/Developer/CommandLineTools), no Xcode.app, and no zig, so ./scripts/reload.sh --tag intel-sidebar-icons cannot run here. CI tests job is the gate for those suites.
  • Left the uncommitted DEBUG SymbolProbeVariantsView out of the PR.

Demo Video

  • Video URL or attachment: not attached. Remaining dogfood check is a visual confirm on this Intel Mac that the sidebar Sign In / Help glyphs and the signed-in account avatar paint after a tagged build from a machine with Xcode.

Review Trigger (Copy/Paste as PR comment)

@codex review
@coderabbitai review
@greptile-apps review
@cubic-dev-ai review

Checklist

  • I tested the change locally
  • I added or updated tests for behavior changes
  • I updated docs/changelog if needed
  • I requested bot reviews after my latest commit (copy/paste block above or equivalent)
  • All code review bot comments are resolved
  • All human review comments are resolved

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


[!NOTE]
Medium Risk
Touches shared sidebar/auth rendering (CmuxSystemSymbolImage, icon renderer) used broadly; behavior change is intentional for one platform bug but affects all Macs’ symbol draw path.

Overview
Fixes blank sidebar controls and account avatars on Intel Macs running macOS 15, where SwiftUI raster images (Image(nsImage:), AsyncImage) paint nothing while AppKit-hosted image views still work.

CmuxSystemSymbolImage no longer displays a materialized NSImage through SwiftUI. It always routes drawing through CmuxHostedSystemSymbolImage, which masks a .foreground rectangle with CmuxResolvedIconImage so callers keep .foregroundStyle tinting. The shared icon pipeline gains optional symbolPointSize on CmuxResolvedIconRequest; when set, SF Symbols render at AppKit’s natural configured geometry inside the layout slot instead of scaling to fill the frame.

StackAccountAvatarView drops AsyncImage for StackAccountAvatarImageLoader (URL fetch, center-crop to a square bitmap) and displays the result via CmuxResolvedIconImage. Initial/person fallbacks are unchanged.

Regression tests cover symbol point size, hosted symbol geometry, and avatar cropping.

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

Summary by CodeRabbit

  • New Features

    • Added cached asynchronous loading for account avatar images, including square cropping and requested-size rendering.
    • Added hosted SF Symbol rendering with configurable point size, weight, image size, slot size, alignment, and tinting.
    • Updated system symbol display to use consistent hosted rendering across supported states.
    • SF Symbols can now preserve their natural size when appropriate.
  • Bug Fixes

    • Symbol images now re-render correctly when their configured point size changes.
    • Avatar updates prevent stale or cancelled image loads from replacing current content.