Skip to content

fix(kimi-code): bump native clipboard dependency to fix Linux startup crash - #1075

Merged
liruifengv merged 5 commits into
mainfrom
fix/linux-clipboard-native-crash
Jun 24, 2026
Merged

fix(kimi-code): bump native clipboard dependency to fix Linux startup crash#1075
liruifengv merged 5 commits into
mainfrom
fix/linux-clipboard-native-crash

Conversation

@liruifengv

Copy link
Copy Markdown
Collaborator

Related Issue

N/A — reported internally by a user.

Problem

On Linux X11, opening Kimi Code and typing a character before the UI is fully initialized aborts the whole process. The native clipboard binding (@mariozechner/clipboard@0.3.2) uses .unwrap() on X11 clipboard operations; when the X11 display is not ready yet, available_formats() panics across the napi-rs FFI boundary, which aborts the Node process. JS try/catch cannot catch a Rust panic, so the existing guard in safeAvailableFormats was ineffective.

The crash fires through the clipboard image hint controller: a focus-in event during startup triggers clipboardHasImage(), which falls back to the native binding on X11 when xclip is unavailable, hitting the panic.

What changed

Bump @mariozechner/clipboard from 0.3.2 to 0.3.9. Starting with 0.3.3, the binding returns napi::Result from every function instead of unwrapping, so clipboard errors surface as catchable JS exceptions rather than aborting the process. 0.3.9 also vendors the clipboard implementation and upgrades napi-rs to 3.x; the public JS API and platform package names are unchanged, so no other code needs to change.

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.

@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: df9c1c7

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

@github-actions

Copy link
Copy Markdown
Contributor

❌ Nix build failed

Hash mismatch in pnpmDeps:

Hash
specified sha256-l8RvHgEGwS1XX0VGWCNtF1EmE1SRQFyCCYGPCoPL3JY=
got sha256-yukns+b5mjDgp/TuFco24FH5pjJm/Ivlw71gMyhSl/Q=

Please update flake.nix with the got hash.

@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@df9c1c7
npx https://pkg.pr.new/@moonshot-ai/kimi-code@df9c1c7

commit: df9c1c7

@liruifengv
liruifengv merged commit 3aaf1e5 into main Jun 24, 2026
8 checks passed
@liruifengv
liruifengv deleted the fix/linux-clipboard-native-crash 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