anomalyco / anomalyco/opencode
Web UI: "Copy response" button only copies the last text part of a turn
@Brendonovich is already working on this.
Since Jul 29, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
In the web UI, the copy button at the bottom of an assistant turn is presented as a turn-level action — it is labelled "Copy response" and sits next to the turn's agent / model / duration. But it only copies the last text part.
Any assistant text emitted before a tool call is silently dropped.
I hit this on a real turn: 4 text parts totalling 13412 chars were rendered, but only the final 7699 were copied. 43% lost, including the main content of the answer.
It is most visible when the question tool is used, because that guarantees text before the tool call and text after it. But it happens with any response that interleaves text and tool calls, which is the common case.
Source
On dev @ 7565e035:
packages/session-ui/src/components/session-turn.tsx:301—showAssistantCopyPartIDscans all assistant messages in the turn and returns a single part id, so exactly one button renders per turn, at the very bottom.packages/session-ui/src/components/session-turn.tsx:414—turnDurationMsis passed down, so the footer shows turn-level duration.packages/session-ui/src/components/message-part.tsx:1733— buthandleCopydoesconst content = text(), i.e. it copies only that one part.
So the button's placement and metadata are turn-scoped while its action is part-scoped.
Likely fix: make handleCopy concatenate every non-empty text part across the turn's assistantMessages() instead of reading a single part.
Possibly the same root cause as #24684 ("only the segment ... after the last selectable text segment"), which was auto-closed by the stale bot rather than fixed.
Steps to reproduce
- Open the web UI
- Send:
Say "AAA", then run echo hi with bash, then say "BBB". - Wait for the turn to finish, hover the response, click the copy button
- Paste
Expected: both AAA and BBB
Actual: only BBB
OpenCode version
1.18.8
Operating System
Linux (WSL2)
Plugins
rtk-ai/rtk
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.