mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #1048] [MERGED] Fix GPT provider response shape handling #4900
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#4900
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/1048
Author: @cha1latte
Created: 5/20/2026
Status: ✅ Merged
Merged: 5/20/2026
Merged by: @cha1latte
Base:
staging← Head:fix/issue-1042-gpt-empty-response-v2📝 Commits (1)
d52ba7dFix GPT provider response shape handling📊 Changes
1 file changed (+176 additions, -108 deletions)
View changed files
📝
packages/server/src/services/llm/providers/openai.provider.ts(+176 -108)📄 Description
Linked issue
Closes #1042
Why this change
Cannot read properties of undefined (reading '0')when an OpenAI-compatible provider returned an HTTP-200 error payload withoutchoices.What changed
choicesparsing so malformed/error payloads report a clear provider error instead of throwing a raw TypeError.contentparts withtype: "text"and streamedresponse.text.deltaevents.status: "failed"as an actionable provider error while preserving existingoutput_text, refusal, usage, and normal Chat Completions behavior.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
packages\server\node_modules\.bin\tsx.cmd scratch\issue-1042-openai-provider-repro.ts --expect-broken: Responsestype: "text"returnednull,response.text.deltastreamed an empty string, and the no-choicesprovider payload threwCannot read properties of undefined (reading '0').packages\server\node_modules\.bin\tsx.cmd scratch\issue-1042-openai-provider-repro.ts; it passed with text extracted from alternate Responses parts, streamedresponse.text.delta, a clear missing-choices provider error, normaloutput_textextraction, failed Responses status handling, and normal custom Chat Completions.pnpm check; impeccable context, lint, shared/server/client builds all passed.Docs and release impact
UI evidence (if applicable)
N/A - no UI changes.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.