[PR #6388] fix: prevent truncated Claude streams #11877

Closed
opened 2026-02-16 18:16:49 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/6388

State: closed
Merged: Yes


Summary

  • Upgrade @ai-sdk/anthropic to 2.0.56 and align @ai-sdk/provider-utils to 3.0.19 to prevent intermittent end-of-response truncation seen with Claude models.

Context

Fixes #6382.

Note: this PR supersedes PR #6384, which was auto-closed when the head branch was renamed.

Details

The investigation suggests truncation happens upstream of OpenCode’s session aggregation/rendering: the final text-delta sometimes never arrives. @ai-sdk/anthropic@2.0.50 uses a ReadableStream.tee() + async cancel pattern in doStream() that can race with streaming consumption (runtime-dependent), potentially dropping tail chunks. 2.0.56 rewrites the first-chunk pulling logic to be synchronous/awaited and returns the consumer stream directly.

Testing

  • bun run typecheck
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6388 **State:** closed **Merged:** Yes --- ## Summary - Upgrade `@ai-sdk/anthropic` to `2.0.56` and align `@ai-sdk/provider-utils` to `3.0.19` to prevent intermittent end-of-response truncation seen with Claude models. ## Context Fixes #6382. Note: this PR supersedes PR #6384, which was auto-closed when the head branch was renamed. ## Details The investigation suggests truncation happens upstream of OpenCode’s session aggregation/rendering: the final `text-delta` sometimes never arrives. `@ai-sdk/anthropic@2.0.50` uses a `ReadableStream.tee()` + async cancel pattern in `doStream()` that can race with streaming consumption (runtime-dependent), potentially dropping tail chunks. `2.0.56` rewrites the first-chunk pulling logic to be synchronous/awaited and returns the consumer stream directly. ## Testing - `bun run typecheck`
yindo added the pull-request label 2026-02-16 18:16:49 -05:00
yindo closed this issue 2026-02-16 18:16:49 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11877