[Bug] Agent avatar upload skips the crop/downscale that community icons already get

Open Beginner friendly
#3,662 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
typescript
Domain
desktop

Research direction

Read desktop/src/features/profile/useAvatarUpload.ts and desktop/src/features/communities/lib/downscaleIcon.ts first, then compare the processImage usage in CommunityIconSettingsCard.tsx with AgentDefinitionDialog.tsx and AgentInstanceEditDialog.tsx. Done means agent avatar uploads use the same centered square crop and 128px downscale behavior as community icons.

Written by the indexing model from the issue text.

Description

Summary

When creating (or editing) an agent in Buzz Desktop, uploading a custom avatar image does not resize, downscale, or center-crop it. The raw uploaded file is sent as-is, so a large or non-square photo doesn't get shaped into a proper small square avatar the way it should.

Root cause (traced in code)

useAvatarUpload (desktop/src/features/profile/useAvatarUpload.ts:18,64-65) accepts an optional processImage(file): Promise<string> hook. When provided, it runs the file through that hook before upload; when omitted, it uploads the raw bytes untouched via uploadMediaBytes.

  • Community icons already solve this. CommunityIconSettingsCard.tsx:114 passes processImage={downscaleIconToDataUrl} (desktop/src/features/communities/lib/downscaleIcon.ts:11-37), which center-crops to a square and downscales to 128px before encoding to WebP/PNG.
  • Agent avatars do not. AgentDefinitionDialog.tsx:770 and AgentInstanceEditDialog.tsx:882 both render <AgentCreationPreview ... /> (which threads processImage down to useAvatarUpload) but neither passes a processImage prop — so agent avatar uploads skip cropping/downscaling entirely.

Expected

Agent avatar upload should reuse the same center-crop + downscale treatment community icons already get, so users can drop in any photo and have it become a properly framed square avatar without needing to pre-edit the image themselves.

Suggested fix

Generalize downscaleIconToDataUrl (it's not community-specific — just takes a File and returns a data URL) into a shared location, and pass it as processImage in AgentDefinitionDialog.tsx and AgentInstanceEditDialog.tsx, same pattern as CommunityIconSettingsCard.tsx.

Duplicate search

Searched open/closed issues for avatar resize, avatar crop, agent avatar, agent icon, resize image, downscale, square image, etc. — no existing issue describes this. Closest are #2366 (icon lost across communities — different bug) and #3089 (proposal for AI-generated avatars — unrelated to manual upload sizing).

Dominant language
Rust
Stars
33.7k
Forks
4.4k
Avg merge
1d 21h
Merged PRs (30d)
239

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from block/buzz

All issues in block/buzz

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.