fix(chat): preserve markdown when copying messages - #6903
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Copy uses the same visible transcript tree as the UI ( Home and the workflow copilot panel pass workspace files into chat so file mentions can resolve on copy. Reviewed by Cursor Bugbot for commit c943386. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe PR preserves assistant-message Markdown during copying and converts parsed workspace resources into portable
Confidence Score: 4/5The PR is not yet safe to merge because visible file-resource links can still be dropped from copied Markdown while resource metadata is unavailable. File resource conversion depends on the asynchronously loaded workspace-file list and falls back to bare text whenever resolution misses, leaving the previously reported link-preservation failure reachable. Files Needing Attention: apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/copyable-markdown.ts and apps/sim/app/workspace/[workspaceId]/home/home.tsx
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/copyable-markdown.ts | Introduces Markdown-preserving copy serialization, but unresolved visible file resources still lose their links. |
| apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/mothership-chat.tsx | Connects rendered message text and workspace-file metadata to the copy action. |
| apps/sim/app/workspace/[workspaceId]/home/components/message-content/message-content.tsx | Extracts copyable text from the same visible segment tree used by transcript rendering. |
| apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content/workspace-resource-markdown.ts | Centralizes workspace-resource labels, display links, and inline spacing behavior. |
| apps/sim/app/workspace/[workspaceId]/components/message-actions/message-actions.tsx | Replaces plain-text stripping with injectable Markdown copy preparation. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Rendered assistant message] --> B[getRenderableMessageText]
B --> C[sanitize and parse special tags]
C --> D{Workspace resource?}
D -->|No| E[Preserve Markdown text]
D -->|Yes| F[Resolve canonical resource ID]
F -->|Resolved| G[Portable sim Markdown link]
F -->|Unresolved| H[Bare label]
E --> I[Clipboard]
G --> I
H --> I
Reviews (4): Last reviewed commit: "fix(chat): copy only rendered subagent t..." | Re-trigger Greptile
|
@cursor review |
|
@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 e066200. Configure here.
e066200 to
d409b0d
Compare
|
@cursor review |
| const resource = resolveWorkspaceResourceRef({ ...data, title: label }, workspaceFiles) | ||
| return resource ? toSimMarkdownLink(resource.type, resource.id, label) : label |
There was a problem hiding this comment.
Unresolved file links are dropped
When a message is copied before the workspace-file query contains a matching file, resolveWorkspaceResourceRef returns no resource and this branch serializes the visible file reference as its bare label, causing the copied Markdown to lose the resource link and destination.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c943386. Configure here.
| ): string { | ||
| const label = workspaceResourceLabel(data) | ||
| const resource = resolveWorkspaceResourceRef({ ...data, title: label }, workspaceFiles) | ||
| return resource ? toSimMarkdownLink(resource.type, resource.id, label) : label |
There was a problem hiding this comment.
Escaped links break chat paste
Medium Severity
Copied resources are serialized with toSimMarkdownLink, which backslash-escapes \, [, and ] in labels. The chat composer’s parseChipLinks expects unescaped [label](sim:kind/id) links and does not unescape. Titles with those characters therefore fail to round-trip into chips on paste, even though the PR presents these links as the portable chat format.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit c943386. Configure here.


Summary
Type of Change
Testing
bun run type-checkbun run lint:checkbun run lintbun run check:auditsorigin/stagingChecklist