Skip to content

[BUG] Copy-last-agent-message toolbar button copies wrong content (small fragment from older message) #248

Description

@domijin

Build

  • OpenCove.app CFBundleVersion = 0.2.0-nightly.20260509.1
  • macOS (Apple Silicon)

Where

The agent-node toolbar that shows the Standby chip and four icons (undo / history / copy / X). The third icon is the affected one.

Expected

Clicking the copy button copies the full text of the most recent assistant message in the conversation to the system clipboard.

Actual

Click registers (focus ring fires, no console errors), and the system clipboard does mutate — but the content that lands is a small fragment from an older message, not the most recent one.

Concrete repro from a real session:

  • The most recent assistant message at click time was a multi-paragraph runbook (~30 lines, headers, numbered steps, no inline code spans in its early paragraphs).
  • The clipboard after the click contained only the literal string mp-skill-issues — a kebab-case slug that was wrapped in backticks (inline code span) inside an earlier assistant message ~2 turns back, not the latest one.

Captured diagnostics

Signal Result
Click registers (focus ring) yes
DevTools Console errors during click none (empty)
System clipboard mutated yes
Clipboard content matches "most recent message" no — contains a fragment from an older message

So the IPC clipboard-write path is firing fine. The bug is in what the click handler decides to copy, not whether the copy executes.

Candidate root causes

  1. Message-index off-by-N. The handler resolves "last assistant message" against a stale or wrong-index source (e.g., last complete message excluding the current streaming one, or simply pointing at the wrong array slot).
  2. Inline-code-span scope. The handler walks the rendered DOM for the last <code> element across all messages and copies its textContent, instead of resolving the most-recent message's full body. This would explain why mp-skill-issues (an inline code span in an earlier message) landed instead of the runbook (which had no inline code spans in its first paragraph).

Hypothesis 2 fits the observed fragment best, but a maintainer will know which selection logic the button uses.

Repro for the maintainer

  1. In any agent thread, send a long assistant turn that contains no inline code spans (e.g., a multi-paragraph plain-prose response).
  2. Earlier in the same thread, ensure there is at least one assistant message containing a backtick-wrapped inline code span.
  3. Click the copy button on the agent toolbar.
  4. Paste somewhere external. Expect: full text of the latest message. Observe: probably just the inline-code-span text from the older message.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions