[GH-ISSUE #353] [Issue]: Expression Engine retry produces invalid expressions; missing sprite validation in retry-agents path #150

Closed
opened 2026-10-20 17:25:40 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Lochalan on GitHub (May 2, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/353

Summary

Manually re-running the Expression Engine via the Agents & Actions re-run trackers button selects expressions that don't exist as sprite files. The sprite silently fails to update.

Expected behavior

When the Expression Engine is retried, it should only select expressions matching actual sprite image files in the character's sprites directory, and the sprite should visually update.

Actual behavior

The Expression Engine selects non-existent expressions (e.g. "intense_focus", "intrigued") because retry-agents-route.ts never loads _availableSprites into the agent context. The LLM receives no <available_sprites> list and hallucinates freely. Three issues:

  1. buildRetryAgentContext() never populates _availableSprites from the filesystem (the normal path in generate.routes.ts does)
  2. applyRetryResultEffects() has no sprite_change handler — no validation or persistence
  3. SSE agent_result is sent before validation, so the client receives raw unvalidated output

Steps to reproduce

  1. Set up a character with sprite files in the sprites directory
  2. Start a roleplay chat with that character
  3. With the Expression Engine Agent enabled, select the "Agents & Actions" button in the top left, then select "Re-run trackers"
  4. Observe the expression in the agent result tooltip — it frequently shows expressions with no matching sprite file
  5. The sprite does not change or changes inconsistently

Environment

  • Marinara Engine version: 1.5.6
  • Install type: source
  • OS + version: Windows 11
  • Browser or app shell: Chrome

Logs, screenshots, or video

Image

Additional context

The normal generation path in generate.routes.ts handles all three correctly — loads sprites (~L3377), validates (~L5772), and persists (~L5828). The retry path was missing all of it.

Template check

Please uncheck (untick) 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 @Lochalan on GitHub (May 2, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/353 ## Summary Manually re-running the Expression Engine via the Agents & Actions re-run trackers button selects expressions that don't exist as sprite files. The sprite silently fails to update. ## Expected behavior When the Expression Engine is retried, it should only select expressions matching actual sprite image files in the character's sprites directory, and the sprite should visually update. ## Actual behavior The Expression Engine selects non-existent expressions (e.g. "intense_focus", "intrigued") because `retry-agents-route.ts` never loads `_availableSprites` into the agent context. The LLM receives no `<available_sprites>` list and hallucinates freely. Three issues: 1. `buildRetryAgentContext()` never populates `_availableSprites` from the filesystem (the normal path in `generate.routes.ts` does) 2. `applyRetryResultEffects()` has no `sprite_change` handler — no validation or persistence 3. SSE `agent_result` is sent before validation, so the client receives raw unvalidated output ## Steps to reproduce 1. Set up a character with sprite files in the sprites directory 2. Start a roleplay chat with that character 3. With the Expression Engine Agent enabled, select the "Agents & Actions" button in the top left, then select "Re-run trackers" 4. Observe the expression in the agent result tooltip — it frequently shows expressions with no matching sprite file 5. The sprite does not change or changes inconsistently ## Environment - Marinara Engine version: 1.5.6 - Install type: source - OS + version: Windows 11 - Browser or app shell: Chrome ## Logs, screenshots, or video <img width="462" height="203" alt="Image" src="https://github.com/user-attachments/assets/bbd26b08-6633-4d3a-8b2f-e694fcc0c779" /> ## Additional context The normal generation path in `generate.routes.ts` handles all three correctly — loads sprites (~L3377), validates (~L5772), and persists (~L5828). The retry path was missing all of it. ## Template check Please **uncheck (untick)** 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-20 17:25:40 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@SpicyMarinara commented on GitHub (May 3, 2026):

Thank you for the PR, merging it!

<!-- gh-comment-id:4366375753 --> @SpicyMarinara commented on GitHub (May 3, 2026): Thank you for the PR, merging it!
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#150
No description provided.