PR: Extend delete overlays and clean companion parts during tool deletion#247
Open
VooDisss wants to merge 3 commits intoNeuralNomadsAI:devfrom
Open
PR: Extend delete overlays and clean companion parts during tool deletion#247VooDisss wants to merge 3 commits intoNeuralNomadsAI:devfrom
VooDisss wants to merge 3 commits intoNeuralNomadsAI:devfrom
Conversation
Delete step-finish parts for messages when tool badges are selected so usage chips disappear with the tool deletion flow in packages/ui/src/components/message-section.tsx.
…panion parts
When users select individual tool parts for bulk deletion (rather than
entire messages), the red delete overlay now correctly highlights
all related UI elements for that message — message headers, text parts,
and reasoning cards — providing clear visual feedback of what will be
removed.
Previously, selecting tool parts for deletion only highlighted the tool
call cards themselves. The message's text content and reasoning blocks
appeared unaffected, which was misleading because deleting the tool
parts leaves an incomplete message (an assistant response with no tool
output).
Changes by file:
message-block.tsx:
- Thread selectedToolPartKeys prop through MessageContentItem,
MessageBlock, and ReasoningCard component trees.
- ReasoningCard's isSelectedForDeletion now checks both
selectedMessageIds (whole-message selection) and
selectedToolPartKeys (tool-part selection via prefix match on
messageId:).
- Move the block-level selection highlight out of
isDeleteMessageHovered — responsibility is now at the part level
via data-delete-part-hover attributes, avoiding double overlays.
- ReasoningCard's root div gains data-delete-part-hover to render
the red overlay when its parent message has tool parts selected.
message-item.tsx:
- Accept new selectedToolPartKeys prop.
- isSelectedForDeletion uses the same prefix-match pattern to
detect tool-part selections.
- <header> element gains delete-hover-scope class and
data-delete-part-hover attribute for header-level overlay.
- Each .message-part-shell gains data-part-type and
data-delete-part-hover for per-part overlay on text content.
message-section.tsx:
- deleteSelectedMessages now also collects reasoning and text parts
from messages that have tool parts selected for deletion, and
deletes them alongside the tool parts. This prevents orphaned
assistant text/reasoning from remaining after tool removal.
- Guard condition simplified from
selectedToolPartIds.size === 0 || stepFinishPartIds.length === 0
to selectedToolPartIds.size === 0 to avoid short-circuiting when
no step-finish parts exist but reasoning/text parts do.
delete-overlays.css:
- Part-level overlay inset widened from -2px to -4px for consistency
with the message-level overlay.
- New rule for .message-reasoning-card[data-delete-part-hover] uses
inset: 0 for flush overlay within reasoning card boundaries.
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.
PR: Extend delete overlays and clean companion parts during tool deletion
Fixes: #246
Purpose
This PR addresses incomplete deletions when users bulk-delete specific tool calls from the timeline. Previously, deleting a tool part left behind orphaned reasoning logs (thinking tokens) and generated text parts, and the destructive hover overlay only highlighted the tool cards themselves.
This update ensures that deleting tool parts cleans up the entire associated response context (
step-finish,reasoning, andtextparts) from that message. It also extends the red delete overlay to message headers, reasoning cards, and text parts to accurately reflect the scope of deletion to the user.Changes by File
packages/ui/src/components/message-block.tsxselectedToolPartKeysprop throughMessageContentItem,MessageBlock, andReasoningCard.ReasoningCard'sisSelectedForDeletionlogic to check bothselectedMessageIds(whole message) andselectedToolPartKeys(tool-part selection via amessageId:prefix match).isDeleteMessageHoveredto be handled at the part level viadata-delete-part-hoverattributes avoiding double overlays.data-delete-part-hoverto theReasoningCard's rootdiv.packages/ui/src/components/message-item.tsxselectedToolPartKeysprop toMessageItemProps.isSelectedForDeletionusing the same prefix-match pattern to detect tool-part selections.<header>element now includes adelete-hover-scopeclass anddata-delete-part-hoverattribute to trigger the overlay at the header level..message-part-shellrendering text content now includesdata-part-typeanddata-delete-part-hoverfor per-part overlay highlighting.packages/ui/src/components/message-section.tsxdeleteSelectedMessagesbulk action. It now additionally collects and deletesstep-finish,reasoning, andtextparts when a message has its tool parts selected for deletion. This ensures no orphaned assistant content remains.selectedToolPartIds.size === 0 || stepFinishPartIds.length === 0down toselectedToolPartIds.size === 0, ensuring reasoning/text parts evaluate correctly even ifstep-finishparts are absent.packages/ui/src/styles/messaging/delete-overlays.css-2pxto-4pxfor visual consistency with the message-level overlay..message-reasoning-card[data-delete-part-hover]usinginset: 0for flush overlay rendering within reasoning card boundaries.