fix(tanstack-ai): avoid duplicate tool call ids#424
Merged
threepointone merged 4 commits intomainfrom Mar 18, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 60dd5db The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
- Change generateId to use 'chatcmpl' prefix and truncated UUID format - Generate unique IDs per tool call index instead of trusting backend IDs - Track tool call state across chunks to ensure stable IDs in streaming - Update test assertions to expect 'chatcmpl-' prefix instead of 'workers-ai-' - Change default test script to run once, add test:watch for watch mode
- Create ToolCallDisplay component with collapsible UI for tool calls - Show tool name, arguments, and results in formatted JSON - Add expand/collapse button with rotation animation - Match tool calls with their results using toolCallId - Skip rendering standalone tool-result parts (already shown in tool-call) - Style differently for user vs assistant messages - Add formatJson helper to pretty-print JSON strings
Stop forcing tool call IDs through a 9-char alphanumeric sanitization step used for Workers AI binding compatibility. The sanitizeToolCallId function and its uses were removed; IDs are now passed through as-provided, and generated fallback IDs are derived per tool-call index (e.g. `call${streamId}${tcIndex}`) to avoid duplicates. Tests and E2E expectations were updated to reflect the new behavior. Also removed a stray console.log in the example and re-enabled a commented provider entry; the changeset message was updated to explain the ID-generation change.
39a9405 to
60dd5db
Compare
threepointone
approved these changes
Mar 18, 2026
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.
Previously, all tool call ids were
chatcmplt, which made new tool call requests and responses get appended to previous parts. This fixes it so all tool calls have unique tool call ids, same as workers-ai-provider.