feat(desktop): Add Export Logs#26262
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a desktop-facing “Export Logs” capability to help diagnose issues by collecting recent desktop/server/network/crash logs, and introduces more granular per-run log scoping plus recovery dialogs when the renderer fails/unresponsive.
Changes:
- Added
exportDebugLogsIPC + preload API and surfaced it via Desktop menu and App command palette. - Implemented per-run scoped logging, Crashpad configuration, and net logging, plus a zip export of the last 24h of relevant logs.
- Added window recovery wiring to detect renderer load failures/crashes/unresponsiveness and present relaunch/export/quit options.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/desktop/src/preload/types.ts | Extends preload API typing with exportDebugLogs. |
| packages/desktop/src/preload/index.ts | Exposes exportDebugLogs via ipcRenderer.invoke. |
| packages/desktop/src/main/windows.ts | Adds renderer protocol error logging + window recovery dialogs and relaunch handler plumbing. |
| packages/desktop/src/main/menu.ts | Adds “Export Logs…” menu items. |
| packages/desktop/src/main/logging.ts | Implements per-run log directories, Crashpad/net logging, and zip export. |
| packages/desktop/src/main/ipc.ts | Registers export-debug-logs IPC handler. |
| packages/desktop/src/main/index.ts | Initializes crash reporter + net logging, wires relaunch handler, and hooks export logs into menu/IPCs. |
| packages/desktop/package.json | Adds @zip.js/zip.js dependency. |
| packages/app/src/pages/layout.tsx | Adds a command-palette entry for exporting logs (desktop-only). |
| packages/app/src/app.tsx | Updates global window.api typing for exportDebugLogs. |
| bun.lock | Locks new dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+149
to
+153
| for (const entry of readdirSync(current)) { | ||
| const file = join(current, entry) | ||
| const info = statSync(file) | ||
| if (info.isDirectory()) { | ||
| walk(file) |
| return new Date() | ||
| .toISOString() | ||
| .replace(/[-:]/g, "") | ||
| .replace(/\.\d+Z$/, "") |
Comment on lines
+124
to
+134
| platform: process.platform, | ||
| arch: process.arch, | ||
| versions: process.versions, | ||
| uptime: process.uptime(), | ||
| userData: app.getPath("userData"), | ||
| logs: root, | ||
| currentRun: run, | ||
| crashDumps: app.getPath("crashDumps"), | ||
| serverLogs: serverLogRoots(), | ||
| netLog: netLogPath, | ||
| } |
Comment on lines
+166
to
+171
| async function writeZip(output: string, entries: Entry[]) { | ||
| const writer = new ZipWriter(new BlobWriter("application/zip")) | ||
| for (const entry of entries) { | ||
| await writer.add(entry.name, new BlobReader(new Blob([new Uint8Array(entry.data ?? readFileSync(entry.path!))]))) | ||
| } | ||
| writeFileSync(output, Buffer.from(await (await writer.close()).arrayBuffer())) |
| void show("OpenCode is not responding", "You can relaunch the app, open the logs, or keep waiting.", true) | ||
| }) | ||
| win.on("responsive", () => { | ||
| log.error("renderer responsive", { window: name, currentURL: win.webContents.getURL() }) |
Comment on lines
+1064
to
+1070
| { | ||
| id: "logs.export", | ||
| title: "Export logs", | ||
| category: language.t("command.category.settings"), | ||
| onSelect: () => { | ||
| void window.api?.exportDebugLogs?.() | ||
| }, |
| return new Response("Not found", { status: 404 }) | ||
| } | ||
|
|
||
| const file = resolve(rendererRoot, `.${decodeURIComponent(url.pathname)}`) |
This was referenced May 8, 2026
# Conflicts: # packages/desktop/src/main/menu.ts # packages/desktop/src/main/windows.ts
MyNameIsGMLi
pushed a commit
to MyNameIsGMLi/opencode
that referenced
this pull request
May 22, 2026
rustybret
pushed a commit
to rustybret/opencode
that referenced
this pull request
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing