Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: human-portrait avatar fallback for blank Character identity (#2752)

[._.]/ Adam Eivyf4d0944aec1b
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 3a4be9ff1e..274e8b7858 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -36,6 +36,8 @@
## Fixed
+- [issue-2752] **Generating a Character avatar before you've entered your name no longer produces a D&D adventurer.** The Character reframe leaves a fresh install's name and class blank, but clicking "Generate avatar" first still fell back to a fantasy `fantasy portrait of an adventurer, warrior class, D&D character art …` prompt — the exact generic RPG art the reframe moves away from. The avatar fallback is now a human portrait: a blank identity renders a neutral `portrait of a person, photographic, natural lighting …`, and once you've filled in your name (and class) it shapes a photographic portrait from those instead of a fantasy one. Callers that genuinely want a fantasy avatar still pass their own prompt to opt out.
+
- [issue-2726] **Your Character sheet's Mentalist, Vitalist, and Strategist can now tell an unreadable file from an empty one.** The sheet promises that a domain it can't read says "Unavailable" rather than pretending you've done nothing — but the three skills backed by files (POST practice, health logging, and goals) couldn't keep that promise: the shared file reader returned an empty default for *every* failure, not just for a file that was never written, so a corrupt or unreadable `post-sessions.json` scored a real-looking "Mentalist — Lv 0, 0 logged". Health was the worst case: all five of its logs could fail and still add up to a perfectly plausible zero. Those reads are now strict — a file that's genuinely absent still counts as the honest zero it is, while one that's present but unreadable or corrupt reports as Unavailable, the same way the database-backed skills always have. The Metrics grid gets the fix for free, since both read the same signals. Nothing else changes behavior: every other screen that reads these files still degrades gracefully to an empty list rather than breaking, which is the right call for a view you're using rather than a number you're being told.
- [issue-2700] **Layered Intelligence runs were being recorded as failures even when they succeeded.** An LI run is a *reasoning* run: it's explicitly told not to commit or open a PR, and hands its result back through a sentinel file instead. But the shared success check only knows how to look for a code commit, and its verdict overrides the run's actual exit code — so every correct LI run was filed as a failure, dragging the loop's success rate toward 0% and skewing anything built on it (task routing, the CoS Learning card, duration estimates). Task types that hand back results programmatically rather than as a commit are now exempt from the commit check, the same way pipeline and media jobs already were. Ordinary code tasks are still held to it. Because the mis-recorded history can't be reconstructed after the fact, installs that already ran the loop get that one bucket cleared on upgrade, so it starts from an honest "no runs recorded yet" rather than a fabricated 0% — no other task type's stats are touched.
diff --git a/server/services/imageGen/avatarPrompt.test.js b/server/services/imageGen/avatarPrompt.test.js
new file mode 100644
index 0000000000..3012a6aff1
--- /dev/null
+++ b/server/services/imageGen/avatarPrompt.test.js
@@ -0,0 +1,44 @@
+/**
+ * buildAvatarPrompt — human-centered Character avatar fallback (#2752).
+ *
+ * The Character surface (#2677) reframed name/class around the real human user,
+ * so a fresh install has a blank identity. Clicking "Generate avatar" before
+ * filling in a name must NOT fall back to the old D&D adventurer/warrior prompt.
+ * These assert the neutral human-portrait default and the photographic (not
+ * fantasy) framing when identity fields are present.
+ */
+
+import { describe, it, expect } from 'vitest';
+import { buildAvatarPrompt } from './index.js';
+
+describe('buildAvatarPrompt', () => {
+ it('uses a neutral human portrait for a fully blank identity', () => {
+ const prompt = buildAvatarPrompt({ name: '', characterClass: '' });
+ expect(prompt).toBe('portrait of a person, photographic, natural lighting, detailed, high quality');
+ });
+
+ it('never emits the old D&D adventurer/warrior fallback for a blank identity', () => {
+ for (const args of [{}, { name: '', characterClass: '' }, { name: ' ', characterClass: ' ' }, { name: undefined, characterClass: undefined }]) {
+ const prompt = buildAvatarPrompt(args).toLowerCase();
+ expect(prompt).not.toContain('adventurer');
+ expect(prompt).not.toContain('warrior');
+ expect(prompt).not.toContain('d&d');
+ expect(prompt).not.toContain('fantasy');
+ expect(prompt).toContain('portrait of a person');
+ }
+ });
+
+ it('shapes a photographic portrait from provided identity fields', () => {
+ const prompt = buildAvatarPrompt({ name: 'Alice Example', characterClass: 'Engineer' });
+ expect(prompt).toBe('portrait of Alice Example, Engineer, photographic, natural lighting, detailed, high quality');
+ expect(prompt).not.toContain('fantasy');
+ expect(prompt).not.toContain('D&D');
+ });
+
+ it('trims and omits blank identity fields individually', () => {
+ expect(buildAvatarPrompt({ name: ' Bob ', characterClass: '' }))
+ .toBe('portrait of Bob, photographic, natural lighting, detailed, high quality');
+ expect(buildAvatarPrompt({ name: '', characterClass: 'Teacher' }))
+ .toBe('portrait of Teacher, photographic, natural lighting, detailed, high quality');
+ });
+});
diff --git a/server/services/imageGen/index.js b/server/services/imageGen/index.js
index 5fbd491909..939c6d7392 100644
--- a/server/services/imageGen/index.js
+++ b/server/services/imageGen/index.js
@@ -115,10 +115,24 @@ export async function generateImage(params) {
const DEFAULT_NEGATIVE_PROMPT = 'blurry, low quality, distorted, deformed, ugly, watermark, text, signature';
+// Build the default avatar prompt for the human-centered Character surface (#2677).
+// The Character page portrays the real human user, so a blank identity must NOT
+// fall back to the old generic D&D adventurer/warrior prompt: an empty name/class
+// yields a neutral human portrait, and any provided identity fields shape a
+// photographic (not fantasy) prompt. Callers that genuinely want a fantasy/RPG
+// avatar pass an explicit `prompt` to opt out of this default.
+export function buildAvatarPrompt({ name, characterClass } = {}) {
+ const descriptors = [name, characterClass]
+ .map((v) => (typeof v === 'string' ? v.trim() : ''))
+ .filter(Boolean)
+ .join(', ');
+ const subject = descriptors ? `portrait of ${descriptors}` : 'portrait of a person';
+ return `${subject}, photographic, natural lighting, detailed, high quality`;
+}
+
export async function generateAvatar({ name, characterClass, prompt }) {
- const defaultPrompt = `fantasy portrait of ${name || 'an adventurer'}, ${characterClass || 'warrior'} class, D&D character art, detailed, dramatic lighting, painterly style`;
return generateImage({
- prompt: prompt || defaultPrompt,
+ prompt: prompt || buildAvatarPrompt({ name, characterClass }),
width: 512,
height: 512,
negativePrompt: `${DEFAULT_NEGATIVE_PROMPT}, nude, nsfw`,