You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When copying a long single-line fenced markdown code block (2,201 characters) using the code block copy icon in the OpenCode Desktop app — even after the stream has finished and sat idle for a while — only the first 929 characters are copied to the clipboard. Clicking inside the code block, scrolling horizontally all the way to the end, and then clicking the copy icon copies the full 2,201 characters.
Active plugins: opencode-prune-images (local plugin)
Reproduction
In the OpenCode Desktop app, ask the assistant to output a long single-line string (~2,201 characters) inside a fenced markdown code block for easy copy/pasting.
Wait for the output to finish completely (in this case, the stream had finished for a while and a question prompt was waiting).
Click the copy icon on the code block and paste the clipboard contents.
Observe that only a truncated prefix (929 characters) was copied.
Click inside the code block, scroll horizontally all the way to the end of the single line, and click the copy icon again.
Paste the clipboard contents and observe that the full 2,201-character string is now copied.
Expected Behavior
Clicking the copy icon on a markdown code block should always copy the complete 2,201-character string without requiring the user to first click into the code block and scroll horizontally to the end.
Actual Behavior
Clicking the copy icon directly copies only 929 of the 2,201 characters even after the stream has finished. Only after clicking on the code block and scrolling to the end does clicking the copy icon copy all 2,201 characters.
Additional Context
This occurred on a single-line code block containing a long string (2,201 chars) after the stream had already finished for a while.
Workaround: Clicking inside the code block and scrolling all the way to the end before clicking the copy icon is required to guarantee the full string is copied.
Code pointer: In packages/session-ui/src/components/markdown.tsx, setupCodeCopy reads code?.textContent from the DOM (button.closest('[data-component="markdown-code"]')?.querySelector("code")).
Thanks for the detailed report. I couldn't reproduce this here: it needs the Desktop app or the web UI in a browser, and this sandbox has neither. A maintainer will need to check it.
From reading the code (not tested), the code block copy button copies the text currently rendered on the page (setupCodeCopy in packages/session-ui/src/components/markdown.tsx), not the message's full text. While a reply is still streaming, the rendered text can trail behind: createPacedValue reveals it gradually, and the worker that renders and highlights the block can lag further. With one long line and a hidden scrollbar, the block can look finished while the page holds only part of it.
One detail would help: when you clicked copy the first time, had the assistant's reply fully finished, or was it possibly still streaming? If it had finished, roughly how long had it been?
Had the assistant's reply fully finished, or was it possibly still streaming?
The assistant's reply had fully finished streaming — it was not still streaming or catching up.
If it had finished, roughly how long had it been?
It had been finished for a while before I clicked the copy icon the first time. Clicking into the code block and scrolling all the way to the end before clicking the copy icon is the only way to guarantee the full 2,201-character string is copied.
Activity
opencode-agent commentedon Oct 20, 2026
Thanks for the detailed report. I couldn't reproduce this here: it needs the Desktop app or the web UI in a browser, and this sandbox has neither. A maintainer will need to check it.
From reading the code (not tested), the code block copy button copies the text currently rendered on the page (
setupCodeCopyinpackages/session-ui/src/components/markdown.tsx), not the message's full text. While a reply is still streaming, the rendered text can trail behind:createPacedValuereveals it gradually, and the worker that renders and highlights the block can lag further. With one long line and a hidden scrollbar, the block can look finished while the page holds only part of it.One detail would help: when you clicked copy the first time, had the assistant's reply fully finished, or was it possibly still streaming? If it had finished, roughly how long had it been?
Possibly related: #53519 (sticky code block header), #50988 (copy button failing on insecure origins).
ridermw commentedon Oct 20, 2026
Answering the questions above:
The assistant's reply had fully finished streaming — it was not still streaming or catching up.
It had been finished for a while before I clicked the copy icon the first time. Clicking into the code block and scrolling all the way to the end before clicking the copy icon is the only way to guarantee the full 2,201-character string is copied.