Fix duplicate DOM ids in chat_ui tool-call partials#802
Open
edudepetris wants to merge 2 commits into
Open
Conversation
The chat_ui tool-call partial was rendered once per tool call used the parent message id, which caused duplicated ids when a single assistant message contained multiple tool calls (when parellel tool calling happens). Use tool_call.id as the element id source so each rendered tool-call row has a unique id. Also update id prefixes to keep tool_call and tool_result ids distinct from message ids.
Author
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #802 +/- ##
==========================================
+ Coverage 88.47% 88.48% +0.01%
==========================================
Files 122 122
Lines 5898 5898
Branches 1405 1405
==========================================
+ Hits 5218 5219 +1
+ Misses 680 679 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
What this does
Fix #804
When an assistant message has multiple tool calls, the chat_ui tool-call partial renders each one with the same id because it uses the parent message's id instead of the individual call's id. That's invalid HTML (the
idattribute must be unique in a document)The bug only surfaces with parallel tool calls (multiple calls per message). Sequential calling produces one call per message, keeping ids naturally unique.
Use tool_call.id for the element id (it's unique and already available in the partial). Namespace ids with tool_call and tool_result prefixes to keep them distinct from message ids.
Before:
After:
Type of change
Scope check
Required for new features
N/A — bug fix.
Quality check
overcommit --installand all hooks passbundle exec rspecmodels.json,aliases.json)AI-generated code
API changes