[GH-ISSUE #2092] [Issue]: AI response body is lost after inline thinking block closes #1021

Closed
opened 2026-10-21 05:25:15 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @lanya-sketch on GitHub (Jun 3, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2092

Originally assigned to: @cha1latte on GitHub.

Summary

AI response body can be lost when a model outputs an inline reasoning/thinking block followed by the actual reply.

When the parser fails to split the closing reasoning tag from the post-tag content, the visible reply is swallowed into the thinking pane and the message content becomes empty.

Expected behavior

For an output like:

<thinking>
internal reasoning
</thinking>
This is the actual visible reply.

Expected result:

  • The thinking/reasoning pane contains only internal reasoning.
  • The message body/content contains This is the actual visible reply.
  • The final AI response is visible and saved normally.

Actual behavior

The text after the closing reasoning tag can be kept inside the thinking/reasoning pane instead of the message body.

As a result:

  • The message content becomes empty.
  • The UI may show an empty AI response.
  • The actual reply text can be lost or not saved as the message body.

Steps to reproduce

  1. Run Marinara Engine with streaming enabled.
  2. Use a model/provider that emits inline reasoning tags such as <thinking>...</thinking> or <think>...</think>.
  3. Trigger a response where the model outputs a reasoning block followed by normal visible reply text, for example:
<thinking>
reasoning text
</thinking>
visible reply text
  1. Observe that the visible reply text after the closing reasoning tag may be swallowed into the thinking pane and the message body may become empty.

Environment

  • Marinara Engine version: 1.6.1
  • Install type: source / docker / systemctl
  • OS + version: Ubuntu
  • Browser or app shell: Web browser

Logs, screenshots, or video

Relevant behavior:

Expected:
text after </thinking> -> message content

Actual:
closing tag is not matched correctly, so reasoning + the real reply are both kept as thinking.
content is left empty and lost.

Possible related cases:

<thinking>reasoning</thinking>reply
<think>reasoning</think>reply
<thinking>reasoning</think>reply
<think>reasoning</thinking>reply
</thinking>reply

Additional context

This seems related to inline thinking/reasoning tag parsing.

Likely edge cases:

  • <think> / <thinking> tag form differences
  • mismatched open/close tag forms
  • attributes or whitespace in reasoning tags
  • orphan closing reasoning tags followed by visible reply text
  • streaming output where a closing tag may be split across chunks

A possible fix is to preserve text after the final closing reasoning tag as message content, and avoid returning an empty message body when tokens were produced.

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 @lanya-sketch on GitHub (Jun 3, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2092 Originally assigned to: @cha1latte on GitHub. ## Summary AI response body can be lost when a model outputs an inline reasoning/thinking block followed by the actual reply. When the parser fails to split the closing reasoning tag from the post-tag content, the visible reply is swallowed into the thinking pane and the message content becomes empty. ## Expected behavior For an output like: ```xml <thinking> internal reasoning </thinking> This is the actual visible reply. ``` Expected result: * The thinking/reasoning pane contains only `internal reasoning`. * The message body/content contains `This is the actual visible reply.` * The final AI response is visible and saved normally. ## Actual behavior The text after the closing reasoning tag can be kept inside the thinking/reasoning pane instead of the message body. As a result: * The message content becomes empty. * The UI may show an empty AI response. * The actual reply text can be lost or not saved as the message body. ## Steps to reproduce 1. Run Marinara Engine with streaming enabled. 2. Use a model/provider that emits inline reasoning tags such as `<thinking>...</thinking>` or `<think>...</think>`. 3. Trigger a response where the model outputs a reasoning block followed by normal visible reply text, for example: ```xml <thinking> reasoning text </thinking> visible reply text ``` 4. Observe that the visible reply text after the closing reasoning tag may be swallowed into the thinking pane and the message body may become empty. ## Environment * Marinara Engine version: 1.6.1 * Install type: source / docker / systemctl * OS + version: Ubuntu * Browser or app shell: Web browser ## Logs, screenshots, or video Relevant behavior: ```txt Expected: text after </thinking> -> message content Actual: closing tag is not matched correctly, so reasoning + the real reply are both kept as thinking. content is left empty and lost. ``` Possible related cases: ```xml <thinking>reasoning</thinking>reply <think>reasoning</think>reply <thinking>reasoning</think>reply <think>reasoning</thinking>reply </thinking>reply ``` ## Additional context This seems related to inline thinking/reasoning tag parsing. Likely edge cases: * `<think>` / `<thinking>` tag form differences * mismatched open/close tag forms * attributes or whitespace in reasoning tags * orphan closing reasoning tags followed by visible reply text * streaming output where a closing tag may be split across chunks A possible fix is to preserve text after the final closing reasoning tag as message content, and avoid returning an empty message body when tokens were produced. ## 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-21 05:25:15 +07:00
  • closed this issue
  • added the
    in-pr
    bug
    labels
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#1021
No description provided.