From 0519efec66fe961a8808498aa3874582d04bc332 Mon Sep 17 00:00:00 2001 From: Codeplane Agent Date: Mon, 1 Jun 2026 10:08:34 +0000 Subject: [PATCH] fix(client): real user-impacting bugs across Desktop and TUI Fixes two high-impact issues: **Desktop (Electron):** - `packages/desktop/src/main/main.ts`: HTTP Basic Auth was permanently broken. The `login` handler called `event.preventDefault()` (suppressing Electron's native credential dialog) followed by `callback()` (sending blank credentials). Connecting to any `auth_basic`-protected server was a hard failure with no way for the user to supply credentials. Removed the `preventDefault()` call so Electron surfaces the OS-native credential dialog as intended. **TUI (terminal UI):** - `packages/codeplane/src/tui/util/clipboard.ts`: OSC 52 clipboard write guard had inverted logic. When `CODEPLANE_DISABLE_CLIPBOARD=1` was explicitly set in a non-TTY context, the condition `!isTTY && env !== "1"` evaluated to `true && false = false`, so the write was NOT skipped and the user's explicit disable request was ignored. Changed `&&` to `||` so either condition (not a TTY OR explicitly disabled) correctly skips the OSC 52 write. Co-Authored-By: codeplane-agent[bot] <287208015+codeplane-agent[bot]@users.noreply.github.com> --- packages/codeplane/src/tui/util/clipboard.ts | 2 +- packages/desktop/src/main/main.ts | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/codeplane/src/tui/util/clipboard.ts b/packages/codeplane/src/tui/util/clipboard.ts index be3a40261..c0567c435 100644 --- a/packages/codeplane/src/tui/util/clipboard.ts +++ b/packages/codeplane/src/tui/util/clipboard.ts @@ -23,7 +23,7 @@ const getClipboardy = lazy(async () => { * the terminal emulator handle the clipboard locally. */ function writeOsc52(text: string): void { - if (!process.stdout.isTTY && process.env["CODEPLANE_DISABLE_CLIPBOARD"] !== "1") return + if (!process.stdout.isTTY || process.env["CODEPLANE_DISABLE_CLIPBOARD"] === "1") return const base64 = Buffer.from(text).toString("base64") const osc52 = `\x1b]52;c;${base64}\x07` const passthrough = process.env["TMUX"] || process.env["STY"] diff --git a/packages/desktop/src/main/main.ts b/packages/desktop/src/main/main.ts index 52b0b2892..d9da625b1 100644 --- a/packages/desktop/src/main/main.ts +++ b/packages/desktop/src/main/main.ts @@ -2998,12 +2998,11 @@ if (!gotLock) { app.on("login", (event, _webContents, _request, authInfo, callback) => { logger.log("main", "login", { host: authInfo.host, isProxy: authInfo.isProxy, realm: authInfo.realm }) if (authInfo.isProxy) return - // Let Electron surface the native credential dialog for non-proxy - // HTTP Basic Auth challenges. Do NOT call preventDefault or pass empty - // credentials — doing so suppresses the OS prompt and sends a blank - // Authorization header, permanently breaking auth_basic connections. - event.preventDefault() - callback() + // Do not call preventDefault or callback here — Electron surfaces the + // native credential dialog automatically for non-proxy HTTP Basic Auth + // challenges. Calling preventDefault suppresses that dialog, and + // calling callback() with no args sends a blank Authorization header, + // which permanently breaks auth_basic connections. }) app