Skip to content

fix: skip avatar reconciliation for legacy agent records#933

Merged
wpfleger96 merged 4 commits into
mainfrom
wpfleger/fix-avatar-reconcile-regression
Jun 9, 2026
Merged

fix: skip avatar reconciliation for legacy agent records#933
wpfleger96 merged 4 commits into
mainfrom
wpfleger/fix-avatar-reconcile-regression

Conversation

@wpfleger96

Copy link
Copy Markdown
Collaborator

PR #921 introduced profile reconciliation on agent startup to self-heal missed profile publishes. However, it regressed avatar display for agents created before the PR: the new avatar_url field on ManagedAgentRecord deserializes as None for pre-existing records, causing the reconciliation to fall back to the generic runtime icon (e.g., the goose logo) and overwrite the custom persona avatar that was originally published.

This fix makes reconciliation skip the avatar entirely when record.avatar_url is None — we cannot know what was originally published for legacy records, so we leave the relay profile untouched. Agents created after PR #921 (which persist the avatar at creation time) continue to self-heal as intended.

Changes

  • reconcile_avatar(): returns None for legacy records instead of falling back to managed_agent_avatar_url(agent_command)
  • reconcile_agent_profile(): returns Ok(()) early when the expected avatar is None, skipping reconciliation entirely for legacy records
  • Updated test to assert new behavior

Fixes the avatar regression reported after merging #921.

@wpfleger96 wpfleger96 requested a review from a team as a code owner June 9, 2026 22:15
@wpfleger96 wpfleger96 force-pushed the wpfleger/fix-avatar-reconcile-regression branch from 66a9c9d to f542eb8 Compare June 9, 2026 22:28
@wpfleger96 wpfleger96 marked this pull request as draft June 9, 2026 23:24
npub1fgdl5qqnh3k3f2xkqrvt7cujalhm623x4s7fdjdj5yrtp5fzjl9qrjpucw added 4 commits June 9, 2026 19:41
Legacy ManagedAgentRecords (created before PR #921) have avatar_url: None
because the field was added with #[serde(default)]. Previously, reconciliation
fell back to the generic runtime icon, overwriting custom persona avatars.

Now, on first start after update, reconcile_agent_profile queries the relay
for the agent's existing kind:0 profile and backfills avatar_url from the
picture field. The backfilled value is persisted so migration runs only once.
If no profile exists on the relay, falls back to the command-derived icon.

After backfill, normal reconciliation proceeds uniformly for all records —
no special-casing needed for legacy vs post-PR-921 agents.

Removes the reconcile_avatar helper (migration handles legacy directly).

Signed-off-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: npub1fgdl5qqnh3k3f2xkqrvt7cujalhm623x4s7fdjdj5yrtp5fzjl9qrjpucw <4a1bfa0013bc6d14a8d600d8bf6392efefbd2a26ac3c96c9b2a106b0d12297ca@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: npub1fgdl5qqnh3k3f2xkqrvt7cujalhm623x4s7fdjdj5yrtp5fzjl9qrjpucw <4a1bfa0013bc6d14a8d600d8bf6392efefbd2a26ac3c96c9b2a106b0d12297ca@sprout-oss.stage.blox.sqprod.co>
The startup avatar backfill read the relay's kind:0 picture as the
source of truth, but PR #921's old reconciliation had already
overwritten that picture with the command default — so the backfill
locked in the wrong avatar. Persona-backed agents now resolve their
backfill avatar from PersonaRecord.avatar_url first, falling back to
the relay picture and command icon only when no persona avatar exists.

Signed-off-by: npub1fgdl5qqnh3k3f2xkqrvt7cujalhm623x4s7fdjdj5yrtp5fzjl9qrjpucw <4a1bfa0013bc6d14a8d600d8bf6392efefbd2a26ac3c96c9b2a106b0d12297ca@sprout-oss.stage.blox.sqprod.co>
restore_managed_agents_on_launch never called reconcile_agent_profile,
so agents restored at boot could have stale or missing kind:0 profiles
on the relay. The UI start path (start_managed_agent) already did this
as a fire-and-forget task.

After Phase C writes PIDs/status to disk, collect ProfileReconcileData
for each successfully spawned agent and spawn reconciliation tasks —
same fire-and-forget pattern, same error logging, no blocking startup.

Signed-off-by: npub1fgdl5qqnh3k3f2xkqrvt7cujalhm623x4s7fdjdj5yrtp5fzjl9qrjpucw <4a1bfa0013bc6d14a8d600d8bf6392efefbd2a26ac3c96c9b2a106b0d12297ca@sprout-oss.stage.blox.sqprod.co>
@wpfleger96 wpfleger96 force-pushed the wpfleger/fix-avatar-reconcile-regression branch from b572c97 to c14ab23 Compare June 9, 2026 23:41
@wpfleger96 wpfleger96 marked this pull request as ready for review June 9, 2026 23:51
@wpfleger96 wpfleger96 merged commit 73cd8d0 into main Jun 9, 2026
15 checks passed
@wpfleger96 wpfleger96 deleted the wpfleger/fix-avatar-reconcile-regression branch June 9, 2026 23:52
tlongwell-block pushed a commit that referenced this pull request Jun 10, 2026
* origin/main:
  Fix post-compact handoff context for OpenAI providers (#931)
  chore(release): release version 0.3.15 (#936)
  fix: persona is source of truth at spawn + thread-depth conventions (#930)
  fix: skip avatar reconciliation for legacy agent records (#933)
  feat(desktop): add nest commit identity guidance with human sign-off (#929)
  feat: provider/model selection for personas and runtime-aware env injection (#794)
  fix: reconcile agent profile on startup when relay publish was missed (#921)
  Revamp first-run onboarding (#924)
  Update setup loading screen (#926)
  fix(dm): keep hidden DMs hidden across refetch via relay-signed visibility snapshot (NIP-DV) (#857)
  Maximize desktop window on launch (#925)
  feat: preview features (experiments settings UI) (#888)
  fix(updater): send no-cache header on update check to avoid stale manifest (#922)
  fix(desktop): refresh channel state after unarchive (#923)
  Add channel visibility & ephemeral TTL controls to manage sidebar (#911)
  ci(release): add Intel macOS (x86_64) DMG as a release target (#748)

Signed-off-by: npub1mprnacetjua2xx3p5eddmhxyk6wv929ymm5py8kd2xfxurxahspqqlgyta <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@sprout-oss.stage.blox.sqprod.co>

# Conflicts:
#	desktop/src/features/sidebar/ui/AppSidebar.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant