Revert "improvement(mothership): show continue options on abort"#3756
Conversation
This reverts commit b9926df.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview
Updates the message renderer to display "Stopped by user" for Written by Cursor Bugbot for commit 46274f2. Configure here. |
Greptile SummaryThis PR reverts #3746 ("show continue options on abort"), removing the Key changes:
One minor concern: The inline replacement in Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User clicks Stop] --> B[stopChatStream called]
B --> C[Cancel stream reader & abort controller]
C --> D[setIsSending false]
D --> E[setMessages: mark executing tools as cancelled\n+ push stopped block]
E --> F{wasSending?}
F -- Yes --> G[persistPartialResponse\nPOST stop endpoint with content only\nno CONTINUE_OPTIONS injected]
F -- No --> H[invalidateChatQueries]
G --> H
H --> I[UI shows Stopped by user label]
style E fill:#f9c74f,stroke:#f3722c
style G fill:#90be6d,stroke:#43aa8b
Reviews (1): Last reviewed commit: "Revert "improvement(mothership): show co..." | Re-trigger Greptile |
| setMessages((prev) => | ||
| prev.map((msg) => { | ||
| if (!msg.contentBlocks?.some((b) => b.toolCall?.status === 'executing')) return msg | ||
| const updated = msg.contentBlocks!.map((block) => { | ||
| if (block.toolCall?.status !== 'executing') return block | ||
| return { | ||
| ...block, | ||
| toolCall: { | ||
| ...block.toolCall, | ||
| status: 'cancelled' as const, | ||
| displayTitle: 'Stopped by user', | ||
| }, | ||
| } | ||
| }) | ||
| updated.push({ type: 'stopped' as const }) | ||
| return { ...msg, contentBlocks: updated } | ||
| }) | ||
| ) |
There was a problem hiding this comment.
stopped block added to every interrupted message, not just the last
The removed resolveInterruptedToolCalls was careful to append the stopped block only to the last assistant message and included a dedup guard (!blocks.some((b) => b.type === 'stopped')). The new inline logic unconditionally calls updated.push({ type: 'stopped' as const }) for every message that contains an 'executing' tool call.
In practice a single stream produces at most one assistant message with live tool calls, so the divergence is unlikely to trigger. But if prior assistant messages somehow retain an 'executing' status (e.g. after a reconnect or partial restore), each of them would receive its own stopped block, potentially rendering duplicate stop indicators in the UI. Adding the same dedup guard keeps the behaviour consistent with the pre-revert code:
| setMessages((prev) => | |
| prev.map((msg) => { | |
| if (!msg.contentBlocks?.some((b) => b.toolCall?.status === 'executing')) return msg | |
| const updated = msg.contentBlocks!.map((block) => { | |
| if (block.toolCall?.status !== 'executing') return block | |
| return { | |
| ...block, | |
| toolCall: { | |
| ...block.toolCall, | |
| status: 'cancelled' as const, | |
| displayTitle: 'Stopped by user', | |
| }, | |
| } | |
| }) | |
| updated.push({ type: 'stopped' as const }) | |
| return { ...msg, contentBlocks: updated } | |
| }) | |
| ) | |
| setMessages((prev) => | |
| prev.map((msg) => { | |
| if (!msg.contentBlocks?.some((b) => b.toolCall?.status === 'executing')) return msg | |
| const updated = msg.contentBlocks!.map((block) => { | |
| if (block.toolCall?.status !== 'executing') return block | |
| return { | |
| ...block, | |
| toolCall: { | |
| ...block.toolCall, | |
| status: 'cancelled' as const, | |
| displayTitle: 'Stopped by user', | |
| }, | |
| } | |
| }) | |
| if (!updated.some((b) => b.type === 'stopped')) { | |
| updated.push({ type: 'stopped' as const }) | |
| } | |
| return { ...msg, contentBlocks: updated } | |
| }) | |
| ) |
Reverts #3746