fix: preserve anthropic assistant ids in tool-first streams#480
fix: preserve anthropic assistant ids in tool-first streams#480shaked-frame wants to merge 6 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR adds a changeset file documenting a fix for AG-UI stream handling. Tool call start events now include ChangesStream Stability Fix Release Notes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
05bd931 to
7c7945c
Compare
|
rebased and pushed after resolving conflicts |
Bind TOOL_CALL_START to the stream's stable assistant message id via AG-UI `parentMessageId` in every text adapter, so a tool call that streams before any text no longer forces the assistant message id to change mid-stream (which destabilises UIMessage.id and can remount the message subtree in useChat). Fixes TanStack#477. Extends TanStack#480 (Anthropic only) to: - @tanstack/openai-base (Responses + Chat Completions) - @tanstack/ai-openrouter (Responses + Chat Completions) - @tanstack/ai-gemini (text + experimental text-interactions) - @tanstack/ai-ollama Adds a tool-first regression per adapter asserting the TOOL_CALL_START parentMessageId equals the TEXT_MESSAGE_START messageId. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bind TOOL_CALL_START to the stream's stable assistant message id via AG-UI `parentMessageId` in every text adapter, so a tool call that streams before any text no longer forces the assistant message id to change mid-stream (which destabilises UIMessage.id and can remount the message subtree in useChat). Fixes TanStack#477. Extends TanStack#480 (Anthropic only) to: - @tanstack/openai-base (Responses + Chat Completions) - @tanstack/ai-openrouter (Responses + Chat Completions) - @tanstack/ai-gemini (text + experimental text-interactions) - @tanstack/ai-ollama Adds a tool-first regression per adapter asserting the TOOL_CALL_START parentMessageId equals the TEXT_MESSAGE_START messageId. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
d24a601 to
b79fc03
Compare
tombeckenham
left a comment
There was a problem hiding this comment.
Thanks for this. I fixed it in the rest of the adpaters as well.
|
View your CI Pipeline Execution ↗ for commit b79fc03
☁️ Nx Cloud last updated this comment at |
@tanstack/ai
@tanstack/ai-anthropic
@tanstack/ai-client
@tanstack/ai-code-mode
@tanstack/ai-code-mode-skills
@tanstack/ai-devtools-core
@tanstack/ai-elevenlabs
@tanstack/ai-event-client
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@tanstack/ai-groq
@tanstack/ai-isolate-cloudflare
@tanstack/ai-isolate-node
@tanstack/ai-isolate-quickjs
@tanstack/ai-mcp
@tanstack/ai-ollama
@tanstack/ai-openai
@tanstack/ai-openrouter
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-react-ui
@tanstack/ai-solid
@tanstack/ai-solid-ui
@tanstack/ai-svelte
@tanstack/ai-utils
@tanstack/ai-vue
@tanstack/ai-vue-ui
@tanstack/openai-base
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
commit: |
Summary
parentMessageIdto AnthropicTOOL_CALL_STARTchunks so tool-first streams bind to the eventual assistant message id immediatelyTEXT_MESSAGE_STARTparentMessageIdpreserve a single assistant message instead of creating a temporary local idfixes #477
Verification
pnpm exec vitest run packages/typescript/ai/tests/stream-processor.test.tspnpm test:lib -- --runInBandinpackages/typescript/aistream-processorregression passed@tanstack/ai-event-client,examples/ts-svelte-chat/.svelte-kit/tsconfig.json)pnpm test:lib -- --runInBandinpackages/typescript/ai-anthropic@tanstack/aipackage-entry resolution issue before the adapter test file runsSummary by CodeRabbit
Release Notes