[PR #7916] [MERGED] fix(avatars): scope group avatars to configured owners and active speakers #8006

Closed
opened 2026-10-24 04:09:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7916
Author: @SpicyMarinara
Created: 10/20/2026
Status: ✅ Merged
Merged: 10/20/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/group-2d-avatar-routing


📝 Commits (3)

  • c5d17fa chore: start group 2D avatar fix for #7915
  • e64f7ab fix(avatars): scope group cast and animation to configured speakers
  • f9d659f fix(avatars): bound incomplete speaker tags to trailing lines

📊 Changes

12 files changed (+853 additions, -188 deletions)

View changed files

📝 docs/agents/avatars.md (+21 -19)
📝 e2e/avatar-placement.e2e.ts (+275 -2)
📝 e2e/avatar-setup.e2e.ts (+45 -18)
📝 e2e/avatar-voice-sync.e2e.ts (+29 -0)
📝 packages/client/src/features/avatars/contract.ts (+0 -2)
📝 packages/client/src/features/avatars/director/avatar-director.ts (+75 -21)
📝 packages/client/src/features/avatars/director/reply-text.ts (+65 -19)
📝 packages/client/src/features/avatars/setup/AvatarAgentSetup.tsx (+23 -16)
📝 packages/client/src/features/avatars/stage/AvatarStage.tsx (+8 -16)
📝 packages/client/src/features/avatars/stage/avatar-stage-logic.ts (+6 -22)
📝 scripts/regressions/avatar-director.regression.ts (+287 -1)
📝 scripts/regressions/avatar-stage-logic.regression.ts (+19 -52)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote staging or merge a same-repository hotfix/* into main.

Linked issue

Closes #7915

Why this change

Maintainer-requested behavior change: @SpicyMarinara explicitly requested opt-in avatars for configured characters only, correct speaker ownership, and no 2D or 3D cast limit. Existing assertions that unsaved sprites automatically appear, that the switch starts enabled without a setup, or that the cast is capped at two/four are intentionally replaced with assertions for that requested behavior. The group tests assert excluded members only after five configured peers have painted, and setup tests verify saving and reload.

Enabling avatar agents in a group chat should show only participants who have chosen an avatar, and each reply should animate its actual speaker. Previously, unsaved sprite fallbacks appeared automatically, phones showed at most two avatars and desktops four, and one member's speech clock or a name in narration could animate the wrong character.

What changed

  • Characters with only expression sprites no longer appear automatically as chat avatars. Preview still works; turning on Show this avatar in chats saves the PNGTuber setup and enables it in one step. Without a usable setup, the switch is off and disabled. Saved disabled avatars stay hidden.
  • Both 2D and 3D casts have no fixed count limit on desktop or mobile. Every configured, enabled participant appears. Existing size/Arrange controls, frame rates, pixel-density caps and pause behavior remain available.
  • Individual replies use the responding member's identity, including identical consecutive text, and stop the previous member's mouth. Merged replies use speaker tags or named dialogue for both speech and emotion, handle partial/encoded tags safely, and leave unknown speakers unvoiced. Replies received all at once play in order.
  • When a voice starts, stale text animation from other members stops. Lip sync follows that voice's owner, while a later unvoiced Game line retains its text fallback. Setup's shown-kind badge follows saved configuration.
  • Updated docs/agents/avatars.md; translation follow-up: #7917.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Full implementation evidence for e64f7ab40fa339d61fb891ffdc5bd644ed82953c (follow-up parser correction below):

  • pnpm check: passed, including localization, formatting, TypeScript/lint and production build. One pre-existing hook-dependency warning in HomeProfessorMariChat.tsx; no errors. The final test-only cleanup also passed pnpm check:e2e-types.
  • node scripts/run-regressions.mjs --filter avatar-: 21/21 passed after the final production fixes. Before/after regressions reproduce wrong ownership, stale speech clocks, whole-reply overlap, unknown speakers, literal <3 text and later unvoiced Game fallback.
  • pnpm smoke:ui: 7 passed. pnpm smoke:production: 3 passed across desktop Chromium, mobile Chromium and mobile WebKit after the final production fixes.
  • Focused browser proof: 12 group cases passed (five PNGTubers or five VRM models, Roleplay/Game, all three projects). Actual Pantalone renderer updates and painted pixels follow Individual/Merged speech while the other four remain quiet. Disabled, profile-only and unsaved-sprite participants stay excluded after configured peers paint.
  • Existing coverage passed across runs: all 12 desktop 2D/3D voice timelines, six placement cases and three shared Arrange cases. An initial WebKit setup fixture startup race was fixed by navigating after the chat shell loads. Final selected rerun: 8 passed, 4 authored mobile voice skips; final setup-only rerun after test cleanup: 3 passed.
  • Local Docker build succeeded; its final image served /api/health with status: ok and the frontend with HTTP 200 using disposable storage.
  • Local CodeRabbit: first two completed passes found four minor issues, all fixed with focused proof. The last pass found one unreliable duplicate negative assertion in setup; removed it because the group test already checks exclusion after five positive peers render. The third pass completed; all five reported findings are addressed. The test-only negative-probe cleanup passed on all three browser projects.
  • git diff --check: clean.

Final parser correction at f9d659f89ca8443e7df25bd711907c071d4aeb99: reproduced and fixed the hosted finding where an incomplete tag crossed later prose/speaker lines. Also covered terminal LF/CRLF and blank lines so unfinished attribute text cannot change speaker ownership. The exact final file bytes passed pnpm check, all 21 avatar regression files and the focused desktop group renderer case. Four desktop 2D/3D group cases passed on the intermediate newline-boundary correction. The final local delta review completed with zero further findings; its preceding terminal-line-break finding was fixed and tested. Earlier Docker and broad mobile/voice evidence above applies to the implementation before this one-line parser refinement.

These boxes remain for human verification. Mobile browser emulation, simple model fixtures and synthetic voice clips were used; physical devices and real external voice providers were not tested.

Manual verification notes

  • Manually verify your own PNGTuber/Mesh and VRM models in an Individual group, switching responders and swiping one member.
  • Manually verify a Merged (Narrator) reply with several speakers, with streaming on and off and with real provider TTS/autoplay.
  • Manually verify a large cast and Arrange/size controls on physical Android and iOS devices. Browser mobile emulation does not prove native-device performance.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on docs-i18n updated, or a [docs-i18n] follow-up issue opened
  • Version/release files updated (only if this PR includes a version bump)

English avatar guide updated. #7917 tracks the translated guide supplement. No app-version or storage-format change.

UI evidence

Before/after screenshot report on GitHub Gist: download browser-evidence.html and open it to view the embedded original PNGs. The report contains the old desktop/mobile limits and the new five-avatar PNGTuber and VRM casts in light/dark themes. The VRM fixture deliberately uses simple red geometry to prove model count. All screenshots use disposable fixture characters and public demo artwork.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7916 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/20/2026 **Status:** ✅ Merged **Merged:** 10/20/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/group-2d-avatar-routing` --- ### 📝 Commits (3) - [`c5d17fa`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c5d17fa9f649bf1910acf8120fb2e4d6ff9a427d) chore: start group 2D avatar fix for #7915 - [`e64f7ab`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e64f7ab40fa339d61fb891ffdc5bd644ed82953c) fix(avatars): scope group cast and animation to configured speakers - [`f9d659f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f9d659f89ca8443e7df25bd711907c071d4aeb99) fix(avatars): bound incomplete speaker tags to trailing lines ### 📊 Changes **12 files changed** (+853 additions, -188 deletions) <details> <summary>View changed files</summary> 📝 `docs/agents/avatars.md` (+21 -19) 📝 `e2e/avatar-placement.e2e.ts` (+275 -2) 📝 `e2e/avatar-setup.e2e.ts` (+45 -18) 📝 `e2e/avatar-voice-sync.e2e.ts` (+29 -0) 📝 `packages/client/src/features/avatars/contract.ts` (+0 -2) 📝 `packages/client/src/features/avatars/director/avatar-director.ts` (+75 -21) 📝 `packages/client/src/features/avatars/director/reply-text.ts` (+65 -19) 📝 `packages/client/src/features/avatars/setup/AvatarAgentSetup.tsx` (+23 -16) 📝 `packages/client/src/features/avatars/stage/AvatarStage.tsx` (+8 -16) 📝 `packages/client/src/features/avatars/stage/avatar-stage-logic.ts` (+6 -22) 📝 `scripts/regressions/avatar-director.regression.ts` (+287 -1) 📝 `scripts/regressions/avatar-stage-logic.regression.ts` (+19 -52) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote `staging` or merge a same-repository `hotfix/*` into `main`. ## Linked issue Closes #7915 ## Why this change **Maintainer-requested behavior change:** @SpicyMarinara explicitly requested opt-in avatars for configured characters only, correct speaker ownership, and no 2D or 3D cast limit. Existing assertions that unsaved sprites automatically appear, that the switch starts enabled without a setup, or that the cast is capped at two/four are intentionally replaced with assertions for that requested behavior. The group tests assert excluded members only after five configured peers have painted, and setup tests verify saving and reload. Enabling avatar agents in a group chat should show only participants who have chosen an avatar, and each reply should animate its actual speaker. Previously, unsaved sprite fallbacks appeared automatically, phones showed at most two avatars and desktops four, and one member's speech clock or a name in narration could animate the wrong character. ## What changed - Characters with only expression sprites no longer appear automatically as chat avatars. Preview still works; turning on **Show this avatar in chats** saves the PNGTuber setup and enables it in one step. Without a usable setup, the switch is off and disabled. Saved disabled avatars stay hidden. - Both **2D and 3D** casts have no fixed count limit on desktop or mobile. Every configured, enabled participant appears. Existing size/Arrange controls, frame rates, pixel-density caps and pause behavior remain available. - Individual replies use the responding member's identity, including identical consecutive text, and stop the previous member's mouth. Merged replies use speaker tags or named dialogue for both speech and emotion, handle partial/encoded tags safely, and leave unknown speakers unvoiced. Replies received all at once play in order. - When a voice starts, stale text animation from other members stops. Lip sync follows that voice's owner, while a later unvoiced Game line retains its text fallback. Setup's shown-kind badge follows saved configuration. - Updated `docs/agents/avatars.md`; translation follow-up: #7917. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Full implementation evidence for `e64f7ab40fa339d61fb891ffdc5bd644ed82953c` (follow-up parser correction below): - `pnpm check`: passed, including localization, formatting, TypeScript/lint and production build. One pre-existing hook-dependency warning in `HomeProfessorMariChat.tsx`; no errors. The final test-only cleanup also passed `pnpm check:e2e-types`. - `node scripts/run-regressions.mjs --filter avatar-`: 21/21 passed after the final production fixes. Before/after regressions reproduce wrong ownership, stale speech clocks, whole-reply overlap, unknown speakers, literal `<3` text and later unvoiced Game fallback. - `pnpm smoke:ui`: 7 passed. `pnpm smoke:production`: 3 passed across desktop Chromium, mobile Chromium and mobile WebKit after the final production fixes. - Focused browser proof: 12 group cases passed (five PNGTubers or five VRM models, Roleplay/Game, all three projects). Actual Pantalone renderer updates and painted pixels follow Individual/Merged speech while the other four remain quiet. Disabled, profile-only and unsaved-sprite participants stay excluded after configured peers paint. - Existing coverage passed across runs: all 12 desktop 2D/3D voice timelines, six placement cases and three shared Arrange cases. An initial WebKit setup fixture startup race was fixed by navigating after the chat shell loads. Final selected rerun: 8 passed, 4 authored mobile voice skips; final setup-only rerun after test cleanup: 3 passed. - Local Docker build succeeded; its final image served `/api/health` with `status: ok` and the frontend with HTTP 200 using disposable storage. - Local CodeRabbit: first two completed passes found four minor issues, all fixed with focused proof. The last pass found one unreliable duplicate negative assertion in setup; removed it because the group test already checks exclusion after five positive peers render. The third pass completed; all five reported findings are addressed. The test-only negative-probe cleanup passed on all three browser projects. - `git diff --check`: clean. Final parser correction at `f9d659f89ca8443e7df25bd711907c071d4aeb99`: reproduced and fixed the hosted finding where an incomplete tag crossed later prose/speaker lines. Also covered terminal LF/CRLF and blank lines so unfinished attribute text cannot change speaker ownership. The exact final file bytes passed `pnpm check`, all 21 avatar regression files and the focused desktop group renderer case. Four desktop 2D/3D group cases passed on the intermediate newline-boundary correction. The final local delta review completed with zero further findings; its preceding terminal-line-break finding was fixed and tested. Earlier Docker and broad mobile/voice evidence above applies to the implementation before this one-line parser refinement. These boxes remain for human verification. Mobile browser emulation, simple model fixtures and synthetic voice clips were used; physical devices and real external voice providers were not tested. ### Manual verification notes - Manually verify your own PNGTuber/Mesh and VRM models in an Individual group, switching responders and swiping one member. - Manually verify a Merged (Narrator) reply with several speakers, with streaming on and off and with real provider TTS/autoplay. - Manually verify a large cast and Arrange/size controls on physical Android and iOS devices. Browser mobile emulation does not prove native-device performance. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on `docs-i18n` updated, or a `[docs-i18n]` follow-up issue opened - [ ] Version/release files updated (only if this PR includes a version bump) English avatar guide updated. #7917 tracks the translated guide supplement. No app-version or storage-format change. ## UI evidence [Before/after screenshot report on GitHub Gist](https://gist.github.com/SpicyMarinara/417d3e27be5a1b2dffc40ae455ee7d3e): download `browser-evidence.html` and open it to view the embedded original PNGs. The report contains the old desktop/mobile limits and the new five-avatar PNGTuber and VRM casts in light/dark themes. The VRM fixture deliberately uses simple red geometry to prove model count. All screenshots use disposable fixture characters and public demo artwork. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:09:35 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8006
No description provided.