anomalyco / anomalyco/opencode

Web UI: "Copy response" button only copies the last text part of a turn

Open
#39,477 2 comments 0 reactions 1 assignee View on GitHub

@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:301showAssistantCopyPartID scans 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:414turnDurationMs is passed down, so the footer shows turn-level duration.
  • packages/session-ui/src/components/message-part.tsx:1733 — but handleCopy does const 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
  1. Open the web UI
  2. Send: Say "AAA", then run echo hi with bash, then say "BBB".
  3. Wait for the turn to finish, hover the response, click the copy button
  4. Paste

Expected: both AAA and BBB
Actual: only BBB

OpenCode version

1.18.8

Operating System

Linux (WSL2)

Plugins

rtk-ai/rtk

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.