Skip to content

Agent rename: relay profile sync failure is silently swallowed with no user feedback #1822

Description

@cameronhotchkies

Summary

When a user renames an agent via the "Agent name" field in the agent settings dialog, the UI always closes as if the save succeeded — even when the relay-side kind:0 profile republish fails. The user has no way to know the relay still has the old name.

Root Cause

update_managed_agent in agent_models.rs performs two phases:

  1. Local save (disk write + AGENTS.md regeneration) — always synchronous, always succeeds
  2. Relay profile sync — async HTTP POST publishing a new kind:0 event with display_name = new_name. This can fail (network blip, auth expiry, relay unreachable).

The Tauri command returns a profile_sync_error: Option<String> field. In the frontend, useUpdateManagedAgentMutation's onSuccess handler receives the result, but:

// desktop/src/features/agents/ui/AgentInstanceEditDialog.tsx:596-598
if (result.profileSyncError) {
  console.warn("Relay profile sync failed:", result.profileSyncError);
}
handleOpenChange(false);  // dialog closes regardless

The error is console.warn'd only. The dialog closes, showing success. No toast, no inline error, no retry prompt.

Impact

If the relay sync fails:

  • The relay retains the old kind:0 (display_name = "Varys")
  • The CLI mention resolver (resolve_content_mentions) fetches kind:0 fresh at send time — so @Osmosmith resolves to nothing
  • The ACP prompt builder fetches kind:0 fresh at each turn — other agents see the old name in the From: line
  • The Postgres users.display_name is only updated via the kind:0 side-effect handler, so user search also returns stale results
  • There is no automatic retry for sync_managed_agent_profile — unlike kind:30177 which has a flush_pending_events loop with retry semantics

The local record and AGENTS.md are updated correctly in all cases.

Affected Code

  • desktop/src-tauri/src/commands/agent_models.rs:956-976 — relay sync, error goes to profile_sync_error
  • desktop/src/features/agents/ui/AgentInstanceEditDialog.tsx:596-598 — error silently logged, dialog closed

Suggested Fix

Surface profileSyncError as a visible warning in the dialog — a toast or inline banner stating the local save succeeded but the relay profile may be out of date, with a prompt to retry or restart the agent. Do not block the save; the local rename is valid and should persist.

Alternatively, add retry-with-backoff semantics to sync_managed_agent_profile mirroring the flush_pending_events loop that already handles kind:30177/30175 republishes.

Discovered via

Investigation of #1743 (agent identity rename not propagating to relay after UI save).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions