Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
fix(bug-report): upload from packaged app, surface Linear mint errors (#2656)
Andrew Mikofalvy1d84bb355af5
diff --git a/.changeset/bug-report-send-uploads-in-packaged-app.md b/.changeset/bug-report-send-uploads-in-packaged-app.mdnew file mode 100644index 000000000..dbf5a3b14--- /dev/null+++ b/.changeset/bug-report-send-uploads-in-packaged-app.md@@ -0,0 +1,12 @@+---+"@inkeep/open-knowledge": patch+---++Fix "Report a Bug" in the packaged desktop app. Send now attempts to upload your+report to the OpenKnowledge team, instead of always opening the "send it by+email" draft. The packaged app shipped with no bug-report intake configured, so+every Send skipped the upload and fell straight through to email. It now targets+the production intake by default (`OK_BUG_REPORT_INTAKE_URL` still overrides, and+unpackaged dev builds are unchanged so a dev run never uploads by accident). If+the upload cannot be completed, Send still offers the same email draft, so no+report is lost.diff --git a/packages/desktop/src/main/index.ts b/packages/desktop/src/main/index.tsindex 3efed611b..e54bcf5ee 100644--- a/packages/desktop/src/main/index.ts+++ b/packages/desktop/src/main/index.ts@@ -218,6 +218,7 @@ import {handleBugReportCrashAck,handleBugReportCreate,handleBugReportSend,+ resolveBugReportIntakeUrl,} from './ipc/bug-report.ts';import { handleBuildAndOpen, handleDetectClaudeDesktop } from './ipc/install-skill.ts';import {@@ -3802,7 +3803,12 @@ function registerIpcHandlers() {if (request.kind === 'send') {return handleBugReportSend({- intakeBaseUrl: process.env.OK_BUG_REPORT_INTAKE_URL,+ // Packaged builds default to the production intake so a shipped app+ // uploads; `OK_BUG_REPORT_INTAKE_URL` overrides, dev stays on email.+ intakeBaseUrl: resolveBugReportIntakeUrl({+ envUrl: process.env.OK_BUG_REPORT_INTAKE_URL,+ packaged: app.isPackaged,+ }),appVersion: app.getVersion(),platform: `${process.platform} ${osRelease()}`,// Same containment root the Reveal handler whitelists above — onlydiff --git a/packages/desktop/src/main/ipc/bug-report.test.ts b/packages/desktop/src/main/ipc/bug-report.test.tsindex f1c9e53fa..fc9ec6c72 100644--- a/packages/desktop/src/main/ipc/bug-report.test.ts+++ b/packages/desktop/src/main/ipc/bug-report.test.ts@@ -34,11 +34,13 @@ import { handleShellOpenExternal } from '../shell-allowlist.ts';import {type BugReportCreateDeps,type BugReportSendDeps,+ DEFAULT_BUG_REPORT_INTAKE_URL,handleBugReportCrashAck,handleBugReportCreate,handleBugReportSend,MAX_UPLOAD_ZIP_BYTES,parseTransportSafeUrl,+ resolveBugReportIntakeUrl,} from './bug-report.ts';const tmpDirs: string[] = [];@@ -438,6 +440,37 @@ function makeSendRig(intakeBaseUrl: string | undefined): {};}+describe('resolveBugReportIntakeUrl', () => {+ test('an explicit env URL always wins, packaged or not', () => {+ const envUrl = 'https://intake.example.test';+ expect(resolveBugReportIntakeUrl({ envUrl, packaged: true })).toBe(envUrl);+ expect(resolveBugReportIntakeUrl({ envUrl, packaged: false })).toBe(envUrl);+ });++ test('a packaged build with no env falls back to the production intake', () => {+ expect(resolveBugReportIntakeUrl({ envUrl: undefined, packaged: true })).toBe(+ DEFAULT_BUG_REPORT_INTAKE_URL,+ );+ });++ test('an unpackaged build with no env stays undefined (email fallback, no accidental upload)', () => {+ expect(resolveBugReportIntakeUrl({ envUrl: undefined, packaged: false })).toBeUndefined();+ });++ test('an empty or whitespace env value is treated as unset', () => {+ expect(resolveBugReportIntakeUrl({ envUrl: '', packaged: true })).toBe(+ DEFAULT_BUG_REPORT_INTAKE_URL,+ );+ expect(resolveBugReportIntakeUrl({ envUrl: ' ', packaged: false })).toBeUndefined();+ });++ test('a surrounding-whitespace env value is trimmed', () => {+ expect(resolveBugReportIntakeUrl({ envUrl: ' https://x.test ', packaged: true })).toBe(+ 'https://x.test',+ );+ });+});+describe('handleBugReportSend — upload happy path', () => {test('runs mint, direct PUT with verbatim signed headers, and completion, returning the reference', async () => {const stub = await startIntakeStub();diff --git a/packages/desktop/src/main/ipc/bug-report.ts b/packages/desktop/src/main/ipc/bug-report.tsindex 1c6a59d42..38548a6a3 100644--- a/packages/desktop/src/main/ipc/bug-report.ts+++ b/packages/desktop/src/main/ipc/bug-report.ts@@ -190,13 +190,41 @@ export async function handleBugReportCreate(const SUPPORT_EMAIL = '[email protected]';+/**+ * Production intake origin baked into packaged builds — the apex routes+ * `/api/bug-report` to the private intake (see the desktop README's bug-report+ * table). Mirrors how the auto-updater (`proxyFeed.base`) and share-handoff+ * (`PROD_BASE`) hardcode `openknowledge.ai` as the shipped default rather than+ * relying on a runtime env var a GUI-launched app never receives.+ */+export const DEFAULT_BUG_REPORT_INTAKE_URL = 'https://openknowledge.ai';++/**+ * Resolve the intake base URL for the `send` wiring. An explicit+ * `OK_BUG_REPORT_INTAKE_URL` always wins; otherwise a packaged build falls back+ * to the production origin so a shipped app actually uploads instead of silently+ * dropping every Send to the email draft. Unpackaged builds (dev / test /+ * Playwright) resolve to `undefined` and keep the email fallback, so a dev run+ * never uploads to the production intake by accident. An empty / whitespace env+ * value is treated as unset.+ */+export function resolveBugReportIntakeUrl(args: {+ envUrl: string | undefined;+ packaged: boolean;+}): string | undefined {+ const trimmed = args.envUrl?.trim();+ if (trimmed !== undefined && trimmed !== '') return trimmed;+ return args.packaged ? DEFAULT_BUG_REPORT_INTAKE_URL : undefined;+}+export interface BugReportSendDeps {/**- * Intake endpoint origin (e.g. `https://openknowledge.ai`), from- * `OK_BUG_REPORT_INTAKE_URL`. Absent means the endpoint is not deployed or- * not configured — the designed default: send makes no network attempt and- * resolves to the email fallback with `reason: 'email-draft'`, which the- * dialog renders as the email flow rather than a failure.+ * Intake endpoint origin (e.g. `https://openknowledge.ai`). Wired from+ * `resolveBugReportIntakeUrl`: an explicit `OK_BUG_REPORT_INTAKE_URL`, else the+ * packaged production default, else `undefined`. Absent (unpackaged with no+ * override) means send makes no network attempt and resolves to the email+ * fallback with `reason: 'email-draft'`, which the dialog renders as the email+ * flow rather than a failure.*/intakeBaseUrl: string | undefined;/** App version (`app.getVersion()`), stamped into the report metadata by main. */