Skip to content

[Due for payment 2026-06-18] [$75] Remove Agent Icons from User Avatar Selection #91980

Closed

Description

@grgia
Image
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. self-assigned this
    on May 28, 2026
  2. David-2002065 commented on May 28, 2026

    @David-2002065
    Contributor

    Proposal

    What is the root cause of that problem?

    The user avatar grid in Settings → Profile → Profile picture is driven by AvatarSelector, which iterates PRESET_AVATAR_CATALOG_ORDERED:

    https://github.com/Expensify/App/blob/main/src/components/AvatarSelector.tsx#L7

    https://github.com/Expensify/App/blob/main/src/components/AvatarSelector.tsx#L50-L71

    That ordered list is built from PRESET_AVATAR_CATALOG, which spreads DEFAULTS, SEASON_F1, and BOT_AVATARS together — the bot/Agent icons (bot-avatar--blue/green/ice/pink/tangerine/yellow) are bundled into the same catalog that powers the user picker:

    https://github.com/Expensify/App/blob/main/src/libs/Avatars/PresetAvatarCatalog.ts#L93-L100

    https://github.com/Expensify/App/blob/main/src/libs/Avatars/PresetAvatarCatalog.ts#L192-L208

    The Agent avatar picker, on the other hand, does not consume PRESET_AVATAR_CATALOG_ORDERED — it renders botAvatars directly from DefaultBotAvatars:

    https://github.com/Expensify/App/blob/main/src/pages/settings/Agents/Fields/EditAgentAvatarPage.tsx#L195-L221

    So bot avatars are visually leaking into the user picker through the shared ordered catalog, even though they're only ever meant to be selectable from the agent picker.

    What changes do you think we should make in order to solve the problem?

    I'd exclude BOT_AVATARS entries from PRESET_AVATAR_CATALOG_ORDERED (the grid source) while keeping them in PRESET_AVATAR_CATALOG itself — the catalog is still used by UserAvatarUtils.getAvatarLocal/URL and Agent.resolveAvatarURI to render existing bot-avatar selections, so we can't remove the entries entirely without breaking already-saved agent avatars.

    In src/libs/Avatars/PresetAvatarCatalog.ts, narrow the source of IDs that feed the ordered list to exclude bot avatar IDs:

     const buildOrderedAvatars = (): Array<{id: PresetAvatarID} & AvatarEntry> => {
    -    const allIDS = Object.keys(PRESET_AVATAR_CATALOG) as PresetAvatarID[];
    +    // BOT_AVATARS power the Agent avatar picker (EditAgentAvatarPage) directly via `botAvatars`;
    +    // they must not appear in the user avatar selector grid.
    +    const allIDS = Object.keys(PRESET_AVATAR_CATALOG).filter((id) => !(id in BOT_AVATARS)) as PresetAvatarID[];
         const explicit = DISPLAY_ORDER.filter((id) => id in PRESET_AVATAR_CATALOG);
         const explicitSet = new Set<PresetAvatarID>(explicit);
         const leftovers = allIDS.filter((id) => !explicitSet.has(id)).sort();
         const finalIDOrder = [...explicit, ...leftovers];
         return finalIDOrder.map((id) => ({
             id,
             ...PRESET_AVATAR_CATALOG[id],
         }));
     };

    DISPLAY_ORDER already doesn't include any bot-avatar--* entry, so this single filter is enough — bot IDs were only reaching the grid through the leftovers fallback. PRESET_AVATAR_CATALOG, getAvatarLocal, getAvatarURL, resolveAvatarURI, and isPresetAvatarID are all untouched, so existing agent avatars and saved bot-avatar references keep resolving correctly.

    The screenshot also implicitly verifies the "Edit profile picture" header — that's AvatarPage, which is the only consumer of AvatarSelector (grep confirms no other usage), so this change is fully scoped to the user picker.

    What alternative solutions did you explore? (Optional)

    1. Remove ...BOT_AVATARS from PRESET_AVATAR_CATALOG. Simplest one-line change, but it breaks UserAvatarUtils.getAvatarLocal/URL (src/libs/UserAvatarUtils.ts#L147, #L242) and Agent.resolveAvatarURI (src/libs/actions/Agent.ts#L27) for any user or agent that already has a bot avatar saved — those lookups would silently fall through to fallback rendering. Rejected.
    2. Add an excludeIDs / kind prop to AvatarSelector. Pushes filtering to the call site so each consumer scopes its own list. More flexible, but EditAgentAvatarPage doesn't even use AvatarSelector, so there's only one caller — the extra API surface buys nothing today. Rejected as YAGNI; can be revisited if a third selector emerges.
    3. Filter inside AvatarSelector itself. Works, but bakes Agent-feature knowledge into a generic UI component. Keeping the filter in the catalog file co-locates it with the BOT_AVATARS definition, which is the more honest place.
  3. grgia commented on Jun 1, 2026

    @grgia
    ContributorAuthor

    In review

  4. grgia commented on Jun 4, 2026

    @grgia
    ContributorAuthor

    In Review

  5. grgia commented on Jun 11, 2026

    @grgia
    ContributorAuthor

    Merged

  6. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 11, 2026
  7. grgia commented on Jun 11, 2026

    @grgia
    ContributorAuthor

    Adding Bug label for payment to @brunovjk

  8. MelvinBot commented on Jun 11, 2026

    @MelvinBot
    Contributor

    Issue Analysis

    ℹ️ Already resolved. This was fixed and merged via Expensify/App#92002 ("[Avatars] Split out Agent Avatars from User Avatars", merged 2026-06-10). The analysis below is for the record and confirms the root cause and the fix that shipped.

    Root cause: The user avatar picker (Settings → Profile → Profile picture) and the Agent avatar picker both drew from a single shared catalog. AvatarSelector iterated the full preset catalog, which spread the bot/Agent icons (bot-avatar--blue/green/ice/pink/tangerine/yellow) into the same ordered list as the user defaults. Bot IDs weren't in the explicit display order, so they leaked into the grid via the alphabetical "leftovers" fallback — hence Agent icons showed up in the user picker.

    Fix that shipped: Rather than filtering bot IDs out of one shared catalog (the approach in the accepted proposal), PR #92002 split the monolithic catalog into two independent ones:

    AvatarSelector.tsx:7 now imports USER_AVATARS and iterates USER_AVATARS.ordered at line 50, so it is structurally impossible for an Agent icon to appear in the user grid.

    Why the split was preferred over the proposed filter

    The accepted proposal suggested keeping one PRESET_AVATAR_CATALOG and excluding BOT_AVATARS only from the ordered list that feeds the grid, to avoid breaking existing saved bot-avatar lookups. That works, but it leaves Agent-feature knowledge embedded in the shared catalog and relies on a filter that future edits could regress. The shipped solution removes the coupling entirely — user and agent avatars live in separate catalogs with separate ID types, so the two pickers can never share entries again. Existing saved bot-avatar references resolve through the dedicated AGENT_AVATARS catalog and AgentAvatarCatalog.types, so nothing breaks.

    No further action needed — closing-the-loop note only.

  9. 2 remaining items

  10. melvin-bot commented on Jun 11, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  11. melvin-bot commented on Jun 11, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.5-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-06-18. 🎊

    For reference, here are some details about the assignees on this issue:

    • @brunovjk requires payment through NewDot Manual Requests
  12. melvin-bot commented on Jun 11, 2026

    @melvin-bot

    @brunovjk The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

  13. brunovjk commented on Jun 15, 2026

    @brunovjk
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment on the PR: No PR directly introduced this issue.
      Link to the comment on the Issue:

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal

    Test:

    1. Go to /settings/profile/avatar and click to edit avatar
    2. Verify no Bot Avatars
    3. Go to /settings/agents/new click to edit avatar
    4. Verify bot avatars appear

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-c839-a3a6-db74-25046f348114
  14. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Jun 15, 2026
  15. melvin-bot commented on Jun 17, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  16. melvin-bot commented on Jun 17, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  17. mallenexpensify commented on Jun 19, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @brunovjk due $75 via NewDot

  18. garrettmknight commented on Jun 19, 2026

    @garrettmknight
    Contributor

    $75 approved for @brunovjk

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions