feat(fork): fork chat from any assistant message#4343
feat(fork): fork chat from any assistant message#4343waleedlatif1 merged 4 commits intostagingsimstudioai/sim:stagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Updates the Mothership chat UI to pass Reviewed by Cursor Bugbot for commit 4468099. Configure here. |
Greptile SummaryThis PR adds a Fork button to every assistant message in the Mothership chat, creating a new chat branched at that message with full state copied (messages, resources, Confidence Score: 5/5Safe to merge — no P0/P1 issues found; all previously flagged concerns have been resolved. All five files follow established project conventions (auth, query patterns, component structure). Previously raised concerns about config copying, fork-of-fork title accumulation, and signal forwarding have been addressed or confirmed as intentional design decisions. No new logic errors or security issues were found. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
actor User
participant UI as MessageActions (UI)
participant TQ as TanStack Query (useForkTask)
participant API as POST /api/mothership/chats/[chatId]/fork
participant DB as copilotChats DB
participant CS as Copilot Service
participant PubSub as taskPubSub
User->>UI: Clicks GitBranch (Fork) button
UI->>TQ: mutateAsync({ chatId, upToMessageId })
TQ->>API: POST /api/mothership/chats/[chatId]/fork
API->>API: authenticateCopilotRequestSessionOnly()
API->>DB: SELECT parent chat (verify ownership + type)
DB-->>API: parent row
API->>API: slice messages up to forkIdx
API->>DB: INSERT forked chat row (messages, resources, config, previewYaml...)
DB-->>API: { id, workspaceId }
API->>CS: POST /api/chats/fork (best-effort)
CS-->>API: 200 OK (or error, silently logged)
API->>PubSub: publishStatusChanged({ type: 'created' })
API->>API: captureServerEvent('task_forked')
API-->>TQ: { success: true, id: newId }
TQ->>TQ: onSettled → invalidateQueries(taskKeys.lists())
TQ-->>UI: result.id
UI->>UI: router.push(/workspace/.../task/newId)
Reviews (2): Last reviewed commit: "fix(fork): register task_forked PostHog ..." | Re-trigger Greptile |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 4468099. Configure here.
* feat(fork): fork chat from any assistant message * fix(fork): toast on failure, disabled opacity, copy previewYaml/planArtifact/config * fix(fork): type guard for mothership-only, prevent title accumulation on re-fork * fix(fork): register task_forked PostHog event type
Summary
Type of Change
Testing
Tested manually
Checklist