[PR #916] [MERGED] Fix game mode empty response recovery #4835

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/916
Author: @cha1latte
Created: 5/16/2026
Status: ✅ Merged
Merged: 5/16/2026
Merged by: @cha1latte

Base: staging ← Head: fix/game-empty-response


📝 Commits (1)

  • 096c8b6 Fix game mode thinking-only response recovery

📊 Changes

1 file changed (+8 additions, -9 deletions)

View changed files

📝 packages/server/src/routes/generate.routes.ts (+8 -9)

📄 Description

Linked issue

No linked GitHub issue. Bug report was provided directly in Codex; open an issue before final submission if the team wants every PR linked.

Why this change

  • Game mode can fail with The AI returned an empty response when an OpenAI-compatible provider returns usable GM narration in a reasoning/thinking field but no visible content.

What changed

  • Extends the existing thinking-only response recovery path to game mode.
  • Keeps the existing conversation behavior and GLM safety guard.
  • Leaves roleplay thinking-only responses unchanged.

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

  • Codex reproduced the failure with pnpm --dir packages/server exec tsx scratch/game-empty-response-repro.ts before the fix: the generated SSE included The AI returned an empty response and no assistant message was saved.
  • Codex re-ran the original repro after the fix: the generated SSE included content_replace, no empty-response error was emitted, and the assistant message was saved with the recovered narration.
  • Codex ran edge checks with the same scratch harness:
    • game visible-content response still saves normally
    • conversation thinking-only recovery still works
    • roleplay thinking-only response still errors as before
  • pnpm check passed locally.
  • Bunny review passed for the current diff.
  • No human-only verification is required for the core claim; the provider behavior is covered by the mocked OpenAI-compatible route repro.

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)

No docs or release metadata changes needed for this narrow server-side recovery fix.

UI evidence (if applicable)

N/A. The visible toast is caused by the server SSE error path; Codex verified the server /api/generate SSE and message persistence path directly with a focused scratch repro.


🔄 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/916 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/16/2026 **Status:** ✅ Merged **Merged:** 5/16/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `staging` ← **Head:** `fix/game-empty-response` --- ### 📝 Commits (1) - [`096c8b6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/096c8b6b734d50098e3404e86a8b063a042eeead) Fix game mode thinking-only response recovery ### 📊 Changes **1 file changed** (+8 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/generate.routes.ts` (+8 -9) </details> ### 📄 Description <!-- Target branch: `staging`. The default base in this UI is `main` (release branch). --> <!-- Change the base to `staging` before submitting unless this is a maintainer-approved mainline change. --> <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> No linked GitHub issue. Bug report was provided directly in Codex; open an issue before final submission if the team wants every PR linked. ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Game mode can fail with `The AI returned an empty response` when an OpenAI-compatible provider returns usable GM narration in a reasoning/thinking field but no visible `content`. ## What changed <!-- List the key changes in this PR --> - Extends the existing thinking-only response recovery path to game mode. - Keeps the existing conversation behavior and GLM safety guard. - Leaves roleplay thinking-only responses unchanged. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `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 <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> - Codex reproduced the failure with `pnpm --dir packages/server exec tsx scratch/game-empty-response-repro.ts` before the fix: the generated SSE included `The AI returned an empty response` and no assistant message was saved. - Codex re-ran the original repro after the fix: the generated SSE included `content_replace`, no empty-response error was emitted, and the assistant message was saved with the recovered narration. - Codex ran edge checks with the same scratch harness: - game visible-content response still saves normally - conversation thinking-only recovery still works - roleplay thinking-only response still errors as before - `pnpm check` passed locally. - Bunny review passed for the current diff. - No human-only verification is required for the core claim; the provider behavior is covered by the mocked OpenAI-compatible route repro. ## 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) No docs or release metadata changes needed for this narrow server-side recovery fix. ## UI evidence (if applicable) N/A. The visible toast is caused by the server SSE error path; Codex verified the server `/api/generate` SSE and message persistence path directly with a focused scratch repro. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:11:03 +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#4835
No description provided.