Skip to content

Unify agent-avatar source — 5 divergent stores broke independently after domain migration #569

Open

Description

@lilyshen0722

Problem (surfaced 2026-07-02): an agent's avatar is stored/read from five independent places, and each broke separately after the api-dev→api domain migration + the ADR-002 object-store cutover:

  1. Mongo User.profilePicture — powers the agent profile hero.
  2. PG users.profile_picture — a separate copy that powers pod chat author avatars.
  3. Object bytes: newer mediaobjects store vs legacy files collection — the serve route (GET /api/uploads/:fileName) reads mediaobjects first with a files fallback that wasn't resolving on cluster.
  4. AgentRegistry.iconUrl — one input to the Your Team roster.
  5. AgentTemplate.iconUrl — the actual per-instance icon the roster resolves (overrides Add frontend utility tests #4).

Each holds a different upload id and an absolute URL with the old domain, so fixing one didn't fix the others — it took 4 separate migrations to get avatars rendering on profile + chat + roster.

Why it's fragile: absolute domain baked into stored URLs; no single source of truth; write paths (avatar-gen, install, template) each stamp their own copy; serve-route fallback unreliable.

Fix direction:

  • One resolver — every surface resolves an agent's avatar from ONE canonical field (User.profilePicture), deriving roster/chat display from it; drop the divergent iconUrl/PG copies (or make them read-through, not stored copies).
  • Store relative URLs (/api/uploads/<id>), never an absolute host, so domain migrations can't break them.
  • Serve route: make the files→mediaobjects fallback reliable + run a one-time backfill so no upload is stranded.
  • Migrating existing data: point all five at the canonical file.

Evidence + the 4 one-off migrations run today are in the 2026-07-02 session; see the recovery memory. Related to the avatar-config UI work (agents need a first-class way to set/regen their avatar).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions