Repository navigation
fix(install): preserve curated displayName on AgentProfile + AgentInstallation - #412
Closed
lilyshen0722 wants to merge 1 commit into
Closed
lilyshen0722 wants to merge 1 commit into
lilyshen0722 wants to merge 1 commit into
Conversation
…tallation PR #408 fixed the displayName-clobber on the intro-post path; this is the matching fix for the install-path itself. Surfaced 2026-05-20 in a fresh smoke pod: installing six existing dev-agent identities (openclaw:theo/ nova/pixel/aria/ops + codex:cody) wrote the registry-default ("Cuz 🦞" for openclaw, "Codex" for codex) into BOTH AgentInstallation.displayName AND AgentProfile.name. The V2 inspector member list reads AgentProfile FIRST, so every member rendered as "Cuz" even though the underlying User row had the right botMetadata.displayName. Fix: before writing either row, look up the existing User row for the SAME (agentName, instanceId) and prefer its botMetadata.displayName. Resolution order: explicit caller intent (req.body.displayName) → existing curated identity → registry default. The User-row lookup is the only load-bearing add; both call sites then read the resolved value. Regression test covers three cases: existing curated identity beats the registry default, explicit displayName beats both, and the registry default still wins when no curated identity exists (fresh install).
2 tasks
samxu01
pushed a commit
that referenced
this pull request
May 22, 2026
…#424) * fix(install): enrich displayName-lookup log with agentName/instanceId Code-reviewer follow-up on PR #412. The two displayName-lookup catch branches in install.ts both log a bare Mongoose error message with no hint about WHICH agent the lookup was attempting. An operator diagnosing 'wrong displayName on reinstall' has to cross-reference timestamps to figure out the install path. Append `${agent.agentName}:${normalizedInstanceId}` to both log lines: - the install-path lookup (line ~284) - the intro-path lookup (line ~420) No behavioral change — strictly diagnostic enrichment. Co-Authored-By: Lily Shen <[email protected]> * fix(install): use structured log args to satisfy CodeQL js/format-string-injection CodeQL flagged the template-literal log lines (`[install] displayName lookup failed for ${agent.agentName}:${normalizedInstanceId}`) as format-string-injection: agent.agentName + normalizedInstanceId both trace back to req.body and end up in the format-string slot. Same diagnostic payload, just shaped as a structured second arg: console.warn('[install] displayName lookup failed', { agent: agent.agentName, instance: normalizedInstanceId, error: (lookupErr as Error).message, }); CodeQL doesn't flag user-tainted values in non-format-string slots. Co-Authored-By: Lily Shen <[email protected]>
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.
Summary
AgentProfile.name.req.body.displayName→ existingUser.botMetadata.displayNamefor the same(agentName, instanceId)→ registry default (e.g."Cuz 🦞"/"Codex").AgentInstallation.install+AgentProfile.findOneAndUpdate) read the same resolved value, so they can't drift.Repro (from 2026-05-20 smoke test)
Installed six pre-existing dev-agent identities (openclaw:theo/nova/pixel/aria/ops + codex:cody) into a fresh pod via
POST /api/registry/install:Before:
AgentInstallation.displayName = "Cuz 🦞",AgentProfile.name = "Cuz 🦞"for all five openclaw agents. Member list rendered "Cuz" everywhere even thoughUser.botMetadata.displayNamewas "Aria"/"Nova"/etc.After: both seams write "Aria" (etc.) via the lookup.
Why the V2 member list shows "Cuz"
AgentProfile.nameis the per-pod display layer read FIRST by the inspector (perfeedback-displayname-role-leak-three-sources). User-row fixes alone aren't enough — every pod-scoped render layer downstream reads AgentProfile.Test plan
backend/__tests__/service/install.preserves-displayname.test.jscovers 3 cases:displayNamein body beats both🤖 Generated with Claude Code