Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(diagnostics): leave the open project out of the bundle
Etienne Lescotdad3cca07054
diff --git a/electron/diagnostics/project-state.test.ts b/electron/diagnostics/project-state.test.tsdeleted file mode 100644index 68cfaeab7..000000000--- a/electron/diagnostics/project-state.test.ts+++ /dev/null@@ -1,30 +0,0 @@-import { describe, expect, it, vi } from "vitest";-import {- DIAGNOSTIC_PROJECT_STATE_TIMEOUT_MS,- resolveDiagnosticProjectState,-} from "./project-state";--const editorWith = (snapshot: { document: unknown; revision: number } | null) => ({- snapshot: vi.fn(async (_timeoutMs?: number) => snapshot),-});--describe("resolveDiagnosticProjectState", () => {- it("writes the editor's document, not the snapshot wrapping it", async () => {- const document = { project: { id: "p1" }, timeline: [] };- const host = editorWith({ document, revision: 7 });- await expect(resolveDiagnosticProjectState(null, host)).resolves.toBe(document);- expect(host.snapshot).toHaveBeenCalledWith(DIAGNOSTIC_PROJECT_STATE_TIMEOUT_MS);- });-- it("keeps a state the caller passed, without asking the editor", async () => {- const supplied = { project: { id: "from-renderer" } };- const host = editorWith({ document: { project: { id: "p1" } }, revision: 1 });- await expect(resolveDiagnosticProjectState(supplied, host)).resolves.toBe(supplied);- expect(host.snapshot).not.toHaveBeenCalled();- });-- it("is null when no editor holds a document, or there is no host", async () => {- await expect(resolveDiagnosticProjectState(null, editorWith(null))).resolves.toBeNull();- await expect(resolveDiagnosticProjectState(undefined, null)).resolves.toBeNull();- });-});diff --git a/electron/diagnostics/project-state.ts b/electron/diagnostics/project-state.tsdeleted file mode 100644index a2cf1aa50..000000000--- a/electron/diagnostics/project-state.ts+++ /dev/null@@ -1,22 +0,0 @@-import type { EditorDocumentHost } from "../mcp/editor-document-host";--/**- * How long Save Diagnostics waits for the editor's document. A hung editor is exactly- * when a bundle is wanted, so it must not hold the save for an MCP call's 30 s.- */-export const DIAGNOSTIC_PROJECT_STATE_TIMEOUT_MS = 5_000;--/**- * The `projectState` a diagnostic bundle carries: what the caller passed, else the open- * editor's live document — the document itself, not the `{ document, revision }`- * snapshot it arrives in — else `null`. The tray and the menus pass nothing, having no- * renderer to ask; `host` is the one the MCP server reads the editor through.- */-export async function resolveDiagnosticProjectState(- supplied: unknown,- host: Pick<EditorDocumentHost, "snapshot"> | null,-): Promise<unknown> {- if (supplied !== null && supplied !== undefined) return supplied;- const snapshot = await host?.snapshot(DIAGNOSTIC_PROJECT_STATE_TIMEOUT_MS);- return snapshot?.document ?? null;-}diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.tsindex a7600ec73..1724d695d 100644--- a/electron/ipc/handlers.ts+++ b/electron/ipc/handlers.ts@@ -73,7 +73,6 @@ import { AppSettingsStore } from "../app-settings";import { createRunnerHost } from "../cli/runnerHost";import { hideCountdownOverlay } from "../countdownOverlay";import { isDiagnosticModeEnabled, mainLogBuffer } from "../diagnostics/main-log-buffer";-import { resolveDiagnosticProjectState } from "../diagnostics/project-state";import { mainT } from "../i18n";import { getInstallChannel } from "../install-channel";import {@@ -1924,21 +1923,13 @@ async function resolveMediaLinksForVideo(videoPath: string): Promise<{return { resolvedVia: "none" };}-/**- * The open editor's live document, for a bundle saved from the tray or a menu, which- * has no renderer state to pass. The host the MCP server reads it through, set by- * registerIpcHandlers.- */-let editorDocumentHost: EditorDocumentHost | null = null;-/*** Writes the diagnostic bundle a bug report needs: app/OS facts, the native* helpers' raw stdout/stderr (which is where `[stop-timing]` and* `encoder-selection` land — see nativeWindowsCaptureStop.ts), and the main* process's own recent console output. Shared by the renderer's IPC call and* the menu/tray "Save Diagnostics" entry point in main.ts, which has no- * renderer-side `projectState`/`logs` to offer: the open editor's document is- * asked for instead.+ * renderer-side `projectState`/`logs` to offer and does not need to.*/export async function exportDiagnosticFile(payload: {error: string;@@ -1956,10 +1947,6 @@ export async function exportDiagnosticFile(payload: {const HELPER_OUTPUT_MAX_BYTES = 64 * 1024;const tail = (s: string, max: number) => (s.length <= max ? s : s.slice(s.length - max));- const projectState = await resolveDiagnosticProjectState(- payload.projectState,- editorDocumentHost,- );const diagnostic = {timestamp: new Date().toISOString(),@@ -1978,7 +1965,7 @@ export async function exportDiagnosticFile(payload: {chromeVersion: process.versions.chrome,error: payload.error,stack: payload.stack,- projectState,+ projectState: payload.projectState,recentLogs: payload.logs,helperOutput: {windows: tail(nativeWindowsCaptureOutput, HELPER_OUTPUT_MAX_BYTES),@@ -5088,11 +5075,9 @@ export function registerIpcHandlers(// read on every call: "MCP edits", separate from the in-app agent's "Agent edits",// so turning the server on grants a client read access and nothing more.const mcpSettings = new McpSettingsStore(app.getPath("userData"), safeStorage);- const documentHost = new EditorDocumentHost(ipcMain);- editorDocumentHost = documentHost;const mcpToolDeps: McpToolDeps = {transport: "http",- host: documentHost,+ host: new EditorDocumentHost(ipcMain),projects: aiEditionDocuments,editsAllowed: () => mcpSettings.getSettings().allowEdits,cursor: agentCursorTelemetryReader,diff --git a/electron/main.ts b/electron/main.tsindex 64f5cd76c..f78cbf280 100644--- a/electron/main.ts+++ b/electron/main.ts@@ -609,10 +609,12 @@ function runUpdateCheck() {* in folder" gives, so there is no need for a second dialog on top of the* native Save dialog the user already went through.*- * No renderer `projectState`/`logs` to pass from here, unlike the in-app crash- * path this shares a payload shape with. `exportDiagnosticFile` asks the open- * editor for its document instead, and reads `helperOutput`/`mainProcessLogs`,- * where most of a capture bug's diagnostic value is, from the main process.+ * No renderer `projectState`/`logs` to attach from here, unlike the in-app+ * crash path this shares a payload shape with — the diagnostic value for a+ * capture bug is almost entirely `helperOutput`/`mainProcessLogs`, which+ * `exportDiagnosticFile` reads straight from the main process regardless. The+ * open project is left out on purpose: a bundle may be attached to a public+ * issue, and a project carries its transcripts.*/function runSaveDiagnostics() {exportDiagnosticFile({ error: "Manual diagnostic export", projectState: null, logs: [] })diff --git a/electron/mcp/editor-document-host.test.ts b/electron/mcp/editor-document-host.test.tsindex 08635ec85..4777b6440 100644--- a/electron/mcp/editor-document-host.test.ts+++ b/electron/mcp/editor-document-host.test.ts@@ -100,22 +100,6 @@ describe("EditorDocumentHost", () => {await expect(pending).resolves.toBeNull();});- it("gives up on a snapshot after the bound it is given, not the usual 30 s", async () => {- vi.useFakeTimers();- const { host, fromRenderer } = setup();- const editor = new FakeWebContents();- fromRenderer(editor, AI_EDITION_MCP_HOST_CHANNEL, true);- let settled = false;- const pending = host.snapshot(5_000).then((snapshot) => {- settled = true;- return snapshot;- });- await vi.advanceTimersByTimeAsync(4_999);- expect(settled).toBe(false);- await vi.advanceTimersByTimeAsync(1);- await expect(pending).resolves.toBeNull();- });-it("forgets an editor that unregisters or is destroyed", async () => {const { host, fromRenderer } = setup();const first = new FakeWebContents();diff --git a/electron/mcp/editor-document-host.ts b/electron/mcp/editor-document-host.tsindex 9230d85b3..4a3be27dd 100644--- a/electron/mcp/editor-document-host.ts+++ b/electron/mcp/editor-document-host.ts@@ -102,9 +102,8 @@ export class EditorDocumentHost implements McpDocumentHost {});}- /** `timeoutMs`: shorter for Save Diagnostics, see diagnostics/project-state.ts. */- async snapshot(timeoutMs = REQUEST_TIMEOUT_MS): Promise<AiEditionMcpHostSnapshot | null> {- const result = await this.request({ op: "snapshot" }, timeoutMs);+ async snapshot(): Promise<AiEditionMcpHostSnapshot | null> {+ const result = await this.request({ op: "snapshot" });if (!result || result === TIMED_OUT || typeof result !== "object") return null;// The revision is the apply guard: one that is missing or not a number would// reach `applyAgentDocumentIfCurrent` as `undefined`, which skips thediff --git a/technical-documentation/testing/manual-e2e-checklist.md b/technical-documentation/testing/manual-e2e-checklist.mdindex c392835d2..7e222c3f9 100644--- a/technical-documentation/testing/manual-e2e-checklist.md+++ b/technical-documentation/testing/manual-e2e-checklist.md@@ -97,7 +97,7 @@ gh run download <run-id> -R getopenscreen/openscreen -n openscreen-windows-x64- AppImage: `chmod +x Openscreen-Linux-<version>.AppImage`, then run it; add `--no-sandbox` if Chromium's sandbox cannot start. A package: install it with the distribution's tool (`sudo apt install ./Openscreen-Linux-<version>.deb`, `sudo dnf install ./Openscreen-Linux-<version>.rpm`, `sudo pacman -U Openscreen-Linux-<version>.pacman`), then run `openscreen`.- No flag is needed. Which name to grant is **to confirm on the first run**: a package installs a desktop entry, an AppImage has none until it is integrated.-**Logs of a packaged build.** OpenScreen writes no log file. The main process logs to its standard output, so a launch from a terminal shows it there, `[content-protection] OFF for the HUD window` included; whether the Windows executable prints into the PowerShell that started it is **to confirm on the first run**. However it was launched, the app keeps the last 500 main-process lines, and tray → *Save Diagnostics* writes them to a JSON file of your choice (`mainProcessLogs`), with the capture helper's recent output (`helperOutput.windows`, `.mac` or `.linux`) and, while the editor is open, its project (`projectState`). The renderer's `console` calls are stripped from packaged builds. Recordings and their `.cursor.json` and `.session.json` sidecars are in the `recordings` folder of `%APPDATA%\Openscreen`, `~/Library/Application Support/Openscreen` or `~/.config/Openscreen`.+**Logs of a packaged build.** OpenScreen writes no log file. The main process logs to its standard output, so a launch from a terminal shows it there, `[content-protection] OFF for the HUD window` included; whether the Windows executable prints into the PowerShell that started it is **to confirm on the first run**. However it was launched, the app keeps the last 500 main-process lines, and tray → *Save Diagnostics* writes them to a JSON file of your choice (`mainProcessLogs`), with the capture helper's recent output (`helperOutput.windows`, `.mac` or `.linux`). It leaves the open project out; a project file is in `userData/projects`. The renderer's `console` calls are stripped from packaged builds. Recordings and their `.cursor.json` and `.session.json` sidecars are in the `recordings` folder of `%APPDATA%\Openscreen`, `~/Library/Application Support/Openscreen` or `~/.config/Openscreen`.## Launch and HUD