Skip to content

[Reference Only] Upstream PR #286 - Fix: SSE data: [DONE] sentinel for non-streaming requests (complements PR #285) - #9

Draft
nsalvacao wants to merge 1 commit into
masterfrom
upstream-prs/pr-286
Draft

nsalvacao wants to merge 1 commit into
masterfrom
upstream-prs/pr-286

Conversation

@nsalvacao

@nsalvacao nsalvacao commented Mar 16, 2026 •

Copy link
Copy Markdown

Context

This draft PR mirrors upstream branch 'upstream-prs/pr-286' into 'master' for review, provenance, and later decision-making only.
It must not be merged wholesale. If we adopt anything from it, the intended path is commit-level intake only.

Upstream Source

Current Intake Recommendation

  • Decision: Reference only / absorbed-noop
  • Status: Planned review only, with no integration performed yet
  • Credit policy: preserve original author metadata, use git cherry-pick -x for any later intake, and keep any conflict adaptation in separate follow-up commits with explicit upstream attribution

Selected Commits For Any Future Intake

  • No direct intake currently selected. Equivalent behavior appears already represented in current master.

Skipped / Excluded Scope

  • Direct intake skipped: current assessment is absorbed_noop.

Acceptance Gates

  • Do not merge this mirrored branch as-is.
  • If anything is adopted later, intake only the explicitly selected commits or a newly re-validated subset.
  • Preserve upstream authorship and provenance in Git history.
  • Keep conflict-resolution/adaptation commits separate from upstream-authored commits.
  • Reconfirm branch contents against current master at intake time before changing the selected scope.

Verification / Validation Checklist

  • Non-streaming response handling already emits the correct terminal SSE sentinel in current master.
  • No further action is taken unless a concrete residual gap is demonstrated.

Review Focus

  • Confirm current master already ends non-streaming SSE flows correctly
  • Confirm no residual delta merits cherry-pick revival

Notes

  • This PR is intentionally draft and serves as a reviewable reference mirror inside the fork.
  • Current recommendation is to keep it unmerged unless a missing residual commit is proven.

CRITICAL FIX for AI SDK compatibility:

**Problem:** 9router emitted 'data: [DONE]\n\n' even for non-streaming
requests, causing AI SDK and other clients to fail JSON parsing.

**Root Cause:** AI SDK's generateObject() sends stream: undefined (not false).
The check stream !== false evaluated to true when stream was undefined,
causing the SSE sentinel to be emitted incorrectly.

**Solution:** Changed check from stream !== false to stream === true in:
- open-sse/utils/stream.js (PASSTHROUGH mode + flush function)
- open-sse/executors/github.js (TransformStream)

Now data: [DONE] is ONLY emitted when explicitly streaming (stream: true).

**Related:** This PR builds on decolua#285 (already merged) which added
response_format support for Claude. Together these fixes enable full
AI SDK structured output compatibility.

Fixes AI SDK generateObject() and all structured output clients.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants