diff --git a/src/main/index.ts b/src/main/index.ts index 62d0f7646e2..0cac6f47316 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -3,7 +3,7 @@ import { existsSync, statSync } from 'node:fs' import { isAbsolute, join } from 'node:path' import os from 'node:os' import { app, BrowserWindow, dialog, ipcMain, nativeTheme, type Tray } from 'electron' -import { stopTccPromptNotice } from './macos-tcc-prompt-notice' +import { initTccPromptNotice, stopTccPromptNotice } from './macos-tcc-prompt-notice' import { electronApp, is } from '@electron-toolkit/utils' import { Store, @@ -1220,6 +1220,9 @@ function openMainWindow(): BrowserWindow { ) automations.setWebContents(window.webContents) automations.start() + // Why: spawns a `log stream` child, so it starts from real app bootstrap rather + // than attachMainWindowServices, which unit tests invoke directly (#9756). + initTccPromptNotice(window) attachMainWindowServices( window, store, diff --git a/src/main/window/attach-main-window-services.ts b/src/main/window/attach-main-window-services.ts index b323f52defe..7a0e12f96cf 100644 --- a/src/main/window/attach-main-window-services.ts +++ b/src/main/window/attach-main-window-services.ts @@ -9,7 +9,7 @@ import type { UpdateCheckOptions, WorktreeStartupLaunch } from '../../shared/types' -import { dismissTccPromptNotice, initTccPromptNotice } from '../macos-tcc-prompt-notice' +import { dismissTccPromptNotice } from '../macos-tcc-prompt-notice' import { registerRepoHandlers } from '../ipc/repos' import { registerWorktreeHandlers } from '../ipc/worktrees' import { registerWorkspaceCleanupHandlers } from '../ipc/workspace-cleanup' @@ -133,9 +133,8 @@ export function attachMainWindowServices( registerSshHandlers(store, () => mainWindow, runtime) registerRemoteWorkspaceHandlers(store, () => mainWindow) registerFileDropRelay(mainWindow) - // Why: macOS-only inside; counts TCC dialogs raised in Orca's name so the FDA - // hint reaches only users macOS is actually prompting (#9756). - initTccPromptNotice(mainWindow) + // Why: handler only — initTccPromptNotice spawns a `log stream` child, so it is + // started from the app bootstrap instead of here, which unit tests call directly. ipcMain.handle('macosTccPrompts:dismiss', () => { dismissTccPromptNotice() })