Skip to content

feat(crash): capture Go panics, breadcrumbs, and group summaries#4187

Merged
esengine merged 1 commit into
main-v2from
feat/crash-richer-reports
Jun 12, 2026
Merged

feat(crash): capture Go panics, breadcrumbs, and group summaries#4187
esengine merged 1 commit into
main-v2from
feat/crash-richer-reports

Conversation

@esengine

Copy link
Copy Markdown
Owner

Why

The desktop crash dashboard only ever saw frontend WebView errors. The entire
Go agent/provider/tool layer was invisible: an unrecovered panic kills the
process before the click-to-send overlay can paint, so it never produced a
single report. On top of that every group was an opaque count=1 fingerprint
and minified stacks carried no symbols, so nothing was triageable without
opening each one.

What changed

  • Go panic capture + deferred resend (desktop/crash_pending.go). A
    recoverToPending(site) guard on the goroutines we own (restore / build
    controller / snapshot loop) writes a path-scrubbed stack to
    crash-pending.json and re-raises, so the process still crashes — the
    stack is recorded, not swallowed. flushPendingCrash drains and POSTs it on
    the next launch, gated on the same desktop.telemetry opt-out as the launch
    ping (dev builds and opt-out drop it unsent). Wails-managed bound-call
    goroutines are not yet wrapped — a known follow-up.

  • Dashboard group summaries (worker). Each group now stores a one-line
    title, shown as a summary column in the list so a crash reads at a glance
    instead of requiring a click per fingerprint.

  • Frontend breadcrumbs (breadcrumbs.ts). A 30-entry ring buffer
    (console.error/warn, tab navigation) folded into the report and scrubbed
    by the existing Go path scrubber. Terser's drop_console: true was deleting
    the very console.* calls the breadcrumbs collect, so production builds now
    keep warn/error and drop only the noise.

  • Readable stacks + build identity (vite.config.ts). keep_fnames /
    keep_classnames preserve real function/component names through
    minification, and the build commit is stamped into each report. The worker
    fingerprint normalizes the build <sha> token so grouping stays stable
    across builds.

Deploy notes (worker)

groups.title is a new column. Run the one-time migration before deploying
the worker, or the new queries hit a missing column:

wrangler d1 execute reasonix-crash --remote --file=workers/crash-report/migrate-title.sql
wrangler deploy   # from workers/crash-report

Fresh installs get the column from schema.sql.

Verification

  • desktop: go vet clean; new crash_pending_test.go covers capture +
    re-raise, path scrubbing, size cap, send-and-clear, and the dev guard.
  • workers/crash-report: tsc --noEmit clean.

The crash dashboard only ever saw frontend WebView errors, every group was
an opaque count=1 fingerprint, and minified stacks carried no symbols. This
widens what a report captures and makes the dashboard triageable.

- desktop: capture Go-side panics on the goroutines we own (restore/build/
  snapshot), persist a scrubbed stack to crash-pending.json, and resend on
  next launch under the desktop.telemetry opt-out. recoverToPending re-raises
  so the process still crashes — the stack is recorded, not swallowed.
- worker: store a one-line title per group and surface it in the dashboard
  list so a crash is readable without opening each fingerprint.
- frontend: a breadcrumb ring buffer (console.error/warn, tab navigation)
  folded into the report. Keep console.warn/error in production — terser
  drop_console was deleting the very trail the breadcrumbs collect.
- frontend: preserve function/class names through terser and stamp the build
  commit, normalized in the worker fingerprint so grouping stays build-stable.
@esengine esengine requested a review from SivanCola as a code owner June 12, 2026 12:55
@github-actions github-actions Bot added desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 12, 2026
@esengine esengine merged commit 89bcd48 into main-v2 Jun 12, 2026
14 checks passed
@esengine esengine deleted the feat/crash-richer-reports branch June 12, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant