[Bug]: Copying a text selection in chat replaces the clipboard with the entire session transcript
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 76/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- javascript
研究方向
先追蹤 resources/app/out/renderer/assets/index-6Mcp5Fcu.js 中的複製監聽器以及 ZK() 和 WK() 函式,接著找出它們在原始碼中的對應部分。在無頭 Chromium harness 中重現僅掛載一列的情況,並確認複製部分選取範圍時只保留該選取範圍,同時複製完整對話仍能正常運作。
由索引模型根據 Issue 內容生成。
描述
GUI version
0.1.35
Operating system
Windows
Reproduction steps
- Open the desktop app and open any chat that contains at least one assistant reply.
- Scroll so that the reply you want to copy is the only message row inside the rendered feed area. This is easiest with a long reply (e.g. one containing large code blocks), or with a short/split window.
- Select a small part of that reply with the mouse.
- Press Ctrl+C (or right-click -> Copy).
- Paste into any text editor.
Observed: the clipboard does not contain the selection. It contains the entire conversation,
serialized as:
User:
Assistant:
<all assistant text of that turn, tool calls stripped>
Selecting a different amount of text makes no difference, and the behavior is deterministic:
restarting the app and resizing the window do not change it once it starts happening.
To confirm the trigger condition, with a selection active run this in DevTools console:
const s = document.getSelection(), rows = document.querySelectorAll('[data-feed-row]');
[rows.length, s.containsNode(rows[0], true), s.containsNode(rows[rows.length-1], true)]
If rows.length is 1 while the session clearly contains many messages, the bug is being triggered.
Expected behavior
The clipboard contains exactly the text I selected, and nothing else.
Actual behavior
The clipboard is silently replaced with a full dump of the conversation in "User: ... Assistant: ..."
format, regardless of how small the selection was. The selected text is never copied.
Screenshots, recordings, or sanitized logs
Root cause found by inspecting the shipped renderer bundle
(resources/app/out/renderer/assets/index-6Mcp5Fcu.js).
The chat feed is a virtualized list, so [data-feed-row] elements only exist for the rows in the
current render window. A global copy listener rewrites the clipboard whenever it believes the
whole conversation is selected:
// is the whole conversation selected?
function ZK(e){
const t = e.ownerDocument.getSelection();
if (!t || t.rangeCount === 0 || t.isCollapsed) return false;
const n = e.querySelectorAll("[data-feed-row]"), r = n[0], a = n[n.length - 1];
return !r || !a ? false : t.containsNode(r, true) && t.containsNode(a, true);
}
// copy hook: replaces the clipboard
const r = a => {
if (a.defaultPrevented || !a.clipboardData || Gk(a.target)) return;
const s = e.current;
if (!Wk(s) || !ZK(s)) return;
const l = WK(t.current ?? []); // serializes ALL messages
l && (a.preventDefault(), a.clipboardData.setData("text/plain", l));
};
window.addEventListener("copy", r);
WK() is the serializer that produces the "User: ..." / "Assistant: ..." text.
The defect: ZK() takes "first row" and "last row" from querySelectorAll, i.e. only the rows the
virtualizer currently has mounted, not the whole conversation. When the render window contains
exactly one [data-feed-row], n[0] === n[n.length - 1], so selecting ANY text inside that single
row satisfies containsNode(first) && containsNode(last), and the clipboard is replaced with the
entire session. WK() uses the full message list, not the DOM, which is why the result is the
whole conversation even though only one row was visible.
Verified in a headless Chromium harness with the same DOM shape:
- 5 rows, selection inside the middle row -> containsNode(first)=false, containsNode(last)=false
- 5 rows, selection inside the last row -> false / true
- 1 row, selection inside it -> true / true (triggers)
Suggested fix: derive the check from the real row count (the list data length) instead of the
mounted DOM, or require the selection to start on the first data row and end on the last one.
Safety check
- I removed credentials and private project information from this report.
- 主要語言
- Shell
- 星號
- 85
- 分支
- 5
- 平均合併
- 2 小時 46 分鐘
- 30 天內合併 PR
- 1
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
CommandCodeAI/desktop 的其他 Issue
-
[UI Bug][macOS] Sidebar toggle is vertically misaligned with window controls可能已有人在做 @aliarain 於 3 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 70/100
CommandCodeAI/desktop#125 · 1 則留言 · 已指派 1 人 ·
-
[Feedback]: add copy block under a code block可能已有人在做 @aliarain 於 8 天前認領。 未關閉enhancement
難度 2/5 1-3 小時 新手友好度 68/100
CommandCodeAI/desktop#94 · 已指派 1 人 ·
-
[Feedback]: Add Expand & Collapse for changes可能已有人在做 @aliarain 於 8 天前認領。 未關閉enhancement
難度 2/5 1-3 小時 新手友好度 68/100
CommandCodeAI/desktop#66 · 1 則留言 · 2 個 reaction · 已指派 1 人 ·
-
難度 4/5 3-5 天 新手友好度 52/100
CommandCodeAI/desktop#131 · 1 則留言 ·
-
bug
難度 2/5 1-3 小時 新手友好度 58/100
CommandCodeAI/desktop#130 ·
查看 CommandCodeAI/desktop 的全部 Issue
相似的 Issue
-
documentation
難度 1/5 1 小時以內 新手友好度 90/100
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 92/100
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
obra/superpowers#2445 ·
維護者通常 5 天內回覆
-
package-update
難度 2/5 1-3 小時 新手友好度 78/100
oSoWoSo/vOid_Community_repOsitory#240 · 1 則留言 ·
維護者通常 1 天內回覆
-
ai-inspected
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