Skip to content

PR: Extend delete overlays and clean companion parts during tool deletion#247

Open
VooDisss wants to merge 3 commits intoNeuralNomadsAI:devfrom
VooDisss:Delete_step-finish_parts_remainings
Open

PR: Extend delete overlays and clean companion parts during tool deletion#247
VooDisss wants to merge 3 commits intoNeuralNomadsAI:devfrom
VooDisss:Delete_step-finish_parts_remainings

Conversation

@VooDisss
Copy link
Copy Markdown
Contributor

@VooDisss VooDisss commented Mar 25, 2026

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, and text parts) 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.tsx

  • Threaded the selectedToolPartKeys prop through MessageContentItem, MessageBlock, and ReasoningCard.
  • Updated ReasoningCard's isSelectedForDeletion logic to check both selectedMessageIds (whole message) and selectedToolPartKeys (tool-part selection via a messageId: prefix match).
  • Moved the block-level selection highlight out of isDeleteMessageHovered to be handled at the part level via data-delete-part-hover attributes avoiding double overlays.
  • Added data-delete-part-hover to the ReasoningCard's root div.

packages/ui/src/components/message-item.tsx

  • Added the selectedToolPartKeys prop to MessageItemProps.
  • Expanded isSelectedForDeletion using the same prefix-match pattern to detect tool-part selections.
  • The <header> element now includes a delete-hover-scope class and data-delete-part-hover attribute to trigger the overlay at the header level.
  • Each .message-part-shell rendering text content now includes data-part-type and data-delete-part-hover for per-part overlay highlighting.

packages/ui/src/components/message-section.tsx

  • Updated the deleteSelectedMessages bulk action. It now additionally collects and deletes step-finish, reasoning, and text parts when a message has its tool parts selected for deletion. This ensures no orphaned assistant content remains.
  • Simplified the deletion guard condition from selectedToolPartIds.size === 0 || stepFinishPartIds.length === 0 down to selectedToolPartIds.size === 0, ensuring reasoning/text parts evaluate correctly even if step-finish parts are absent.

packages/ui/src/styles/messaging/delete-overlays.css

  • Widened the part-level overlay inset from -2px to -4px for visual consistency with the message-level overlay.
  • Added a new rule for .message-reasoning-card[data-delete-part-hover] using inset: 0 for flush overlay rendering within reasoning card boundaries.

VooDisss added 3 commits March 7, 2026 11:08
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug / UX Issue: Incomplete deletion when removing tool calls from the timeline

1 participant