feat: capture uncaught IPC handler errors as PostHog exceptions#2886
Conversation
Add sendTelemetryException() utility that sends $exception events to PostHog via the renderer bridge. Wire it into all three IPC handler factories (createTypedHandler, createLoggedTypedHandler, createLoggedHandler) so every ipcMain.handle error is reported with the channel name as context. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@BugBot run |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the application's error monitoring capabilities by implementing a robust system for capturing uncaught Inter-Process Communication (IPC) handler errors. It introduces a new telemetry utility to report these exceptions to PostHog, providing valuable insights into runtime issues without altering the application's existing error propagation. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Greptile SummaryThis PR adds automatic PostHog exception telemetry for all uncaught IPC handler errors by introducing a
Confidence Score: 5/5
Sequence DiagramsequenceDiagram
participant R as Renderer
participant IPC as ipcMain handler<br/>(createTypedHandler /<br/>createLoggedTypedHandler /<br/>createLoggedHandler)
participant H as Business Logic Handler
participant T as sendTelemetryException
participant TE as sendTelemetryEvent
participant BW as BrowserWindow
R->>IPC: invoke(channel, args)
IPC->>H: handler(event, parsed.data)
H-->>IPC: throws Error
IPC->>T: sendTelemetryException(err, { ipc_channel })
T->>TE: sendTelemetryEvent("$exception", { $exception_type, $exception_message, $exception_stack_trace_raw, ipc_channel })
TE->>BW: webContents.send("telemetry:event", payload)
BW-->>R: PostHog captures $exception event
IPC-->>R: re-throw original error
Last reviewed commit: 19beed1 |
🔍 Dyadbot Code Review SummaryVerdict: ✅ YES - Ready to merge Reviewed by 3 independent agents: Correctness Expert, Code Health Expert, UX Wizard. ✅ No actionable issues found. This is a clean, focused PR that adds telemetry exception capture to all three IPC handler factories without changing existing behavior. What we checked:
🚫 Dropped False Positives (4 items)
Generated by Dyadbot multi-agent code review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 19beed138b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
1 issue found across 3 files
Confidence score: 3/5
- There is a concrete medium-severity issue in
src/ipc/utils/telemetry.ts: placing...contextafter$exception_*fields allows context keys to overwrite exception metadata silently. - With severity 6/10 and high confidence (9/10), this introduces real regression risk for observability/debugging because exception type/message/stack data can become inaccurate or lost.
- Given the issue is scoped to telemetry shaping (not an obvious runtime crash path), this looks manageable but still carries enough user-impacting diagnostic risk to warrant caution.
- Pay close attention to
src/ipc/utils/telemetry.ts- ensure$exception_*fields cannot be overridden by context spread order.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/ipc/utils/telemetry.ts">
<violation number="1" location="src/ipc/utils/telemetry.ts:43">
P2: The `...context` spread is placed after the `$exception_*` properties, which means any context containing keys like `$exception_type`, `$exception_message`, or `$exception_stack_trace_raw` will silently overwrite the actual exception data sent to PostHog. Move `...context` before the exception properties so the real error metadata always takes precedence.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
Code Review
This pull request adds exception tracking for IPC handlers, which is a valuable improvement for observability. However, the current implementation of sending IPC handler errors to PostHog as telemetry events poses a privacy risk, as it sends raw error messages and stack traces that may contain sensitive information such as local usernames (PII) and user-supplied data from IPC arguments. Additionally, there is a suggestion to improve the consistency of error propagation in one of the handlers to make the overall error handling more robust.
🎭 Playwright Test Results❌ Some tests failed
Summary: 236 passed, 3 failed, 7 flaky, 6 skipped Failed Tests🍎 macOS
📋 Re-run Failing Tests (macOS)Copy and paste to re-run all failing spec files locally: npm run e2e \
e2e-tests/debugging_logs.spec.ts \
e2e-tests/partial_response.spec.ts \
e2e-tests/select_component.spec.ts
|
✅ Claude Code completed successfullySummary
Review Comments DetailsAddressed with code changes (3 threads):
Resolved with explanations (2 threads):
CI Checks:
|
🤖 Claude Code Review SummaryPR Confidence: 4/5All review comments addressed; code changes are minimal and correct. E2E flaky tests reduce confidence slightly but are unrelated to this PR. Unresolved ThreadsNo unresolved threads Resolved Threads
Product Principle SuggestionsNo suggestions — principles were not needed for these purely technical review comments. 🤖 Generated by Claude Code |
Summary
sendTelemetryException()utility that sends$exceptionevents to PostHog via the main→renderer telemetry bridge, including error type, message, and stack tracecreateTypedHandler,createLoggedTypedHandler,createLoggedHandler) so everyipcMain.handleerror is automatically reported with the IPC channel name as contextTest plan
$exceptionevents in PostHog withipc_channelpropertybefore_sendfilter)🤖 Generated with Claude Code