Fix UUID leaking as user display name in agent context

resolveUserAddressName now filters UUID-format strings (same as wx_*),
preventing user.id from being used as a display name when nickname/
displayName is absent.

buildSessionMemoryEntries always calls ensureUserMemoryProfile when
userContext is available so stale profiles with UUID display names are
auto-healed on next session init.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
john
2026-06-26 15:56:22 +08:00
parent 9b4a25799f
commit 8502775042
2 changed files with 12 additions and 8 deletions
+6 -5
View File
@@ -154,11 +154,12 @@ export function buildSessionMemoryEntries({
return entries;
}
const profile =
loadUserMemoryProfile(workingDir) ??
(userContext?.userId
? ensureUserMemoryProfile(workingDir, userContext)
: null);
// Always call ensureUserMemoryProfile when userContext is available so that
// stale displayName values (e.g. UUID written before nickname was resolved)
// are healed on the next session init.
const profile = userContext?.userId
? ensureUserMemoryProfile(workingDir, userContext)
: loadUserMemoryProfile(workingDir);
const addressName = resolveUserAddressName({
displayName: profile?.displayName ?? userContext?.displayName,