Skip to content

feat(desktop): Add Export Logs#26262

Merged
Hona merged 7 commits into
anomalyco:devfrom
Hona:window-recovery
May 21, 2026
Merged

feat(desktop): Add Export Logs#26262
Hona merged 7 commits into
anomalyco:devfrom
Hona:window-recovery

Conversation

@Hona
Copy link
Copy Markdown
Member

@Hona Hona commented May 8, 2026

Summary

  • add desktop export logs archive with last 24h desktop, server, network, and crashpad logs
  • add per-run scoped desktop logs for renderer, window, protocol, utility, server, preload, PTY, network, and crash events
  • add VS Code-style renderer failure dialogs with user-triggered relaunch/export/quit actions

Testing

  • bun typecheck (packages/desktop)
  • bun typecheck (packages/app)
  • git push hook: bun turbo typecheck

@Hona Hona requested a review from adamdotdevin as a code owner May 8, 2026 01:38
Copilot AI review requested due to automatic review settings May 8, 2026 01:38
@Hona Hona changed the title Add Export Logs feat(desktop): Add Export Logs May 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 exportDebugLogs IPC + 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 thread packages/desktop/src/main/logging.ts Outdated
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()))
Comment thread packages/desktop/src/main/windows.ts Outdated
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)}`)
@Hona Hona added the beta label May 18, 2026
opencode-agent Bot added a commit that referenced this pull request May 18, 2026
opencode-agent Bot added a commit that referenced this pull request May 18, 2026
opencode-agent Bot added a commit that referenced this pull request May 19, 2026
opencode-agent Bot added a commit that referenced this pull request May 19, 2026
opencode-agent Bot added a commit that referenced this pull request May 19, 2026
opencode-agent Bot added a commit that referenced this pull request May 19, 2026
opencode-agent Bot added a commit that referenced this pull request May 19, 2026
opencode-agent Bot added a commit that referenced this pull request May 19, 2026
opencode-agent Bot added a commit that referenced this pull request May 19, 2026
opencode-agent Bot added a commit that referenced this pull request May 19, 2026
opencode-agent Bot added a commit that referenced this pull request May 19, 2026
opencode-agent Bot added a commit that referenced this pull request May 19, 2026
opencode-agent Bot added a commit that referenced this pull request May 19, 2026
opencode-agent Bot added a commit that referenced this pull request May 19, 2026
opencode-agent Bot added a commit that referenced this pull request May 19, 2026
opencode-agent Bot added a commit that referenced this pull request May 19, 2026
opencode-agent Bot added a commit that referenced this pull request May 19, 2026
opencode-agent Bot added a commit that referenced this pull request May 20, 2026
opencode-agent Bot added a commit that referenced this pull request May 20, 2026
# Conflicts:
#	packages/desktop/src/main/menu.ts
#	packages/desktop/src/main/windows.ts
opencode-agent Bot added a commit that referenced this pull request May 20, 2026
opencode-agent Bot added a commit that referenced this pull request May 20, 2026
opencode-agent Bot added a commit that referenced this pull request May 20, 2026
opencode-agent Bot added a commit that referenced this pull request May 20, 2026
opencode-agent Bot added a commit that referenced this pull request May 20, 2026
opencode-agent Bot added a commit that referenced this pull request May 20, 2026
opencode-agent Bot added a commit that referenced this pull request May 20, 2026
opencode-agent Bot added a commit that referenced this pull request May 20, 2026
opencode-agent Bot added a commit that referenced this pull request May 20, 2026
opencode-agent Bot added a commit that referenced this pull request May 20, 2026
opencode-agent Bot added a commit that referenced this pull request May 20, 2026
opencode-agent Bot added a commit that referenced this pull request May 21, 2026
@Hona Hona merged commit bea3ca5 into anomalyco:dev May 21, 2026
9 checks passed
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants