feat(code): Enrich renderer crash events for Error Tracking#2514
Open
charlesvien wants to merge 4 commits into
Open
feat(code): Enrich renderer crash events for Error Tracking#2514charlesvien wants to merge 4 commits into
charlesvien wants to merge 4 commits into
Conversation
This was referenced Jun 6, 2026
Member
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
2 tasks
Contributor
What T-Rex did
ArtifactsStandalone targeted check script
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
apps/code/src/main/services/posthog-analytics.ts:122-127
**Protect session stamping**
`captureException` adds the main-owned `$session_id`, then lets `additionalProperties` overwrite it. If a caller passes a stale or incorrect `$session_id`, the exception is sent with that value instead of the session main minted for replay linking, so crash events can detach from the intended replay. Put caller properties before the system-owned fields so `$session_id` is protected like `app_version` already is.
```suggestion
posthogClient.captureException(error, distinctId, {
team: "posthog-code",
...additionalProperties,
...(sessionId ? { $session_id: sessionId } : {}),
app_version: getAppVersion(),
});
```
### Issue 2 of 2
apps/code/src/main/services/posthog-analytics.ts:49-53
**Mint before crashes**
`sessionId` is created only after the renderer calls `analytics.getSessionId`, but the main crash handlers and main PostHog client are active before the renderer `useEffect` can make that tRPC call. A renderer crash during startup can therefore be captured without `$session_id`, which loses the crash-to-replay link this change is adding. Mint the main-owned ID before creating the first window, or make crash capture call `getOrCreateSessionId()` when it needs to stamp a crash event.
Reviews (1): Last reviewed commit: "enrich renderer crash events for error t..." | Re-trigger Greptile |
2f2ae16 to
c7cb373
Compare
f9ee6d9 to
d223dfe
Compare
8c6bc8d to
fec00b8
Compare
d223dfe to
072d2a7
Compare
fec00b8 to
a51aca3
Compare
072d2a7 to
5a37f67
Compare
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
a51aca3 to
da4b88a
Compare
5a37f67 to
11dabe3
Compare
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.

Problem
Renderer OOM crashes landed in Error Tracking as one collapsed, undiagnosable issue: the stack pointed at the handler, with no memory, no native logs, and no linked replay.
Changes
How did you test this?
Manually
Automatic notifications