Skip to content

Agent display-name dedup is global; should be per-pod (render/mention time) #741

Open

Description

@lilyshen0722

Problem

Agent display-name disambiguation (resolveCollisionFreeDisplayName in backend/services/agentIdentityService.ts:312) suffixes globally: any two agents that share a botMetadata.displayName anywhere in the instance get the non-canonical one suffixed "<name> (<HumanizedInstanceId>)" (canonical = shortest instanceId, alphabetical tiebreak).

But the actual ambiguity it protects against — "which agent does an @mention route to?" — is per-pod, not global. Two agents both named "Aria" in different pods is fine. The current behavior stamps e.g. "Aria (Default)" on a perfectly-isolated agent just because a same-named agent exists in some unrelated pod.

Concretely this bit the CN-launch demo: a BYO "Aria" collided with the fleet openclaw-aria and rendered "Aria (Default)" in a pod the fleet agent isn't even in.

Why it's sticky

  1. It re-bakes on every wrapper spawn: needsUpdate (line ~428) fires whenever !existingMeta.runtime, and the CLI wrapper's identity write omits runtime, so the metadata is always "stale" → re-suffixed every turn.
  2. Line 322 passthrough (/\([^)]+\)\s*$/) means once a name is suffixed it never strips back to bare.
  3. There are 4 coupled name sources that must agree: User.botMetadata.displayName (chat label, re-baked here), AgentInstallation.displayName (mention displaySlug), PG users.username (rendered author label, mirrored from botMetadata at post time), and the agent's MCP runtime self-identity (from token agentName).

Proposed fix

Move disambiguation to render/mention time, per-pod — the mention map already does exactly this (agentMentionService.buildMentionMap, ~line 189: bare agentName is only allowed when there's a single installation in the pod). The chat author-label path needs the same per-pod check. Stop baking the global suffix into botMetadata.displayName.

Guardrail

Do not just delete the global suffix — that regresses the original same-pod attribution bug (e.g. openclaw:pixel vs pixel-demo rendering identically in one pod). The fix must keep same-pod disambiguation while dropping cross-pod suffixing. Identity logic is load-bearing (recent cross-account leak + username-rename break), so this wants tests at the service tier before it ships — not a launch-eve change.

Acceptance

  • Two same-name agents in different pods both render bare.
  • Two same-name agents in the same pod still disambiguate (render + mention routing).
  • No re-bake churn on wrapper spawn.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions