[PR #550] [MERGED] Promote misplaced thinking content to visible text #4669

Closed
opened 2026-10-22 04:09:38 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/550
Author: @Xelvanis
Created: 5/8/2026
Status: ✅ Merged
Merged: 5/8/2026
Merged by: @Xelvanis

Base: main ← Head: fix/convo-empty-response


📝 Commits (1)

  • ccbcfa8 Promote misplaced thinking content to visible text

📊 Changes

1 file changed (+30 additions, -7 deletions)

View changed files

📝 packages/server/src/routes/generate.routes.ts (+30 -7)

📄 Description

Some OpenAI-compatible providers put the actual assistant response in reasoning/thinking fields even when reasoning was not requested. When that happens in conversation mode, promote the thinking content to the visible response and log a warning.

Linked issue

No linked issue yet. TODO: open or link a bug report before marking this PR ready for review.

Why this change

  • Conversation mode can report an empty model response even when an OpenAI-compatible provider returned a natural assistant reply in a reasoning/thinking field.
  • This showed up in debug logs as LLM response (0 chars) with the actual reply under Thinking tokens, while reasoning was disabled (EnableThinking: false, Effort: none).
  • The result is confusing for users because the provider did answer, but Marinara treats the visible response as empty.

What changed

  • Capture provider thinking/reasoning chunks separately from the user-facing showThoughts buffer.
  • In Conversation mode only, promote thinking-only content into the visible response when visible text is empty and reasoning was not requested.
  • Keep existing Convo command parsing after promotion so any visible character commands in the recovered text are still parsed and stripped.
  • Clear the thinking buffer after promotion so recovered visible text is not also stored as thinking.

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

Manual verification notes

  • I was able to repro this issue a user on discord was having.
  • After implementing this fix/workaround, couldn't repro initial issue. The model conveniently started behaving itself, although logs still visibly show a "thinking" process before writing reply, so idk what that says about the whole enableThinking: False thing. Replies come back normal anyhow.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved handling of AI-generated responses containing reasoning-only content
    • Enhanced separation of internal reasoning from user-visible response text

🔄 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/550 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/8/2026 **Status:** ✅ Merged **Merged:** 5/8/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `main` ← **Head:** `fix/convo-empty-response` --- ### 📝 Commits (1) - [`ccbcfa8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ccbcfa8bc806588a57012ca68c96f872b0736369) Promote misplaced thinking content to visible text ### 📊 Changes **1 file changed** (+30 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/generate.routes.ts` (+30 -7) </details> ### 📄 Description Some OpenAI-compatible providers put the actual assistant response in reasoning/thinking fields even when reasoning was not requested. When that happens in conversation mode, promote the thinking content to the visible response and log a warning. ## Linked issue No linked issue yet. TODO: open or link a bug report before marking this PR ready for review. ## Why this change - Conversation mode can report an empty model response even when an OpenAI-compatible provider returned a natural assistant reply in a reasoning/thinking field. - This showed up in debug logs as `LLM response (0 chars)` with the actual reply under `Thinking tokens`, while reasoning was disabled (`EnableThinking: false`, `Effort: none`). - The result is confusing for users because the provider did answer, but Marinara treats the visible response as empty. ## What changed - Capture provider thinking/reasoning chunks separately from the user-facing `showThoughts` buffer. - In Conversation mode only, promote thinking-only content into the visible response when visible text is empty and reasoning was not requested. - Keep existing Convo command parsing after promotion so any visible character commands in the recovered text are still parsed and stripped. - Clear the thinking buffer after promotion so recovered visible text is not also stored as thinking. ## Validation - [X] `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) - [X] Above manual verification completed (describe below) - [X] Read and followed `CONTRIBUTING.md` ### Manual verification notes - I was able to repro this issue a user on discord was having. - After implementing this fix/workaround, couldn't repro initial issue. The model conveniently started behaving itself, although logs still visibly show a "thinking" process before writing reply, so idk what that says about the whole enableThinking: False thing. Replies come back normal anyhow. ## Docs and release impact - [X] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Bug Fixes** * Improved handling of AI-generated responses containing reasoning-only content * Enhanced separation of internal reasoning from user-visible response text <!-- 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-22 04:09:38 +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#4669
No description provided.