Skip to content

Add /copy to copy the last assistant reply (#493) - #1664

Merged
currentbits merged 2 commits into
mainfrom
coder/copy-this-turn-last-reply-like-cli-copy-537456
Oct 18, 2026
Merged

currentbits merged 2 commits into
mainfrom
coder/copy-this-turn-last-reply-like-cli-copy-537456

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Typing /copy in the composer now copies the latest assistant reply on the thread as Markdown, like /copy in the Kimi and Grok CLIs. Before this, getting an answer into a PR description or Slack meant drag-selecting a bubble that re-renders on every stream tick. Closes #493.

Changes

  • /copy is a new run verb in the / palette. It copies the newest assistant reply that has text. Tool cards, thinking, and a reply that is still streaming are skipped. On an empty thread it does nothing.
  • A "Copied last reply" strip shows on the composer's status edge for 1.5s. It uses the same timer as the thread-ID "Copied" flash, which is now one shared helper.
  • The hover copy button on each assistant message already existed. This PR adds test coverage for copying an older turn with it.

Verification

  • tsc --noEmit is clean.
  • After rebasing on main: slashCommands.test.ts 16/16 pass. composerSlashActions, composerCommands, threadHeader and threadView 230/230 pass. The new tests cover /copy on the latest reply with a tool card after it, the per-message button on an older reply, and /copy on an empty thread.
  • Full renderer suite before the rebase: 3074 pass, 1 fail. The failure was a temp-file store flush race in threadHeader.test.tsx, and that file passed 2/2 when rerun on its own.
  • Not tested: I haven't clicked through it in the running app.

Notes for reviewers

  • During a run, the "Copied" strip replaces the working strip for 1.5s, so the Stop button is hidden briefly. Esc still stops the run.
  • Mid-turn, /copy copies the previous finished reply, not the partial one.
  • There is no separate plain-text or rich-HTML copy. Markdown source covers the PR and Slack use cases.

🤖 Generated with Claude Code

Adds /copy to the composer palette. It copies the newest finished
assistant reply as Markdown and flashes "Copied last reply" on the
composer status strip. An empty thread is a no-op. The per-message copy
button already existed; it now has test coverage for copying an older turn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T19:55:23.395041Z cb2a98a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb2a98a035

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1724 to +1727
m.role === "assistant" &&
!m.thinking &&
m.id !== streamingMessageId &&
m.text.trim() !== "",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exclude every message from the active run

When a working turn emits assistant text and then starts a tool, the runners append the tool after that assistant message, so useTranscriptAnnotations sets streamingMessageId to null because the last message is no longer an assistant. Invoking /copy during the tool then selects the current turn's pre-tool commentary instead of the previous completed reply (and does so even when no completed reply exists). Exclude assistant messages belonging to the active run while the thread is working, rather than excluding only streamingMessageId.

Useful? React with 👍 / 👎.

@currentbits
currentbits merged commit 02a2b7c into main Oct 18, 2026
6 checks passed
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.

Copy this turn / last reply, like CLI /copy

1 participant