[GH-ISSUE #1802] [Issue]: Runtime visuals drop sprite expression fallback and owner-key avatar state #884

Closed
opened 2026-10-21 05:22:55 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Xelvanis on GitHub (Jun 1, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1802

Originally assigned to: @cha1latte on GitHub.

Summary

Static parity audit of src/features/runtime/visuals found runtime sprite expression state can desync on the refactor branch:

  1. Roleplay sprite metadata no longer falls back to chat-level spriteExpressions and only writes message extra, unlike legacy.
  2. Expression avatars check raw character IDs and names, while the overlay can persist selected-character expressions under owner keys such as character:<id>.
  3. Related issue #1782 covers selected owner keys being filtered before generation. This issue focuses on runtime visual consumption, manual /emote persistence, and expression avatar state.

Expected behavior

  • Existing chat-level spriteExpressions should still be honored for older chats and for manual expression changes before an assistant message exists.
  • Manual /emote and Expression Engine updates should visibly update both overlay sprites and expression avatars.
  • Owner-keyed expression maps should resolve consistently across the sprite overlay, expression avatars, and tracker consumers.

Actual behavior

  • use-sprite-metadata-state reads the latest assistant message extra and returns {} when no message-level spriteExpressions are present, with no chat metadata fallback.
  • persistSpriteExpressions only patches the last assistant message extra. If no assistant message exists, a manual /emote call can report success while persisting no expression state.
  • RoleplayModeRoute expression avatar lookup checks expressions[characterId] and character name, but not expressions[character:<id>]. SpriteOverlay maps agent results to owner keys and passes those owner keys back to onExpressionChange.

Steps to reproduce

  1. Open a roleplay chat that has legacy chat metadata spriteExpressions, but whose latest assistant message has no extra.spriteExpressions.
  2. Enable Expression Engine Sprites and Expression Avatars.
  3. Select a sprite owner in chat settings.
  4. Trigger an expression change through Expression Engine or run /emote before the first assistant reply in a chat.
  5. Inspect visual state and message extra: the overlay can use owner-keyed state while expression avatars fall back, and legacy chat-level expression state is ignored.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: refactor-line checkout inspected at 84f40efd
  • Run mode: Static code parity audit only; app not launched
  • OS + version: Not relevant to static audit
  • Node + pnpm versions: Not run
  • Rust version, if relevant: Not run
  • Remote Runtime URL configured? Not relevant
  • Provider, model, or integration, if relevant: Expression Engine path; no provider call was run

Logs, screenshots, or video

No runtime logs or screenshots. Code evidence:

  • Refactor reads message-level sprite expressions without chat metadata fallback: src/features/modes/shared/chat-ui/hooks/use-sprite-metadata-state.ts:45
  • Refactor writes only last assistant message extra: src/features/modes/shared/chat-ui/hooks/use-sprite-metadata-state.ts:79
  • Refactor overlay maps agent character IDs to owner keys and persists those keys: src/features/runtime/visuals/components/SpriteOverlay.tsx:141, src/features/runtime/visuals/components/SpriteOverlay.tsx:160
  • Refactor expression avatar resolver checks raw character ID or name only: src/features/modes/roleplay/components/RoleplayModeRoute.tsx:253
  • Legacy roleplay chat read message extra first, then fell back to chat metadata: packages/client/src/components/chat/ChatArea.tsx:483
  • Legacy roleplay chat persisted sprite expressions to chat metadata and message extra: packages/client/src/components/chat/ChatArea.tsx:631

Regression notes

Legacy kept chat-level spriteExpressions as a backward-compatible fallback while also persisting per-message sprite expression state. Refactor moved toward message-scoped expression state, but did not keep the fallback/write path for older chats and manual expression changes. Refactor also introduced typed sprite owner keys for selected sprite owners, but expression avatar lookup has not fully followed that owner-key shape.

Additional context

Suggested repair order:

  1. Restore a chat metadata fallback for spriteExpressions, and keep a write fallback for manual commands when no assistant message exists.
  2. Normalize expression lookups over owner key, raw character ID, and character name for expression avatars and other runtime visual consumers.
  3. Coordinate with #1782, which tracks the related selected-owner generation filter issue.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Xelvanis on GitHub (Jun 1, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1802 Originally assigned to: @cha1latte on GitHub. ## Summary Static parity audit of `src/features/runtime/visuals` found runtime sprite expression state can desync on the refactor branch: 1. Roleplay sprite metadata no longer falls back to chat-level `spriteExpressions` and only writes message extra, unlike legacy. 2. Expression avatars check raw character IDs and names, while the overlay can persist selected-character expressions under owner keys such as `character:<id>`. 3. Related issue #1782 covers selected owner keys being filtered before generation. This issue focuses on runtime visual consumption, manual `/emote` persistence, and expression avatar state. ## Expected behavior - Existing chat-level `spriteExpressions` should still be honored for older chats and for manual expression changes before an assistant message exists. - Manual `/emote` and Expression Engine updates should visibly update both overlay sprites and expression avatars. - Owner-keyed expression maps should resolve consistently across the sprite overlay, expression avatars, and tracker consumers. ## Actual behavior - `use-sprite-metadata-state` reads the latest assistant message extra and returns `{}` when no message-level `spriteExpressions` are present, with no chat metadata fallback. - `persistSpriteExpressions` only patches the last assistant message extra. If no assistant message exists, a manual `/emote` call can report success while persisting no expression state. - `RoleplayModeRoute` expression avatar lookup checks `expressions[characterId]` and character name, but not `expressions[character:<id>]`. `SpriteOverlay` maps agent results to owner keys and passes those owner keys back to `onExpressionChange`. ## Steps to reproduce 1. Open a roleplay chat that has legacy chat metadata `spriteExpressions`, but whose latest assistant message has no `extra.spriteExpressions`. 2. Enable Expression Engine Sprites and Expression Avatars. 3. Select a sprite owner in chat settings. 4. Trigger an expression change through Expression Engine or run `/emote` before the first assistant reply in a chat. 5. Inspect visual state and message extra: the overlay can use owner-keyed state while expression avatars fall back, and legacy chat-level expression state is ignored. ## Impact area - [ ] App shell, navigation, startup, or providers - [ ] Catalog resources - [ ] Chat mode - [x] Roleplay mode - [ ] Game mode - [x] Shared mode UI - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [ ] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: refactor-line checkout inspected at `84f40efd` - Run mode: Static code parity audit only; app not launched - OS + version: Not relevant to static audit - Node + pnpm versions: Not run - Rust version, if relevant: Not run - Remote Runtime URL configured? Not relevant - Provider, model, or integration, if relevant: Expression Engine path; no provider call was run ## Logs, screenshots, or video No runtime logs or screenshots. Code evidence: - Refactor reads message-level sprite expressions without chat metadata fallback: `src/features/modes/shared/chat-ui/hooks/use-sprite-metadata-state.ts:45` - Refactor writes only last assistant message extra: `src/features/modes/shared/chat-ui/hooks/use-sprite-metadata-state.ts:79` - Refactor overlay maps agent character IDs to owner keys and persists those keys: `src/features/runtime/visuals/components/SpriteOverlay.tsx:141`, `src/features/runtime/visuals/components/SpriteOverlay.tsx:160` - Refactor expression avatar resolver checks raw character ID or name only: `src/features/modes/roleplay/components/RoleplayModeRoute.tsx:253` - Legacy roleplay chat read message extra first, then fell back to chat metadata: `packages/client/src/components/chat/ChatArea.tsx:483` - Legacy roleplay chat persisted sprite expressions to chat metadata and message extra: `packages/client/src/components/chat/ChatArea.tsx:631` ## Regression notes Legacy kept chat-level `spriteExpressions` as a backward-compatible fallback while also persisting per-message sprite expression state. Refactor moved toward message-scoped expression state, but did not keep the fallback/write path for older chats and manual expression changes. Refactor also introduced typed sprite owner keys for selected sprite owners, but expression avatar lookup has not fully followed that owner-key shape. ## Additional context Suggested repair order: 1. Restore a chat metadata fallback for `spriteExpressions`, and keep a write fallback for manual commands when no assistant message exists. 2. Normalize expression lookups over owner key, raw character ID, and character name for expression avatars and other runtime visual consumers. 3. Coordinate with #1782, which tracks the related selected-owner generation filter issue. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:22:55 +07:00
Author
Owner

@cha1latte commented on GitHub (Jun 1, 2026):

Fixed in #1836

<!-- gh-comment-id:4595484147 --> @cha1latte commented on GitHub (Jun 1, 2026): Fixed in #1836
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#884
No description provided.