Skip to content

Revert "improvement(mothership): show continue options on abort"#3756

Merged
icecrasher321 merged 1 commit intostagingfrom
revert-3746-improvement/mothership-show-continue
Mar 25, 2026
Merged

Revert "improvement(mothership): show continue options on abort"#3756
icecrasher321 merged 1 commit intostagingfrom
revert-3746-improvement/mothership-show-continue

Conversation

@icecrasher321
Copy link
Collaborator

Reverts #3746

@vercel
Copy link

vercel bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Mar 25, 2026 4:04am

Request Review

@cursor
Copy link

cursor bot commented Mar 25, 2026

PR Summary

Medium Risk
Touches chat stop/persistence logic and how executing tool calls are marked cancelled, which could affect saved partial messages and the UI state after aborts.

Overview
Reverts the prior abort UX that auto-injected a "Continue" options block into stopped assistant messages.

use-chat.ts no longer appends <options> content when persisting partial responses and removes the finalize-time resolveInterruptedToolCalls logic; stop now only marks any executing tool calls as cancelled and appends a single stopped block with the label "Stopped by user".

Updates the message renderer to display "Stopped by user" for stopped segments, and bumps bun.lock with a new configVersion field.

Written by Cursor Bugbot for commit 46274f2. Configure here.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 25, 2026

Greptile Summary

This PR reverts #3746 ("show continue options on abort"), removing the CONTINUE_OPTIONS_CONTENT XML snippet and the resolveInterruptedToolCalls helper that automatically injected a "Continue" option into the chat after a user abort. The cosmetic improvement of labelling aborted streams as "Stopped by user" (instead of "Stopped") is intentionally kept.

Key changes:

  • use-chat.ts: Removes CONTINUE_OPTIONS_CONTENT, resolveInterruptedToolCalls, and all call sites. The stop/abort path now uses a simpler inline setMessages update that marks executing tool calls as 'cancelled' and appends a stopped block.
  • message-content.tsx: Retains the clearer "Stopped by user" label from the reverted PR.
  • bun.lock: Gains a configVersion: 0 field — format-only change.

One minor concern: The inline replacement in stopChatStream adds a stopped block to every message that contains an executing tool call, whereas the original helper restricted this to the last assistant message and had a dedup guard. In normal usage only one in-flight message exists at a time, so this is unlikely to cause visible issues, but it is a subtle behavioural divergence worth addressing.

Confidence Score: 5/5

  • Safe to merge — straightforward revert with one minor non-blocking style concern.
  • The PR cleanly removes a feature (continue-options-on-abort) and retains a minor cosmetic improvement. The only divergence from the pre-improvement(mothership): show continue options on abort #3746 state is the missing dedup guard in the inline tool-cancellation logic, which has no impact under normal single-stream usage.
  • No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts Removes CONTINUE_OPTIONS_CONTENT, the resolveInterruptedToolCalls helper, and related stop-flow wiring. The replacement inline logic in stopChatStream correctly cancels executing tool calls but adds a stopped block to every interrupted message rather than only the last, missing the original dedup guard.
apps/sim/app/workspace/[workspaceId]/home/components/message-content/message-content.tsx One-word label change from "Stopped" to "Stopped by user" — clean cosmetic improvement retained from the reverted PR.
bun.lock Adds configVersion: 0 field — standard lockfile format update, no functional impact.

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
Loading

Reviews (1): Last reviewed commit: "Revert "improvement(mothership): show co..." | Re-trigger Greptile

Comment on lines +1438 to +1455
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 }
})
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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:

Suggested change
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 }
})
)

@icecrasher321 icecrasher321 merged commit b497033 into staging Mar 25, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the revert-3746-improvement/mothership-show-continue branch March 25, 2026 04:18
Sg312 pushed a commit that referenced this pull request Mar 25, 2026
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.

1 participant