From 3b2de80cac7d627b0741e7349625987108c1fad6 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Fri, 27 Feb 2026 10:51:30 -0500 Subject: [PATCH] fix: de-anonymize User1/User2 references in notes and reasoning text The LLM returns note_update, reasoning, and worst_message with anonymized names. These are now replaced with real display names before storage, so user profiles no longer contain meaningless User1/User2 references. Co-Authored-By: Claude Opus 4.6 --- cogs/sentiment/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cogs/sentiment/__init__.py b/cogs/sentiment/__init__.py index 6119b0e..f581eec 100644 --- a/cogs/sentiment/__init__.py +++ b/cogs/sentiment/__init__.py @@ -292,6 +292,13 @@ class SentimentCog(commands.Cog): anon_name = finding.get("username", "") if anon_name in reverse_map: finding["username"] = reverse_map[anon_name] + # De-anonymize text fields that may reference other users + for field in ("note_update", "reasoning", "worst_message"): + text = finding.get(field) + if text: + for anon, real in reverse_map.items(): + text = text.replace(anon, real) + finding[field] = text @staticmethod def _build_conversation(