Skip to content

fix(desktop): mention live relay agents instead of re-instantiating personas - #4635

Open
dilate7 wants to merge 3 commits into
block:mainfrom
dilate7:fix/mention-live-relay-agents
Open

fix(desktop): mention live relay agents instead of re-instantiating personas#4635
dilate7 wants to merge 3 commits into
block:mainfrom
dilate7:fix/mention-live-relay-agents

Conversation

@dilate7

@dilate7 dilate7 commented Aug 3, 2026

Copy link
Copy Markdown

Summary

Cross-device agent mentions were broken end-to-end: mentioning an agent from a desktop that is not its host machine either silently hid the agent from the mention picker or failed the send with harness ... was deleted while minting an orphan keypair per attempt. Three coupled causes, each fixed here:

  1. Mention candidate gate consulted only the local registry. isAgentIdentityInManagedList dropped every agent-flagged candidate not present in this machine's managed-agent registry, vetoing remote agents before shouldHideAgentFromMentions/eligibility ever ran. Now agents that are invocable via the relay directory (kind:10100 profile with respond_to and a shared channel) pass the gate.

  2. Persona mentions always instantiated locally. createMentionedPersonaAgents spawned a local agent from the persona even when a live agent with that name already existed. Now it resolves to the live relay agent (preferring one already in the channel); instantiation still happens when no live agent exists.

  3. Mention-readiness started agents locally even when they were already running elsewhere. ensureManagedAgentMentionsReady now skips the local start for agents whose relay presence is online and just tags them.

Supporting change: buzz agents set-profile --name <n> [--respond-to ...] [--channel <uuid>]... — a CLI command for an agent to publish the kind:10100 profile that all of the directory-based checks depend on. (Nothing in the desktop or harness publishes agent profiles today, so on self-hosted deployments the directory is empty and every directory-driven feature is inert — see #4634.)

Not included (follow-up candidates): the members-sidebar add-member search still applies the local-registry-only gate; the desktop could publish/refresh kind:10100 automatically on agent create/start.

Related issue

Fixes #4634

Testing

  • tsc --noEmit, biome check, file-size ratchet, and the agent/mention test suites pass (56 tests, including new coverage for the directory-invocable gate behavior and the persona→live-agent resolution helpers).
  • Verified end-to-end on a self-hosted relay with two desktop instances on one machine (separate profiles): host desktop runs the agents; second desktop (fresh profile, no local registry entries, no harness) sees the agents in the mention picker, sends a channel mention with the correct live pubkey in the p tag, no spawn is attempted, and the agent answers. Before these changes the same setup showed no agents in the picker and failed sends with the harness error.

…ersonas

When a persona mention is sent from a desktop that is not the agent's host
machine, the send flow tries to spawn a local instance and fails (harness
definitions are per-machine), blocking the send entirely. Each failed
attempt also mints a fresh agent keypair.

Resolve persona mentions to an already-live relay agent with the same name
when one exists, preferring an agent that is a member of the current
channel. Instantiation from a persona still happens when no live agent
exists.

Signed-off-by: dilate7 <dilate7@gmail.com>
@dilate7
dilate7 requested a review from a team as a code owner August 3, 2026 23:06
@dilate7

dilate7 commented Aug 3, 2026

Copy link
Copy Markdown
Author

Withdrawing this for now — verification on a second desktop surfaced an additional spawn path (managed-agent start on mention) that this change doesn't fully cover yet. I'll follow up once the fix is verified end-to-end. The issue (#4634) still stands and reproduces as described.

@dilate7 dilate7 closed this Aug 3, 2026
dilate7 added 2 commits August 3, 2026 20:44
…relay

Adds a presence gate to ensureManagedAgentMentionsReady (a synced agent
record that is already online elsewhere is tagged without touching the
local runtime), plus a buzz agents set-profile CLI command to publish the
kind:10100 directory profile the eligibility checks depend on.

Signed-off-by: dilate7 <dilate7@gmail.com>
…idate gate

isAgentIdentityInManagedList dropped every agent-flagged candidate whose
pubkey is missing from the local managed registry — on any machine that is
not the agent's host, that vetoes remote agents before mention eligibility
is ever consulted, making cross-device agent mentions impossible.

Accept agents that are invocable via the relay directory (a kind:10100
profile with respond_to and a shared channel) in addition to local-registry
agents. Extracts two search-label helpers into searchUserLabels.ts to keep
useMentions.ts inside the file-size ratchet.

Signed-off-by: dilate7 <dilate7@gmail.com>
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.

Persona mentions from a second desktop fail to send and mint orphan agent keypairs

1 participant