[PR #7715] [MERGED] fix(expressions): give each Individual group reply its own expression #7892

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

📋 Pull Request Information

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

Base: staging ← Head: fix/7712-individual-expressions


📝 Commits (3)

  • cd4e181 fix(expressions): give each Individual group reply its own expression
  • 076f044 fix(expressions): keep saving the other replies if one write fails
  • 1826699 fix(expressions): don't read an earlier Individual reply as a whole turn

📊 Changes

4 files changed (+42 additions, -0 deletions)

View changed files

📝 packages/client/src/lib/sprite-expression-state.ts (+2 -0)
📝 packages/server/src/routes/generate.routes.ts (+22 -0)
📝 packages/shared/src/types/chat.ts (+2 -0)
📝 scripts/regressions/expression-group-generation.regression.ts (+16 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7712

Why this change

In a Roleplay group chat set to Individual, each character replies as her own message. The Expression Engine then runs once for the whole turn and saved every character's expression on the last reply only. The earlier replies had no expression of their own: their expression avatars stayed blank, and deleting or retrying the last reply took the whole turn's expressions with it.

The Expression Engine already reads the turn as one labelled section per speaker and returns one pick per character. The fix saves those picks on the right replies. It makes no extra model calls.

What changed

  • generate.routes.ts: the Individual loop records each responder's reply (message and swipe). When the Expression Engine result is saved, each earlier reply also gets its own character's expression. Only that one entry is written, and no sprite list (expressionSpriteIds).
  • The last reply is unchanged: it keeps the whole turn's map and sprite list. That map is what marks the turn's sprites as active in Visual Novel (#6024: "Treat all sprites with expressions returned for the current turn as active"). It also keeps "Only show active sprites" and the persona rule for a whole group turn (#7378) as they were.
  • Merged mode, 1:1 chats, regenerations (swipes) and Expression Engine retries go through code paths this PR does not touch.
  • expression-group-generation.regression.ts: runs a real Individual turn (Alice, then Bob) against a fixture provider. It checks that there is exactly one Expression Engine request, that Alice's reply has { alice: happy } and no sprite list, and that Bob's last reply still has both characters and the full sprite list.

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

Automated evidence (agent-run):

  • scripts/regressions/expression-group-generation.regression.ts passes with the fix. With the server change reverted it fails with an earlier reply has its own expression (actual undefined, expected { <alice>: 'happy' }).
  • Server TypeScript (tsc --noEmit -p packages/server) and Prettier on the changed files pass. Other results are added below as they finish.

Manual verification notes

  • Manually verify in a Roleplay group chat (Individual, Sequential, Expression Engine on, 3 sprite characters) that after one turn each reply's extra has spriteExpressions with its own character, and the last reply also has the others.
  • Manually verify, with expression avatars on, that every reply in the turn shows its own character's expression avatar.
  • Manually verify that Visual Novel display still shows every sprite from the turn as active (not faded) after an Individual turn.
  • Manually verify that "Only show active sprites" still shows every character who replied in the turn.
  • Manually verify that merged mode and a 1:1 chat still save expressions as before.

Docs and release impact

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

No docs, UI copy or version files change.

UI evidence (if applicable)

Server-side data fix; no UI change.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed expression display for sequential individual group replies: each character’s reply now reflects that character’s expression instead of inheriting another character’s. The final reply continues to retain the expressions associated with the overall turn.
    • Improved expression tracking when the latest reply is only part of a group turn, so earlier completed turns remain available for expression display.

🔄 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/7715 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/7712-individual-expressions` --- ### 📝 Commits (3) - [`cd4e181`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cd4e1814993a8ce7e059c57c3f12fdace70924f4) fix(expressions): give each Individual group reply its own expression - [`076f044`](https://github.com/Pasta-Devs/Marinara-Engine/commit/076f044551990704703a11fe65e48c1bc74e26cf) fix(expressions): keep saving the other replies if one write fails - [`1826699`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1826699b9b18b8e459bd23252125768b86925b3c) fix(expressions): don't read an earlier Individual reply as a whole turn ### 📊 Changes **4 files changed** (+42 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/lib/sprite-expression-state.ts` (+2 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+22 -0) 📝 `packages/shared/src/types/chat.ts` (+2 -0) 📝 `scripts/regressions/expression-group-generation.regression.ts` (+16 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #7712 ## Why this change In a Roleplay group chat set to Individual, each character replies as her own message. The Expression Engine then runs once for the whole turn and saved every character's expression on the last reply only. The earlier replies had no expression of their own: their expression avatars stayed blank, and deleting or retrying the last reply took the whole turn's expressions with it. The Expression Engine already reads the turn as one labelled section per speaker and returns one pick per character. The fix saves those picks on the right replies. It makes no extra model calls. ## What changed - `generate.routes.ts`: the Individual loop records each responder's reply (message and swipe). When the Expression Engine result is saved, each earlier reply also gets its own character's expression. Only that one entry is written, and no sprite list (`expressionSpriteIds`). - The last reply is unchanged: it keeps the whole turn's map and sprite list. That map is what marks the turn's sprites as active in Visual Novel (#6024: "Treat all sprites with expressions returned for the current turn as active"). It also keeps "Only show active sprites" and the persona rule for a whole group turn (#7378) as they were. - Merged mode, 1:1 chats, regenerations (swipes) and Expression Engine retries go through code paths this PR does not touch. - `expression-group-generation.regression.ts`: runs a real Individual turn (Alice, then Bob) against a fixture provider. It checks that there is exactly one Expression Engine request, that Alice's reply has `{ alice: happy }` and no sprite list, and that Bob's last reply still has both characters and the full sprite list. ## 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` Automated evidence (agent-run): - `scripts/regressions/expression-group-generation.regression.ts` passes with the fix. With the server change reverted it fails with `an earlier reply has its own expression` (actual `undefined`, expected `{ <alice>: 'happy' }`). - Server TypeScript (`tsc --noEmit -p packages/server`) and Prettier on the changed files pass. Other results are added below as they finish. ### Manual verification notes - [ ] Manually verify in a Roleplay group chat (Individual, Sequential, Expression Engine on, 3 sprite characters) that after one turn each reply's extra has `spriteExpressions` with its own character, and the last reply also has the others. - [ ] Manually verify, with expression avatars on, that every reply in the turn shows its own character's expression avatar. - [ ] Manually verify that Visual Novel display still shows every sprite from the turn as active (not faded) after an Individual turn. - [ ] Manually verify that "Only show active sprites" still shows every character who replied in the turn. - [ ] Manually verify that merged mode and a 1:1 chat still save expressions as before. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) No docs, UI copy or version files change. ## UI evidence (if applicable) Server-side data fix; no UI change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Fixed expression display for sequential individual group replies: each character’s reply now reflects that character’s expression instead of inheriting another character’s. The final reply continues to retain the expressions associated with the overall turn. * Improved expression tracking when the latest reply is only part of a group turn, so earlier completed turns remain available for expression display. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:08:33 +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#7892
No description provided.