Fix Vercel AI SDK adapter bugs from code review #132
+994
−396
Claude / Claude Code Review
completed
May 11, 2026 in 12m 26s
Code review found 4 potential issues
Found 5 candidates, confirmed 4. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 2 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | adapter/vercelaisdk/uimessagestream/handler.go:341-351 |
PartToolResponse in handleContentPart skips span-closing (asymmetric with PartToolRequest) |
| 🟡 Nit | adapter/vercelaisdk/uimessagestream/handler_test.go:1621-1638 |
TestHandler_WithMaxBodyBytes does not actually exercise the body size limit |
Annotations
Check warning on line 351 in adapter/vercelaisdk/uimessagestream/handler.go
claude / Claude Code Review
PartToolResponse in handleContentPart skips span-closing (asymmetric with PartToolRequest)
The `PartToolResponse` case in `handleContentPart` (handler.go:353-354) passes through directly to `sw.writeToolResponse` without closing any open reasoning or text spans — the exact asymmetric-transition class of bug this PR fixes for the sibling `PartToolRequest` case. A sequence `Reasoning→ToolResponse` or `Text→ToolResponse` via `ContentPartEvent` (used by `StreamModel` to replay history) would emit `tool-output-available` with the span still open, then `reasoning-end`/`text-end` later, out
Check warning on line 1638 in adapter/vercelaisdk/uimessagestream/handler_test.go
claude / Claude Code Review
TestHandler_WithMaxBodyBytes does not actually exercise the body size limit
TestHandler_WithMaxBodyBytes does not actually exercise WithMaxBodyBytes: the body is 200 raw "x" characters which is invalid JSON, so json.Decoder.Decode fails on the first byte well before MaxBytesReader is approached. Since both error paths return 400 via the same http.Error call, the test would pass even if the option were ignored entirely. To make the assertion diagnostic, send valid JSON exceeding 100 bytes (or assert rec.Body specifically references the MaxBytesError).
Loading