Skip to content

fix(cli): Improve error message for /copy command (#5244)#5416

Closed
vero-code wants to merge 3 commits intogoogle-gemini:mainfrom
vero-code:fix-copy-command-5244
Closed

fix(cli): Improve error message for /copy command (#5244)#5416
vero-code wants to merge 3 commits intogoogle-gemini:mainfrom
vero-code:fix-copy-command-5244

Conversation

@vero-code
Copy link
Copy Markdown

TLDR

Improves the error message shown when the /copy command fails, to help users understand why copying may not work in remote or SSH environments.

Dive Deeper

Previously, the message was too generic ("Failed to copy to the clipboard."). This change adds a clear hint that the issue may be related to the environment (e.g., SSH, tmux), and suggests using OSC52 or switching to a local terminal.

Reviewer Test Plan

  1. Run gemini-cli in a remote session (e.g., SSH).
  2. Prompt the model with any question (e.g., "Tell me a joke about devs").
  3. Run /copy.
  4. Confirm that the new message is shown if clipboard is unavailable.

Testing Matrix

🍏 🪟 🐧
npm run
npx
Docker
Podman - -
Seatbelt - -

Linked issues / bugs

Related to #5244

@vero-code vero-code requested a review from a team as a code owner August 2, 2025 14:49
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @vero-code, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the user experience of the CLI by providing more informative error messages. Specifically, it addresses a common pain point for users attempting to use the /copy command in remote or SSH environments, guiding them towards potential solutions rather than a generic failure message.

Highlights

  • Improved Error Messaging: The error message displayed when the /copy command fails to copy content to the clipboard has been significantly improved. It now provides a clear hint that the issue might be related to remote environments (like SSH or tmux) and suggests alternative solutions such as using OSC52 or switching to a local terminal.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request improves the error message for the /copy command to be more informative in environments where clipboard access might be restricted. The change is clear and addresses the problem described. My review focuses on a critical issue: the unit tests for this command have not been updated to reflect the new error message, which will cause the test suite to fail. Please address this to maintain code quality and test coverage.

Comment thread packages/cli/src/ui/commands/copyCommand.ts Outdated
@vero-code vero-code force-pushed the fix-copy-command-5244 branch from 1f76167 to 5cf4476 Compare August 2, 2025 14:56
Comment thread packages/cli/src/ui/commands/copyCommand.test.ts Outdated
@vero-code vero-code force-pushed the fix-copy-command-5244 branch from 5cf4476 to 12eceb4 Compare August 5, 2025 14:30
@vero-code vero-code requested a review from galz10 August 12, 2025 09:17
@gemini-cli gemini-cli Bot added kind/bug priority/p2 Important but can be addressed in a future release. labels Aug 22, 2025
@vero-code vero-code requested a review from a team as a code owner October 21, 2025 15:21
@vero-code
Copy link
Copy Markdown
Author

It looks like #9966 implemented OSC52 clipboard support and resolved #5244.
Would it make sense to close this one as superseded?

@bdmorgan
Copy link
Copy Markdown
Collaborator

Hi @vero-code, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this.

We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines.

Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed.

Thank you for your understanding and for being a part of our community!

@vero-code
Copy link
Copy Markdown
Author

Hi @bdmorgan, thanks for the update. Since the issue was resolved, this PR is superseded. I'll close it now.

@vero-code vero-code closed this Jan 15, 2026
@vero-code vero-code deleted the fix-copy-command-5244 branch January 27, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p2 Important but can be addressed in a future release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants