Skip to content

The agent that grows with you

fix(desktop): the link-title window cannot become visible

Austin Pickett6869d009c906
diff --git a/apps/desktop/electron/link-title-window.test.ts b/apps/desktop/electron/link-title-window.test.ts
index a460de7c38a..57ace21d7da 100644
--- a/apps/desktop/electron/link-title-window.test.ts
+++ b/apps/desktop/electron/link-title-window.test.ts
@@ -32,6 +32,11 @@ test('linkTitleWindowOptions keeps the offscreen, hardened defaults', () => {
const options = linkTitleWindowOptions(session)
assert.equal(options.show, false)
+ // #64867: a show:false leak must not be able to cover the chat window.
+ assert.equal(options.x, -20000)
+ assert.equal(options.y, -20000)
+ assert.equal(options.skipTaskbar, true)
+ assert.equal(options.focusable, false)
assert.equal(options.webPreferences.session, session)
assert.equal(options.webPreferences.contextIsolation, true)
assert.equal(options.webPreferences.sandbox, true)
@@ -53,6 +58,32 @@ test('createLinkTitleWindow mutes audio so historical links never autoplay sound
assert.deepEqual(calls.windowOpenHandlers[0]({ url: 'https://attacker.test/popup' }), { action: 'deny' })
})
+test('createLinkTitleWindow hides and zeroes opacity so Windows cannot flash a blank frame', () => {
+ // Regression for #64867: tier-2 title fetches for bot-walled URLs run during
+ // browser-tool turns; the window must never paint over the Desktop chat even
+ // if the platform leaks a show:false frame.
+ const calls = { hide: 0, opacity: [] }
+
+ const FakeBrowserWindow = function (options) {
+ this.options = options
+
+ this.webContents = { setAudioMuted() {}, setWindowOpenHandler() {} }
+
+ this.hide = () => {
+ calls.hide += 1
+ }
+
+ this.setOpacity = (value) => {
+ calls.opacity.push(value)
+ }
+ }
+
+ createLinkTitleWindow(FakeBrowserWindow, { id: 'link-titles' })
+
+ assert.equal(calls.hide, 1)
+ assert.deepEqual(calls.opacity, [0])
+})
+
test('createLinkTitleWindow still returns the window if muting throws', () => {
const ThrowingBrowserWindow = function (options) {
this.options = options
diff --git a/apps/desktop/electron/link-title-window.ts b/apps/desktop/electron/link-title-window.ts
index 1dd9ad142cb..028ef158660 100644
--- a/apps/desktop/electron/link-title-window.ts
+++ b/apps/desktop/electron/link-title-window.ts
@@ -1,7 +1,10 @@
// Hidden BrowserWindow used by tier-2 link-title resolution: when curl can't
// read a page <title> (bot walls, JS-rendered pages), we briefly load the URL
// in an offscreen window and read its title. That window loads arbitrary
-// user-linked pages, so it must never emit sound or trigger real downloads.
+// user-linked pages, so it must never emit sound, trigger real downloads, or
+// become visible — on Windows Desktop a hidden title-fetch window has still
+// painted a blank top-level frame over the chat (#64867), so the invisibility
+// contract is encoded in the launch options, not just show: false.
import { createWindowOpenHandler } from './window-open-policy'
@@ -10,6 +13,12 @@ export function linkTitleWindowOptions(partitionSession) {
show: false,
width: 1280,
height: 800,
+ // Park far off-screen and keep it off the taskbar so a show:false leak can
+ // never cover the chat window or steal focus (#64867).
+ x: -20000,
+ y: -20000,
+ skipTaskbar: true,
+ focusable: false,
webPreferences: {
// Deliberately throttled: this hidden window loads arbitrary user-linked
// pages, and an unthrottled heavy page burns full CPU for the window's
@@ -34,6 +43,16 @@ export function linkTitleWindowOptions(partitionSession) {
export function createLinkTitleWindow(BrowserWindow, partitionSession) {
const window = new BrowserWindow(linkTitleWindowOptions(partitionSession))
+ try {
+ // Belt-and-suspenders with the off-screen show:false options (#64867):
+ // a zero-opacity hidden window cannot flash a blank frame even if the
+ // platform paints it.
+ window.setOpacity?.(0)
+ window.hide?.()
+ } catch {
+ // best-effort; title fetch still works without hide/opacity
+ }
+
try {
window.webContents.setAudioMuted(true)
// Loads arbitrary user-linked pages on render; it only needs the title, so