fix(desktop): persist agent avatar edits#1666
Open
andresuribe87 wants to merge 1 commit into
Open
Conversation
The edit-agent dialog dropped avatar changes silently: `avatarUrl` was absent from the entire update path (UI submit -> UpdateManagedAgentInput -> UpdateManagedAgentRequest -> handler), and the avatar picker was hard-disabled with a comment noting the backend couldn't persist it. Creating an agent set the image fine, so the bug was specific to updating an existing agent. Wire `avatarUrl` end to end: - add `avatarUrl?: string | null` to UpdateManagedAgentInput (tri-state) - resolve + send it from the edit dialog (base64 data URIs upload to a hosted URL, emoji SVGs pass through, mirroring the create path) and enable the picker - add `avatar_url: Option<Option<String>>` to UpdateManagedAgentRequest - assign it to the record and re-publish the agent's kind:0 profile when the avatar changes (previously only on rename) Tri-state semantics: absent = don't touch, null = clear to the harness default avatar, url = set. Tests: add avatar_url deserialization tri-state tests (mirroring provider). Verified desktop typecheck, biome, JS unit tests, tauri crate tests, clippy, and rustfmt. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
You can't update an existing agent's profile image. Creating an agent sets the image fine, but editing it does nothing — the avatar picker in the edit dialog is even hard-
disabledwith a comment noting the backend can't persist it.Root cause
avatarUrlwas missing from the entire update path — this was an unimplemented feature presenting as a bug:AgentInstanceEditDialogwasdisabled(comment: "UpdateManagedAgentInput has no avatarUrl field, so edits can't be persisted yet").UpdateManagedAgentInput(TS IPC type) had noavatarUrlfield — thoughCreateManagedAgentInputandUpdatePersonaInputboth do.UpdateManagedAgentRequeststruct had noavatar_urlfield.update_managed_agenthandler never wroterecord.avatar_url, and only re-published the kind:0 profile when the name changed (re-using the old image even then).So the create path carried the avatar; the edit path silently dropped it — hence the bug is specific to updating an agent.
Fix
Wire
avatarUrlend to end:avatarUrl?: string | nulltoUpdateManagedAgentInput(tri-state).resolveManagedAgentAvatarUrl— and enable the picker. On upload failure the helper falls back to the existing avatar, so a transient failure never clobbers the current image.avatar_url: Option<Option<String>>toUpdateManagedAgentRequest(viadouble_option, matchingprovider).Tri-state semantics: absent = don't touch ·
null= clear to the harness default avatar · url = set.Testing
avatar_urldeserialization tri-state (absent / null / value), mirroring the existing provider tests — pass.pnpm typecheck(desktop) — clean.biome checkon changed files — clean.managedAgentAvatar) — 11/11 pass.cargo fmt --checkandcargo clippy— clean for the changed files. (Two pre-existing clippydead_codewarnings inarchive/store.rs+ an unused import inagent_settings.rsare unrelated to this change.)Manual verification steps
🤖 Generated with Claude Code