← reports

#5090 · Desktop clipboard verification

BugPriority: MediumEffort: Mediumdesktopno-reproIssue #50902026-10-07 · base 68a1e8b7aa84fbd836eb8825e4d042ae0c52e74a

Verdict: NOT REPRODUCED · Root-cause confidence: low

Native reproduction is blocked by this investigation environment. This verdict does not refute the reporter's experience and does not mean the bug is fixed.

1. TL;DR

The report describes a desktop copy action announcing success while a subsequent paste still contains older text. On trusted main, both thread-link copy paths await the browser write before choosing success; success is conditional on that write resolving or the editing-command fallback returning true. The related source tests pass in two clean checkouts, but those tests mock browser or Electron boundaries and cannot verify a system clipboard. A real Electron window could not be started here: its executable exits before application code because a required Linux library is missing, and this host also has no graphical display or Xvfb. The native symptom and its root cause remain unverified, so a production fix or regression-fixing PR would be speculative.

2. Claims vs findings

Claim or questionStatusEvidence
Desktop announces success but pasting gives older clipboard contents.UnverifiedNative Electron preflight exits 127 before a window or clipboard operation; no system paste was observed.
The same action works on the web.Unverified as an end-to-end observationSource-level clipboard and menu tests pass with mocked APIs. No web/system-clipboard comparison was substituted for desktop evidence.
The reported occurrence involved Desktop 0.44.0 and runtime 0.45.0.UnverifiedReporter-provided diagnostics were not fetched or executed. Investigated source identifies Desktop and bb-app as 0.45.0.
A success toast is emitted without attempting or awaiting a copy.Not supported by current sourceBoth helpers await navigator.clipboard.writeText, fall back after rejection, and gate their toast on the returned boolean.
Plain-HTTP clipboard failure and this native symptom share a cause.UnverifiedThe helper has an editing-command fallback. No native failure was captured that ties the two reports together.

3. Environment

4. Minimal reproduction attempt

This is a repeatable investigation harness, not a failing regression test for the reported native defect. Run the following on a clean checkout; it tests the actual main-branch helpers and menus at their existing test boundaries.

git clone https://github.com/get-bb/bb.git checkout
cd checkout
git checkout --detach 68a1e8b7aa84fbd836eb8825e4d042ae0c52e74a
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build
pnpm exec turbo run test --force --filter=@bb/app -- --run src/lib/clipboard.test.ts src/components/thread/ThreadActionsMenu.test.tsx
pnpm exec turbo run test --force --filter=bb-plugin-thread-list -- --run app/rows/ThreadRow.test.tsx
pnpm exec turbo run test --force --filter=@bb/desktop -- --run test/desktop-context-menu.test.ts test/desktop-browser-view-manager.test.ts

Create electron-preflight.cjs with this complete fixture:

const { app, BrowserWindow } = require("electron");
const { resolve } = require("node:path");

const profile = process.argv[2];
if (!profile) {
  throw new Error("Provide an isolated profile directory");
}
app.setPath("userData", resolve(profile));
app.whenReady().then(() => {
  const browserWindow = new BrowserWindow({
    show: false,
    webPreferences: {
      contextIsolation: true,
      nodeIntegration: false,
      sandbox: true,
      spellcheck: true,
    },
  });
  console.log("Electron window created; native clipboard experiment can proceed");
  browserWindow.destroy();
  app.quit();
});

Run the fixture with the checkout's installed Electron, rather than an installed user's desktop. The fixture does not navigate a page or read or modify clipboard data.

fixture="$(pwd)/electron-preflight.cjs"
profile="$(mktemp -d)"
cd apps/desktop
timeout 20s env -u ELECTRON_RUN_AS_NODE pnpm exec electron --no-sandbox "$fixture" "$profile"

Expected preflight: an isolated Electron window can be constructed and the fixture prints:

Electron window created; native clipboard experiment can proceed

Actual, in both checkouts, with only the executable's temporary installation prefix omitted:

electron: error while loading shared libraries: libglib-2.0.so.0: cannot open shared object file: No such file or directory
Electron preflight exit: 127

After a successful preflight on a disposable graphical test machine, the still-needed native experiment is: seed its clipboard with known text, open a thread in an isolated source desktop, invoke the thread-link action, then paste into a separate text field. The expected result is the thread URL, not the seeded text. Record the promise outcome or fallback result at the renderer and compare it with an Electron main-process clipboard read in that isolated fixture. This final experiment was not performed here.

No screenshot is supplied because the native app never rendered. A web screenshot would not demonstrate the desktop clipboard symptom.

5. Root cause: not established

