mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #643] [MERGED] Fix silent empty responses from OpenAI models #4710
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#4710
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/643
Author: @kolacheee
Created: 5/10/2026
Status: ✅ Merged
Merged: 5/10/2026
Merged by: @SpicyMarinara
Base:
main← Head:claude/objective-rhodes-ab4062📝 Commits (3)
5eb05d0Fix silent empty responses from OpenAI models (refusals, failures, incomplete)019fe5aMerge branch 'main' into claude/objective-rhodes-ab406208c7c7fAddress OpenAI refusal handling review📊 Changes
1 file changed (+87 additions, -6 deletions)
View changed files
📝
packages/server/src/services/llm/providers/openai.provider.ts(+87 -6)📄 Description
Linked Issue
Closes #644
Why this change
A user reported GPT-5.5 consistently returning empty responses. Investigation revealed multiple code paths where model responses could silently become empty — particularly when models refuse requests or when the Responses API returns non-standard completion states. While the specific GPT-5.5 case was routed through the Responses API (which already handled
response.refusal.delta), the Chat Completions paths had no refusal handling at all, and neither API path handled failure/incomplete states.What changed
delta.refusal(notdelta.content). The stream parser only checkeddelta.content, so refusal-only responses silently became 0-char empty responses shown to users as "The AI returned an empty response."response.failedandresponse.incompleteevent handling to Responses API streams. Previously these events were silently swallowed — if the API returned a failed or incomplete response, the user got an empty response with no diagnostic information in server logs.extractResponsesText()method now checks refusal content parts and the top-levelrefusalfield as fallbacks when no regular text output is found.Affected code paths (all in
openai.provider.ts)chat()streaming (Chat Completions)delta.refusalignoreddelta.refusalas textchatComplete()streaming (Chat Completions)delta.refusalignoreddelta.refusalinto contentchatComplete()non-streaming (Chat Completions)message.refusalignoredmessage.refusalwhencontentis nullextractResponsesText()(Responses API)refusalignoredchatResponses()streaming (Responses API)response.failed/response.incompletesilently swallowed; no fallback text extraction fromresponse.completedchatCompleteResponses()streaming (Responses API)response.refusal.deltahandler; noresponse.failed/response.incompletehandling; no fallback extractionValidation
[OpenAI Responses]warning messages when a response fails or is incompleteDocs and release impact
Summary by CodeRabbit
Bug Fixes
Summary by CodeRabbit
Release Notes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.