Fix avatar misgendering, returning caller overflow, false callbacks

- Avatar prefetch checks gender marker, re-fetches on mismatch
- Returning callers need 2+ actual calls before re-eligible (was 1)
- Promotion rate lowered 10% → 5% to prevent pool flooding
- Callback injection skipped for returning callers (already have context)
- Show history clarifies "you are NOT that caller" to prevent identity confusion

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-21 02:03:07 -06:00
parent 314d5f9452
commit 9eaf2fe5e3
3 changed files with 26 additions and 15 deletions
+9 -1
View File
@@ -65,7 +65,15 @@ class AvatarService:
for caller in callers:
name = caller.get("name", "")
gender = caller.get("gender", "male")
if name and not (AVATAR_DIR / f"{name}.jpg").exists():
if not name:
continue
g = "female" if gender.lower().startswith("f") else "male"
path = AVATAR_DIR / f"{name}.jpg"
marker = AVATAR_DIR / f"{name}.gender"
# Always call get_or_fetch if: no file, no gender marker, or gender mismatch
if not path.exists() or not marker.exists() or marker.read_text().strip() != g:
if path.exists():
print(f"[Avatar] Gender mismatch for {name}: cached={marker.read_text().strip() if marker.exists() else '?'}, want={g} — re-fetching")
tasks.append(self.get_or_fetch(name, gender))
if not tasks:
+1 -1
View File
@@ -44,7 +44,7 @@ class RegularCallerService:
import random
if not self._regulars:
return []
available = [r for r in self._regulars if len(r.get("call_history", [])) > 0]
available = [r for r in self._regulars if len(r.get("call_history", [])) > 1]
if not available:
return []
return random.sample(available, min(count, len(available)))