fix(sessions): auto-recover + report the chat SessionView render-loop crash#3747
Closed
puemos wants to merge 2 commits into
Closed
fix(sessions): auto-recover + report the chat SessionView render-loop crash#3747puemos wants to merge 2 commits into
puemos wants to merge 2 commits into
Conversation
… crash The task Chat panel sometimes shows "Something went wrong / Minified React error #185" (Maximum update depth exceeded) when navigating back to a task, and stays stuck on the fallback. Issue #2165 notes the loop is transient — "Try again recovers it" — so the render loop trips once and clears on the next mount. Two problems on `main`: - The SessionView boundary keys recovery on `resetKey={taskId}`, which doesn't change when you return to the same task, so a transient error strands the user until they manually retry. - That boundary was wired to the bare `ErrorBoundary` primitive (no `onError`), so these crashes no longer report to error tracking — the historical `boundary_name:"SessionView"` events came from older builds using the shell wrapper. Changes: - Add opt-in, bounded `autoRecover` to the `ErrorBoundary` primitive. On catch it reports via `onError` first, then schedules up to 2 self-resets (replaying the manual "Try again"); while pending it renders nothing instead of flashing the error UI. A persistent loop still lands on the manual fallback — no unbounded retry storm — and the budget refills after a healthy stretch. - Point the SessionView boundary at the telemetry-reporting shell `ErrorBoundary` and enable `autoRecover`, restoring observability and auto-healing the transient loop. Does not change the underlying (layout-timing) loop trigger, which needs the real app to reproduce; restored telemetry will confirm whether it still fires. Refs #2165 Generated-By: PostHog Code Task-Id: 24d17b80-ad39-4217-9eb6-dcc5ad043fb8
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Contributor
|
👋 Visual changes detected for this PR. Review and approve in PostHog Visual Review If these changes are unexpected, they may be caused by a flaky test or a broken snapshot on master. Don't approve — rerun the job or wait for a fix. |
Generated-By: PostHog Code Task-Id: 24d17b80-ad39-4217-9eb6-dcc5ad043fb8
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
The task Chat panel sometimes shows "Something went wrong / Minified React error #185" (Maximum update depth exceeded) when navigating back to a task, and then stays stuck on the error fallback until the user manually clicks Try again. This is caught by the
SessionViewerror boundary and has recurred across many users on recent packaged builds; it was reported in #2165, whose own note is the key clue — "Clicking Try again recovered the session… the error is in a render path" — i.e. the render loop is transient: it trips React's limit once and then clears on the next mount.Why the user is stuck — two issues on
main:SessionViewboundary keys recovery onresetKey={taskId}, which doesn't change when you navigate back to the same task, so a transient error strands the user on the fallback until they retry by hand.ErrorBoundaryprimitive (noonError), so these crashes no longer report to error tracking — the historicalboundary_name:"SessionView"events came from older builds that used the telemetry shell wrapper. We're currently blind to them.Refs #2165
Changes
ErrorBoundaryprimitive — add an opt-in, boundedautoRecover. On catch it reports viaonErrorfirst (observability preserved), then schedules up to 2 self-resets — automating the manual "Try again" that Chat crashes with React error 185 (max update depth) #2165 says already works. While a recovery is pending it renders nothing instead of flashing the red error UI for a one-frame blip. A persistent loop still lands on the manual fallback (no unbounded retry storm), and the budget refills after a healthy stretch.TaskLogsPanel) — point it at the telemetry-reporting shellErrorBoundaryand enableautoRecover. This restores error-tracking visibility and auto-heals the transient loop so returning to a task no longer strands the user.Behaviour is unchanged for every other boundary (
autoRecoverdefaults off).Note: this does not change the underlying (layout-timing) loop trigger, which needs the real app to reproduce and isolate; the restored telemetry will confirm whether it still fires so the root cause can be chased as a follow-up.
How did you test this?
Added
packages/ui/src/primitives/ErrorBoundary.test.tsx(Vitest + Testing Library, real timers) which:autoRecover, the boundary stays on the fallback after the transient condition clears (sameresetKey, no manual retry);autoRecoverclears a transient error with no manual retry and reports it first; a persistent loop is bounded and ends on the manual fallback; manual retry still works after auto-recovery is exhausted.Ran locally (all green):
vitest run src/primitives/ErrorBoundary.test.tsx src/shell/ErrorBoundary.test.tsx— 14 passedbiome checkon the changed files — cleanpnpm --filter @posthog/ui typecheck— cleanAutomatic notifications
Created with PostHog Code