Skip to content

fix(kimi-code): show clipboard image paste hint only for newly copied images - #1072

Merged
liruifengv merged 9 commits into
mainfrom
fix/clipboard-image-hint-once
Jun 24, 2026
Merged

fix(kimi-code): show clipboard image paste hint only for newly copied images#1072
liruifengv merged 9 commits into
mainfrom
fix/clipboard-image-hint-once

Conversation

@liruifengv

@liruifengv liruifengv commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No related issue — this is a follow-up refinement to the clipboard image paste hint shipped in #1028.

Problem

The footer hint "Image in clipboard · Ctrl+V to paste" fired too eagerly in two ways:

  1. It reappeared on every terminal focus as long as an image stayed in the clipboard (gated only by a 30s cooldown), which became noisy for a single lingering image.
  2. It fired during initialization whenever an image was already in the clipboard, treating a pre-existing image as if it were newly copied.

Additionally, the startup baseline check ran the Linux/WSL clipboard helpers synchronously, so a slow or unresponsive helper could freeze the CLI launch even when the user never returned focus with an image.

What changed

Replace the time-based cooldown with a per-image gate plus a startup baseline, so the hint only appears for images copied during the session:

  • The hint shows once for a given image and stays quiet until the clipboard is observed empty; only then does it re-arm, so the next genuinely new image notifies again.
  • The first clipboard observation after start only establishes a baseline: an image already in the clipboard when the session begins is not treated as new, so the hint no longer fires during initialization.
  • The startup baseline probe now drives the Linux/WSL clipboard helpers asynchronously, so a slow or unresponsive helper no longer blocks the event loop or freezes launch.

Detection stays lightweight: it relies on the existing image-presence check rather than hashing image bytes or adding platform-specific clipboard change tracking. The known trade-off is that copying a second image directly over the first (without the clipboard going empty in between) does not trigger a new hint.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

The footer hint repeated on every terminal focus whenever an image remained in the clipboard, which became noisy. Replace the 30s time-based cooldown with a per-image gate: the hint shows once for a given image and stays quiet until the clipboard is observed empty and a new image appears.
@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 247fb93

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@247fb93
npx https://pkg.pr.new/@moonshot-ai/kimi-code@247fb93

commit: 247fb93

@liruifengv

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

…tartup

The footer hint fired during initialization whenever an image was already in the clipboard, treating it as new. The first clipboard observation after start now only establishes a baseline, so only images copied during the session trigger the hint.
@liruifengv liruifengv changed the title fix(kimi-code): show clipboard image paste hint only once per image fix(kimi-code): show clipboard image paste hint only for newly copied images Jun 24, 2026
@liruifengv

Copy link
Copy Markdown
Collaborator Author

@codex

@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: 077ca313b6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/kimi-code/src/tui/controllers/clipboard-image-hint.ts
@liruifengv

Copy link
Copy Markdown
Collaborator Author

@codex

@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: 1ae6a5cff4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/kimi-code/src/tui/controllers/clipboard-image-hint.ts
The startup baseline probe in ClipboardImageHintController calls clipboardHasImage(), which on Linux/WSL ran wl-paste/xclip/powershell via spawnSync. The probe only reaches its first await after those synchronous calls, so a slow or wedged helper could freeze the TUI launch for up to the 1s-2s tool timeouts even when the user never focuses with an image.

Add an async runCommandAsync built on spawn with timeout-based kill, and route the Linux/WSL image detection through it so the event loop is never blocked. Keep the synchronous runCommand for the explicit paste-read path.
@liruifengv
liruifengv merged commit a86bb97 into main Jun 24, 2026
8 checks passed
@liruifengv
liruifengv deleted the fix/clipboard-image-hint-once branch June 24, 2026 13:07
@github-actions github-actions Bot mentioned this pull request Jun 24, 2026
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.

1 participant