[PR #672] [MERGED] Fix OpenAI ChatGPT chatComplete SSE parsing #4722

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

📋 Pull Request Information

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

Base: main ← Head: fix/openai-chatgpt-chatcomplete-sse


📝 Commits (1)

  • 550f3fa Fix OpenAI ChatGPT chatComplete SSE parsing

📊 Changes

2 files changed (+51 additions, -2 deletions)

View changed files

📝 packages/server/src/services/llm/providers/openai.provider.ts (+3 -2)
📝 packages/server/test/openai-provider-reasoning.test.ts (+48 -0)

📄 Description

Linked issue

Follow-up to #670 after review feedback on the merged OpenAI (ChatGPT) provider fix.

Why this change

  • #670 fixed the OpenAI (ChatGPT) request shape by forcing ChatGPT/Codex Responses requests to stream.
  • The chatCompleteResponses() path still used the caller's stream:false preference to choose the non-streaming JSON parser.
  • That left non-streaming chatComplete() calls able to receive SSE from Codex but parse it as JSON.

What changed

  • Forces chatCompleteResponses() to parse OpenAI (ChatGPT) Responses results as SSE even when the caller requested non-streaming output.
  • Adds a defensive !isOpenAIChatGPT guard around the Responses OpenRouter provider override.
  • Adds a regression test that stubs a multi-event SSE response and verifies chatComplete(... stream:false ...) decodes the full text.

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

  • Focused regression passed: pnpm exec tsx --import ./test/setup-env.ts --test --test-name-pattern "OpenAI ChatGPT chatComplete decodes SSE when caller requests non-streaming" test/openai-provider-reasoning.test.ts.
  • Baseline validation passed: pnpm check.
  • Diff hygiene passed: git diff --check.
  • Server logging hygiene passed: rg -n "console\\." packages/server/src/services/llm/providers/openai.provider.ts found no console statements.
  • No UI/manual browser verification is applicable; this is a backend provider response parsing fix.

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, schema, dependency, version, or release metadata changes.

UI evidence (if applicable)

N/A - backend provider response parsing fix.


🔄 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/672 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/11/2026 **Status:** ✅ Merged **Merged:** 5/11/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `main` ← **Head:** `fix/openai-chatgpt-chatcomplete-sse` --- ### 📝 Commits (1) - [`550f3fa`](https://github.com/Pasta-Devs/Marinara-Engine/commit/550f3faa2be834b3d72c4f7b12044ad02920ffdb) Fix OpenAI ChatGPT chatComplete SSE parsing ### 📊 Changes **2 files changed** (+51 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/llm/providers/openai.provider.ts` (+3 -2) 📝 `packages/server/test/openai-provider-reasoning.test.ts` (+48 -0) </details> ### 📄 Description ## Linked issue Follow-up to #670 after review feedback on the merged OpenAI (ChatGPT) provider fix. ## Why this change - #670 fixed the OpenAI (ChatGPT) request shape by forcing ChatGPT/Codex Responses requests to stream. - The `chatCompleteResponses()` path still used the caller's `stream:false` preference to choose the non-streaming JSON parser. - That left non-streaming `chatComplete()` calls able to receive SSE from Codex but parse it as JSON. ## What changed - Forces `chatCompleteResponses()` to parse OpenAI (ChatGPT) Responses results as SSE even when the caller requested non-streaming output. - Adds a defensive `!isOpenAIChatGPT` guard around the Responses OpenRouter provider override. - Adds a regression test that stubs a multi-event SSE response and verifies `chatComplete(... stream:false ...)` decodes the full text. ## 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 - Focused regression passed: `pnpm exec tsx --import ./test/setup-env.ts --test --test-name-pattern "OpenAI ChatGPT chatComplete decodes SSE when caller requests non-streaming" test/openai-provider-reasoning.test.ts`. - Baseline validation passed: `pnpm check`. - Diff hygiene passed: `git diff --check`. - Server logging hygiene passed: `rg -n "console\\." packages/server/src/services/llm/providers/openai.provider.ts` found no console statements. - No UI/manual browser verification is applicable; this is a backend provider response parsing fix. ## 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, schema, dependency, version, or release metadata changes. ## UI evidence (if applicable) N/A - backend provider response parsing fix. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:10:07 +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#4722
No description provided.