Skip to content

fix(chat): keep whole tool-file paths in a copy past the chat, and a //server folder's paths as written (#1606) - #2195

Merged
devswha merged 2 commits into
mainfrom
fix/relative-paths-unc-selection
Oct 28, 2026
Merged

devswha merged 2 commits into
mainfrom
fix/relative-paths-unc-selection

Conversation

@devswha

@devswha devswha commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

What it does for the user

Closes the two gaps #1606 left open after #1837 (chat tool-card file labels read from the pane's folder):

  • Select All, or any selection that reaches past the chat, copies the whole paths. Before, a copy that started outside the chat (Select All from the page, a drag from a card out past the chat) was the browser's own copy and took the short labels (app/src/b.ts). Now such a copy carries the paths as written (/work/app/src/b.ts) whenever it takes a shown, shortened label whole. A selection past the chat that takes no shortened label stays the browser's own copy.
  • A UNC folder written with forward slashes reads paths as written. A pane on //server/share/app was treated as a POSIX folder, so its paths were shortened. It now reads like \\server\share\app already did: every path as written.

How

  • toolPathRoot refuses a // start (src/lib/workspacePath.ts).
  • The chat's copy listener sits on the document: Chrome dispatches copy where the selection starts, so a Select All never reached the chat scroller. A copy from a field (the composer, a copy button's hidden textarea, xterm's textarea) stays native.
  • For a selection that reaches past the chat, chatSelectionClipboardPayload grows each visible shortened label the selection takes whole, and puts the browser's own selection.toString() on the clipboard as plain text only. It rebuilds no HTML from the page, so a composer's unsent draft, a hidden chat under a terminal peek, or folded sidebar lists cannot leak into a rich copy. A selection wholly inside the chat works as before (plain text + rebuilt HTML). Each chat on the page has its own document listener, so a chat declines a selection that has no part in it: with two chats mounted (split halves, herdr splits, a chat kept under a terminal peek), a copy wholly inside one is that chat's own, rich HTML included, whichever listener runs first.

Follows T3 Code's workspace-relative paths, as #1837 did; the copy keeps the raw path the way its file labels do.

How it was verified

  • bun test src/lib/workspacePath.test.ts: new //server/share/app cases fail on main (toolPathRoot returned the string) and pass here.
  • scripts/chat-tool-paths-demo-regression.ts (real Chromium, demo build, in the browser CI lane), new checks for both forms (link and bare label):
    • Select All and a drag from the first card past the chat copy every raw path, no app/… line, and no rebuilt HTML;
    • a selection past the chat with no shortened label is not claimed (native copy);
    • a bare chat on //server/share/app and a //server/share/app/fwd.ts card read as written;
    • with a second chat mounted, a copy wholly inside either chat keeps its raw paths and its rich HTML (fails on e3d095e: the second chat: the copy keeps the chat's rich HTML: "").
      On main's code, the copy half fails (the link, Select All: the copy keeps /work/app/src/b.ts, clipboard held app/src/b.ts) and the UNC half fails (machine unc); both pass here.
  • scripts/chat-selection-copy-regression.ts and scripts/replay-clipboard-demo-regression.ts pass.
  • bun run check fast passes.
  • Reviews: omo-native-code-reviewer (APPROVE, no HIGH; its MEDIUM about hidden content in the rebuilt HTML is the plain-text-only change above) and Codex Sol 6.1 Fast xhigh (first round: one HIGH, a composer draft entering the rebuilt HTML, and two MEDIUMs, a hidden chat triggering the claim and the HTML dropping the labels; all fixed by the plain-text-only claim and the visibility check; re-review PASS). The merge pass's review of e3d095e found a MEDIUM (two mounted chats: the first-registered one took the other's copy and dropped its HTML) and a LOW (a display:none label counted as shown); both are fixed in the second commit.

Left out

  • [contenteditable=true] in the field check does not match contenteditable=""/plaintext-only; nothing in src uses those today.
  • A rich (text/html) copy inside the chat still leaves a clickable tool-file label out, as on main (the follow-up feat(chat): read tool-file labels from the pane's folder #1837 named); the plain text carries the whole path.

Closes #1606.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 4e87188 and 8aaf99b.

Files selected for processing: 7
  • DESIGN.md
  • changelog.d/chat-tool-paths-unc-select-all.md
  • scripts/chat-tool-paths-demo-regression.ts
  • src/components/ChatTimeline.tsx
  • src/lib/markdownClipboard.ts
  • src/lib/workspacePath.test.ts
  • src/lib/workspacePath.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

Fixed in 8aaf99b:

  • MEDIUM (two mounted chats): in the reaching-past branch, a chat now returns null unless some selection range intersects its root, so a copy wholly inside one chat is that chat's own (rich HTML included), whichever document listener runs first. Select All and a selection spanning two chats still intersect a root and keep the raw-path plain text.
  • LOW (display:none label): a label with no client rects no longer counts as shown.
  • Regression: the bare fixture mounts a second ChatView; a copy wholly inside each chat must be claimed with raw paths and rich HTML. In real Chromium it fails on e3d095e (the second chat: the copy keeps the chat's rich HTML: "") and passes now.

bun run check fast passes; Codex Sol 6.1 Fast xhigh re-review of the delta: PASS.

@devswha

devswha commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

Merging 8aaf99b after two merge-pass review rounds. Round 1 reproduced a regression on e3d095e: with two chats mounted, one chat's document copy listener took a copy made in the other chat and dropped its rich HTML. The lane fixed it in 8aaf99b, where a chat declines a selection with no part in it and a display:none label no longer counts, and added a two-chat browser check. Both reviewers pass this head, and their reproductions fail on e3d095e and pass here. The required checks are green, and CodeRabbit did not review this head. The LOW notes go to a follow-up issue.

@devswha
devswha merged commit cd52800 into main Oct 28, 2026
12 checks passed
@devswha
devswha deleted the fix/relative-paths-unc-selection branch October 28, 2026 06:24
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.

Chat: show tool-card file paths relative to the pane's folder

1 participant