Repository navigation
Fix SDK 0.16 stream completion at DONE (LAN-873) - #92
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A complete tool response can remain pending after the server sends
[DONE]if the HTTP connection stays open. Finish the SDK stream at that terminal SSE event and cancel the response body without waiting for cancellation to settle. Keep reading pastfinish_reasonso later token usage is preserved.Bumps the package to 0.16.22 and adds its changelog entry. Publishing will follow review and is not performed by this PR.
Addresses LAN-873 for SDK 0.16.x / Vercel AI SDK 4, the compatibility line used by Macaly. The equivalent SDK 1.x / AI SDK 5 fix is PR #93, targeting main.
Validation: all 193 offline tests pass on Node 18.20.8, 20.20.2 and 24.14.1 (nine live tests skipped per run). TypeScript, build/declarations, ESM/CommonJS loading, formatting and diff checks pass. Three real-HTTP completion regressions fail against the base implementation and pass with the fix. Expanded coverage includes ten active cancellation races, pre-header/silent/partial-event cancellation, socket resets, parallel tools, signed reasoning, delayed/zero usage and 200 randomized SSE layouts. The split-BOM regression failed before the additional framing correction.
Macaly's exact patched AI SDK 4.3.16/provider-utils 2.2.6 combination passes all 94 bridge tests. Built SDK artifacts were exercised against six staging provider routes, including native Anthropic/Google, OpenRouter and Bedrock Sonnet/Opus: text, tool continuation, non-streaming generation, client cancellation and invalid-model errors pass for both SDK versions. Across both versions and structured-output reruns, 98 HTTP requests have 98 matching saved logs. Five corrected structured-output cases failed; replaying all 24 structured-output responses through base and patched SDKs produced identical results. Existing native-Gemini usage and hosted upstream-cancellation limitations remain.
Publishing a 0.16 patch and updating Macaly remain separate release steps. This does not add deadlines, repair missing terminal bytes, or implement LAN-875.
CI now runs on PRs targeting
v0.16.xas well asmain. Live generation tests explicitly usegpt-6-luna, overriding the deployed fixtures' retired model. CI passed onc8114a3: all 202 tests, including the live tests, plus TypeScript, package build and CommonJS/ESM conversion checks.