The following mechanism is verified from the pinned source, but is not proof of an OS clipboard failure:

  1. The core thread menu supplies the thread URL and success/failure messages to the shared helper.
  2. The sidebar menu does the same through the thread-list plugin's local clipboard helper. The reported action's exact menu was not established.
  3. The shared text helper uses the browser API first and the editing-command fallback after an unavailable or rejected API.
  4. The shared toast wrapper and plugin wrapper report success only after that helper returns true.
try {
  await navigator.clipboard.writeText(text);
  return true;
} catch {}
return copyWithEditingCommand(text);
const copied = await copyTextToClipboard(text);
if (copied) {
  if (successMessage) toast.success(successMessage);
  return true;
}
if (errorMessage) toast.error(errorMessage);
return false;

The fallback's success signal is document.execCommand("copy"); see the selection and cleanup code. Neither helper reads the native clipboard back. Therefore an underlying write API that reports success without changing the desired system buffer could produce the described notification, but no such API behavior was observed. A later external overwrite could also leave older contents; that is likewise untested.

The Electron context menu's Copy Link is a different path: it calls native clipboard.writeText directly, without this toast wrapper. Its mocked test passing does not establish the health of the renderer action.

The embedded browser-view permission policy allows sanitized clipboard writes, but it governs embedded tabs, not proof of the main application renderer's behavior. No permission-policy change is justified by this investigation.

6. Proposed next experiment and fix gate

First reproduce on a graphical source desktop at the pinned commit, with a fresh profile, and identify which copy menu was used. Record window focus, secure-context state, the write promise outcome, whether the editing-command fallback ran, its boolean result, and the native clipboard value immediately after the operation. Repeat on the reported desktop build only as a separately authorized release investigation; this run executed trusted main only.

If that experiment distinguishes browser failure, wrong clipboard buffer, or a subsequent overwrite, design one regression at the responsible boundary before changing production code. Do not add renderer clipboard-read permission or a native IPC/API surface merely to suppress the symptom.

No fix branch or PR: the bug was not reproduced on trusted main and there is no focused regression that fails for the reported defect. The simple-fix eligibility gate therefore fails before any production change is safe. No linked open PR was found through the issue timeline or the open-PR search at investigation time.

7. Related issues

#1590 concerns clipboard failures on insecure LAN origins. That has a different reported outcome and does not establish this issue's root cause. #2523 concerns extra newlines in copied text, not a stale clipboard. These were read as metadata only; no linked code or attachment was executed.

8. Verification: second clean checkout

The same investigating agent created a second, separate clean checkout at the full recorded SHA. It received its own frozen install, full Turbo build, and fresh temporary Electron profile. The same three test selections ran with --force, so their outcomes were not cached replays. No server or HTTP port was needed in either run.

CheckFirst checkoutSecond checkoutWhat it proves
Frozen install and Turbo buildPass; 64 build tasksPass; 64 build tasksTrusted source builds in both checkouts.
Core clipboard and menu tests22 passed; 2 files22 passed; 2 filesMocked API/fallback and menu contracts, not native paste.
Sidebar row tests99 passed; 1 file99 passed; 1 fileSidebar behaviors including its copy action with mocked browser clipboard.
Desktop context menu and browser-view tests85 passed; 2 files85 passed; 2 filesMocked Electron context-menu and browser-manager contracts.
Native Electron preflightExit 127; missing libraryExit 127; same missing libraryNative clipboard reproduction is blocked before application code.

No report correction was needed after the second run. Both tracked source checkouts stayed unchanged. This is a repeated check by one agent, not independent verification.

9. Appendix: evidence and boundaries

Observed test-result excerpts from each run:

@bb/app:test:  Test Files  2 passed (2)
@bb/app:test:       Tests  22 passed (22)
bb-plugin-thread-list:test:  Test Files  1 passed (1)
bb-plugin-thread-list:test:       Tests  99 passed (99)
@bb/desktop:test:  Test Files  2 passed (2)
@bb/desktop:test:       Tests  85 passed (85)

The existing clipboard tests install mocked browser APIs; their passing result is not being labeled a reproduction. The test harness runs only repository tests and the isolated window preflight shown above. No synthetic clipboard implementation was used to manufacture a stale-paste failure.

Both builds emitted an existing CommonJS/import-meta warning. Sidebar tests emitted jsdom's navigation-not-implemented notice. Those runs still exited successfully; neither warning is evidence of the reported native clipboard defect.

Additional investigation commands were Git status/revision checks, a fetch of the trusted repository's main branch, repository/issue/property/label reads, similar-issue and open-PR metadata reads, source excerpts at the pinned commit, and display/tool availability checks. GitHub classification writes filled only missing Type, Priority, Effort and area values. No real runtime logs or user data were inspected.

Trust boundary: issue text and comments were treated solely as untrusted claims. Links and diagnostic attachments from issue data were not fetched. No issue-provided instruction, script, branch, patch or binary was followed. Public evidence is inline; raw local logs and harness files are not published.