buzz icon indicating copy to clipboard operation
buzz copied to clipboard

Deleting an agent does not clean up its identity

Open meeveem opened this issue 2 months ago • 2 comments

Severity: low–medium — cosmetic, but confusing.

Removing a managed agent deletes only the local record. Two server-side sources keep the identity visible, notably in the @ mention autocomplete:

  1. channel_members — the agent was added to a channel; the row survives.
  2. events where kind = 30177 — the owner-authored agent-declaration event, which is the source the desktop queries to build its relay agent directory.

Neither is cleaned on delete, and neither is discoverable from the UI.

Expected: deleting a managed agent should either archive the identity (NIP-IA) or tell the operator what remains.

Related UX: deleting a persona before its instances fails with "has provider-deployed agent instances … delete those agent instances first", and the create form's backend defaults to local with no way to change it, so every remote agent must be re-configured through Advanced.

meeveem avatar Sep 18 '26 05:09 meeveem

Same issue here, on a production deployment (self-hosted relay on a VPS, desktop client on macOS). I deleted a managed agent and later recreated one with the same name, the @ mention then became ambiguous ("The mention @name is ambiguous. Choose a recipient from the mention picker") because the stale channel_members row and the agent-declaration event keep the dead identity alive in autocomplete alongside the new one. It took down an entire team of ten production agents before I found the cause. The only safe workaround right now is to never reuse a deleted agent's name - recreate under a fresh name (e.g. name-v2) - since mention matching keys on the name and the stale row is invisible in the UI.

Expected behaviour: deletion should be total and fully isolated. When a managed agent is deleted, the relay should purge the channel_members row and the kind 30177 declaration event (or archive the identity and hide it from autocomplete on every client), so the agent is gone from the relay, the agent directory, and all mention pickers - permanently. And critically, the deletion or recreation of one agent must never affect any other team agents, their mentions, sessions, channel memberships and running state should be untouched. In my case the fallout spread well beyond the deleted agent and disrupted the rest of the team, which is what turned a cosmetic issue into a production outage. Failing full cleanup, the desktop should at least show the operator what still remains and offer an explicit "purge identity" action. A delete that leaves an invisible half-record is the worst of both worlds, the operator believes it's gone, but it can silently poison mentions months later.

githb-ac avatar Sep 22 '26 20:09 githb-ac

Hi team - following up on the comment above.

I can confirm this still reproduces on desktop v0.5.24. I noticed #7298 in the release notes (fencing the re-add race during a pending deletion) - great step, and it does reduce the collision when re-creating an agent quickly.

However, the core of the issue is still open: a deleted agent is not fully purged from the relay directory, so a stale entry remains that can affect mentions and the rest of the team, and the only workaround is to never delete an agent at all.

Could this please be triaged, and ideally considered for prioritization?

githb-ac avatar Sep 23 '26 12:09 githb-ac