[GH-ISSUE #1504] Roleplay generation actions can persist blank assistant messages or swipes when visible output is empty #754

Closed
opened 2026-10-20 17:32:56 +07:00 by bsakaguchi · 3 comments
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Roleplay generation can persist a visible assistant message with empty content when the provider stream produces reasoning/thinking metadata but no visible response text.

This came out of the Roleplay smoke/audit follow-up for #1486.

Native QA repro

Environment: native Tauri QA app, isolated QA identifier, LM Studio localhost server on 127.0.0.1:1234, custom OpenAI-compatible connection using google/gemma-4-e4b.

  1. Create/open a Roleplay chat using the LM Studio custom connection.
  2. Send a long Roleplay prompt, then click Stop while the assistant is still showing the transient Thinking... placeholder.
  3. Confirm the placeholder is removed and the user message remains persisted.
  4. With the input empty and the last persisted message still being the user message, click the send button again to retry.
  5. The retry completes with an assistant row that has empty visible content, but extra.thinking, generationPromptSnapshot, and generationPromptSnapshotsBySwipe are present.

Observed UI: a blank assistant message renders in the transcript after retry.

Observed storage shape from the QA profile:

{
  "role": "assistant",
  "content": "",
  "extraKeys": [
    "chatSummaryFingerprint",
    "generationPromptSnapshot",
    "generationPromptSnapshotsBySwipe",
    "thinking"
  ]
}

Expected

If the visible assistant content is empty after provider/post-processing, generation should not create a blank assistant transcript row. It should either surface a recoverable generation error, keep the retry affordance, or store a meaningful assistant response.

Thinking/reasoning metadata should not be enough by itself to make the turn look successful.

Likely owner

Generation persistence/failure-path contract:

  • src/engine/generation/start-generation.ts creates assistant messages in saveAssistantMessage without guarding empty visible content.
  • src/features/runtime/generation/hooks/use-generate.ts treats the generation as complete once the engine returns, so the UI ends up with a blank assistant row instead of a visible failure/retry state.
  • Provider stream parsing can emit thinking chunks separately from visible token chunks, so this path is reachable when the provider returns reasoning-only output, maxes out during reasoning, or post-processing strips all visible text.

Notes

Duplicate check before filing did not find an open issue for blank assistant output, empty assistant message, reasoning thinking blank roleplay, thinking metadata, or empty content generation.

Originally created by @Xelvanis on GitHub (May 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1504 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Roleplay generation can persist a visible assistant message with empty `content` when the provider stream produces reasoning/thinking metadata but no visible response text. This came out of the Roleplay smoke/audit follow-up for #1486. ## Native QA repro Environment: native Tauri QA app, isolated QA identifier, LM Studio localhost server on `127.0.0.1:1234`, custom OpenAI-compatible connection using `google/gemma-4-e4b`. 1. Create/open a Roleplay chat using the LM Studio custom connection. 2. Send a long Roleplay prompt, then click Stop while the assistant is still showing the transient `Thinking...` placeholder. 3. Confirm the placeholder is removed and the user message remains persisted. 4. With the input empty and the last persisted message still being the user message, click the send button again to retry. 5. The retry completes with an assistant row that has empty visible `content`, but `extra.thinking`, `generationPromptSnapshot`, and `generationPromptSnapshotsBySwipe` are present. Observed UI: a blank assistant message renders in the transcript after retry. Observed storage shape from the QA profile: ```json { "role": "assistant", "content": "", "extraKeys": [ "chatSummaryFingerprint", "generationPromptSnapshot", "generationPromptSnapshotsBySwipe", "thinking" ] } ``` ## Expected If the visible assistant content is empty after provider/post-processing, generation should not create a blank assistant transcript row. It should either surface a recoverable generation error, keep the retry affordance, or store a meaningful assistant response. Thinking/reasoning metadata should not be enough by itself to make the turn look successful. ## Likely owner Generation persistence/failure-path contract: - `src/engine/generation/start-generation.ts` creates assistant messages in `saveAssistantMessage` without guarding empty visible content. - `src/features/runtime/generation/hooks/use-generate.ts` treats the generation as complete once the engine returns, so the UI ends up with a blank assistant row instead of a visible failure/retry state. - Provider stream parsing can emit `thinking` chunks separately from visible `token` chunks, so this path is reachable when the provider returns reasoning-only output, maxes out during reasoning, or post-processing strips all visible text. ## Notes Duplicate check before filing did not find an open issue for `blank assistant output`, `empty assistant message`, `reasoning thinking blank roleplay`, `thinking metadata`, or `empty content generation`.
Author
Owner

@Xelvanis commented on GitHub (May 29, 2026):

Additional native QA repro from the same audit: the empty-input Roleplay Continue path can hit the same failure, not only retry.

After deleting the prior blank retry row in the isolated QA profile and leaving the last persisted message as an assistant, I clicked the empty send button. The app created a new assistant message with empty content, while extra.thinking, generationPromptSnapshot, and generationPromptSnapshotsBySwipe were populated. The transcript showed no visible assistant text for that turn.

This keeps the likely owner the same: generation persistence/failure-path handling should not treat thinking-only output as a successful visible assistant message.

<!-- gh-comment-id:4571932444 --> @Xelvanis commented on GitHub (May 29, 2026): Additional native QA repro from the same audit: the empty-input Roleplay `Continue` path can hit the same failure, not only retry. After deleting the prior blank retry row in the isolated QA profile and leaving the last persisted message as an assistant, I clicked the empty send button. The app created a new assistant message with empty `content`, while `extra.thinking`, `generationPromptSnapshot`, and `generationPromptSnapshotsBySwipe` were populated. The transcript showed no visible assistant text for that turn. This keeps the likely owner the same: generation persistence/failure-path handling should not treat thinking-only output as a successful visible assistant message.
Author
Owner

@Xelvanis commented on GitHub (May 29, 2026):

Additional native QA repro from the same audit: assistant Regenerate can persist an active blank swipe.

Flow:

  1. In the isolated native QA profile, leave a Roleplay chat with a valid assistant response as the latest message.
  2. Use empty-send Continue with a higher max token cap. This succeeds and persists a visible assistant continuation.
  3. Click the transcript Regenerate action for that latest assistant message.
  4. The target assistant message immediately switches to 2/2, active swipe index 1, with empty content.

Observed storage for the target assistant after waiting:

{
  "role": "assistant",
  "content": "",
  "swipeCount": 2,
  "activeSwipeIndex": 1,
  "swipes": [
    { "content": "The air in the tavern is thick and heavy..." },
    { "content": "", "extraKeys": ["chatSummaryFingerprint", "generationPromptSnapshot"] }
  ]
}

This is a no-visible-output variant of the same failure-path bug: the generation path should not treat an empty visible assistant output as a successful transcript row or active swipe, even when prompt metadata exists.

<!-- gh-comment-id:4571962579 --> @Xelvanis commented on GitHub (May 29, 2026): Additional native QA repro from the same audit: assistant Regenerate can persist an active blank swipe. Flow: 1. In the isolated native QA profile, leave a Roleplay chat with a valid assistant response as the latest message. 2. Use empty-send Continue with a higher max token cap. This succeeds and persists a visible assistant continuation. 3. Click the transcript Regenerate action for that latest assistant message. 4. The target assistant message immediately switches to `2/2`, active swipe index `1`, with empty `content`. Observed storage for the target assistant after waiting: ```json { "role": "assistant", "content": "", "swipeCount": 2, "activeSwipeIndex": 1, "swipes": [ { "content": "The air in the tavern is thick and heavy..." }, { "content": "", "extraKeys": ["chatSummaryFingerprint", "generationPromptSnapshot"] } ] } ``` This is a no-visible-output variant of the same failure-path bug: the generation path should not treat an empty visible assistant output as a successful transcript row or active swipe, even when prompt metadata exists.
Author
Owner

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

Addressed in b2cebc28 on refactor. Roleplay assistant persistence now rejects generations with no visible assistant content unless attachments exist, so thinking-only provider output cannot create a blank assistant message/swipe. Added a focused regression test covering a thinking-only stream while keeping the user message persisted.

<!-- gh-comment-id:4572042673 --> @SpicyMarinara commented on GitHub (May 29, 2026): Addressed in b2cebc28 on refactor. Roleplay assistant persistence now rejects generations with no visible assistant content unless attachments exist, so thinking-only provider output cannot create a blank assistant message/swipe. Added a focused regression test covering a thinking-only stream while keeping the user message persisted.
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#754
No description provided.